use diff mail client

This commit is contained in:
Henry Hiles 2026-02-28 19:48:50 -05:00
commit 2ccfd214e1
No known key found for this signature in database
7 changed files with 113 additions and 162 deletions

View file

@ -1,7 +1,6 @@
import "dart:io"; import "dart:io";
import "package:cli_tools/config.dart"; import "package:cli_tools/config.dart";
import "package:collection/collection.dart"; import "package:collection/collection.dart";
import "package:enough_mail/enough_mail.dart" as mail;
import "package:markdown/markdown.dart"; import "package:markdown/markdown.dart";
import "package:matrix/matrix.dart"; import "package:matrix/matrix.dart";
import "package:nexusbot/controllers/client_controller.dart"; import "package:nexusbot/controllers/client_controller.dart";
@ -20,7 +19,7 @@ void main(List<String> argsRaw) async {
..addOption("homeserver", mandatory: true) ..addOption("homeserver", mandatory: true)
..addOption("failureUri", mandatory: true) ..addOption("failureUri", mandatory: true)
..addOption("successUri", mandatory: true) ..addOption("successUri", mandatory: true)
..addOption("name", mandatory: true) ..addOption("username", mandatory: true)
..addOption("adminName", mandatory: true) ..addOption("adminName", mandatory: true)
..addOption("adminRoom", mandatory: true) ..addOption("adminRoom", mandatory: true)
..addOption("email", mandatory: true) ..addOption("email", mandatory: true)
@ -28,9 +27,7 @@ void main(List<String> argsRaw) async {
..addOption("mailDomain", mandatory: true) ..addOption("mailDomain", mandatory: true)
..addOption("smtpPasswordFile", mandatory: true) ..addOption("smtpPasswordFile", mandatory: true)
..addOption("botPasswordFile", mandatory: true) ..addOption("botPasswordFile", mandatory: true)
..addOption("emailAlias") ..addOption("mailUsername", mandatory: true)
..addOption("userName")
..addOption("outgoingPort")
..addOption("inviteTo"); ..addOption("inviteTo");
final container = ProviderContainer(); final container = ProviderContainer();
@ -44,16 +41,20 @@ void main(List<String> argsRaw) async {
final settings = container.read(SettingsController.provider)!; final settings = container.read(SettingsController.provider)!;
if (event.room.canonicalAlias != settings.adminRoom) return; if (event.room.canonicalAlias != settings.adminRoom) return;
if (event.senderId.startsWith("@${settings.name}:")) return; if (event.senderId.startsWith("@${settings.username}:")) return;
switch (event.type) { switch (event.type) {
case EventTypes.Reaction: case EventTypes.Reaction:
final reaction = final reaction =
(event.content["m.relates_to"] as Map<String, dynamic>)["key"]; (event.content["m.relates_to"] as Map<String, dynamic>)["key"];
final parentEvent = await client.getOneRoomEvent( final parentEvent = await client.getOneRoomEvent(
event.roomId!, event.roomId!,
event.relationshipEventId!, event.relationshipEventId!,
); );
if (!parentEvent.senderId.startsWith("@${settings.name}:")) return; if (!parentEvent.senderId.startsWith("@${settings.username}:")) {
return;
}
if (reaction == "") { if (reaction == "") {
final registration = Registration.fromJson(parentEvent.content); final registration = Registration.fromJson(parentEvent.content);
container container
@ -90,29 +91,17 @@ void main(List<String> argsRaw) async {
"✉️ Sending...", "✉️ Sending...",
); );
String replace(String body) => body
.replaceAll("\${username}", registration.username)
.replaceAll("\${password}", password);
await container await container
.read(MailClientController.provider.notifier) .read(MailClientController.provider.notifier)
.sendMessage( .send(
plainText: plainText: replace(settings.plainText),
"""Your registration for Federated Nexus has been accepted! Your credentials are: markdown: replace(settings.markdown),
Username: ${registration.username} subject: settings.subject,
Password: $password to: registration.email,
If you have any questions, check out our documentation: https://federated.nexus/services/matrix/.
If you have any issues, reply to this email.""",
markdown:
"""# Your registration for Federated Nexus has been accepted!
## Your credentials are:
- ### Username: ${registration.username}
- ### Password: $password
If you have any questions, check out [our documentation](https://federated.nexus/services/matrix/).
If you have any issues, reply to this email.""",
subject:
"Your registration for Federated Nexus has been accepted!",
to: mail.MailAddress(registration.username, registration.email),
); );
await event.room.redactEvent(reactionEvent!); await event.room.redactEvent(reactionEvent!);
await event.room.sendReaction(event.eventId, "✉️ Sent!"); await event.room.sendReaction(event.eventId, "✉️ Sent!");

View file

@ -1,56 +1,52 @@
import "dart:io"; import "dart:io";
import "package:enough_mail/enough_mail.dart"; import "package:mailer/mailer.dart";
import "package:mailer/mailer.dart" as mailer;
import 'package:mailer/smtp_server.dart';
import "package:markdown/markdown.dart"; import "package:markdown/markdown.dart";
import "package:nexusbot/controllers/settings_controller.dart"; import "package:nexusbot/controllers/settings_controller.dart";
import "package:riverpod/riverpod.dart"; import "package:riverpod/riverpod.dart";
class MailClientController extends AutoDisposeAsyncNotifier<MailClient> { class MailClientController extends AutoDisposeAsyncNotifier<SmtpServer> {
@override @override
Future<MailClient> build() async { Future<SmtpServer> build() async {
final settings = ref.watch(SettingsController.provider)!; final settings = ref.watch(SettingsController.provider)!;
final account = MailAccount.fromManualSettings( return SmtpServer(
email: settings.email, settings.mailDomain,
userName: settings.userName ?? "", username: settings.mailUsername,
outgoingClientDomain: settings.mailDomain,
outgoingPort: settings.outgoingPort,
name: settings.mailName,
incomingHost: settings.mailDomain,
outgoingHost: settings.mailDomain,
password: (await File(settings.smtpPasswordFile).readAsString()).trim(), password: (await File(settings.smtpPasswordFile).readAsString()).trim(),
); );
return MailClient(account);
} }
Future<void> sendMessage({ Future<void> send({
required String plainText, required String plainText,
required String markdown, required String markdown,
required String subject, required String subject,
required MailAddress to, required String to,
}) async { }) async {
final client = await future; final server = await future;
final settings = ref.watch(SettingsController.provider)!; final settings = ref.watch(SettingsController.provider)!;
await client.connect(); await mailer.send(
Message()
await client.sendMessageBuilder( ..from = settings.email
MessageBuilder.prepareMultipartAlternativeMessage( ..recipients = [to]
plainText: plainText,
htmlText: markdownToHtml(markdown),
)
..subject = subject ..subject = subject
..from = [ ..html = markdownToHtml(markdown)
MailAddress(settings.mailName, settings.emailAlias ?? settings.email), ..text = plainText,
] server,
..to = [to],
sentMailbox: await client.selectMailboxByFlag(MailboxFlag.sent),
); );
await client.disconnect();
} }
static final provider = static final provider =
AutoDisposeAsyncNotifierProvider<MailClientController, MailClient>( AutoDisposeAsyncNotifierProvider<MailClientController, SmtpServer>(
MailClientController.new, MailClientController.new,
); );
} }
// # email-void smtp.us-east-1.void amazonaws.com
// # TLS
// # 587
// # ses-smtp-user
// #
// # BFRVr5CH56l5Zdfpfm9hki2r35NIhyY7fnZNsmxAZZpI

View file

@ -10,18 +10,19 @@ abstract class Settings with _$Settings {
required Uri homeserver, required Uri homeserver,
required Uri failureUri, required Uri failureUri,
required Uri successUri, required Uri successUri,
required String name, required String username,
required String adminName, required String adminName,
required String adminRoom, required String adminRoom,
required String email, required String email,
required String? emailAlias,
required String mailName, required String mailName,
required String? inviteTo, required String? inviteTo,
required String mailDomain, required String mailDomain,
required String smtpPasswordFile, required String smtpPasswordFile,
required String botPasswordFile, required String botPasswordFile,
String? userName, required String mailUsername,
@Default(465) int outgoingPort, required String plainText,
required String subject,
required String markdown,
}) = _Settings; }) = _Settings;
factory Settings.fromJson(Map<String, dynamic> json) => factory Settings.fromJson(Map<String, dynamic> json) =>

View file

@ -16,7 +16,7 @@ T _$identity<T>(T value) => value;
/// @nodoc /// @nodoc
mixin _$Settings { mixin _$Settings {
String get socket; Uri get homeserver; Uri get failureUri; Uri get successUri; String get name; String get adminName; String get adminRoom; String get email; String? get emailAlias; String get mailName; String? get inviteTo; String get mailDomain; String get smtpPasswordFile; String get botPasswordFile; String? get userName; int get outgoingPort; String get socket; Uri get homeserver; Uri get failureUri; Uri get successUri; String get username; String get adminName; String get adminRoom; String get email; String get mailName; String? get inviteTo; String get mailDomain; String get smtpPasswordFile; String get botPasswordFile; String get mailUsername; String get plainText; String get subject; String get markdown;
/// Create a copy of Settings /// Create a copy of Settings
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@ -29,16 +29,16 @@ $SettingsCopyWith<Settings> get copyWith => _$SettingsCopyWithImpl<Settings>(thi
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is Settings&&(identical(other.socket, socket) || other.socket == socket)&&(identical(other.homeserver, homeserver) || other.homeserver == homeserver)&&(identical(other.failureUri, failureUri) || other.failureUri == failureUri)&&(identical(other.successUri, successUri) || other.successUri == successUri)&&(identical(other.name, name) || other.name == name)&&(identical(other.adminName, adminName) || other.adminName == adminName)&&(identical(other.adminRoom, adminRoom) || other.adminRoom == adminRoom)&&(identical(other.email, email) || other.email == email)&&(identical(other.emailAlias, emailAlias) || other.emailAlias == emailAlias)&&(identical(other.mailName, mailName) || other.mailName == mailName)&&(identical(other.inviteTo, inviteTo) || other.inviteTo == inviteTo)&&(identical(other.mailDomain, mailDomain) || other.mailDomain == mailDomain)&&(identical(other.smtpPasswordFile, smtpPasswordFile) || other.smtpPasswordFile == smtpPasswordFile)&&(identical(other.botPasswordFile, botPasswordFile) || other.botPasswordFile == botPasswordFile)&&(identical(other.userName, userName) || other.userName == userName)&&(identical(other.outgoingPort, outgoingPort) || other.outgoingPort == outgoingPort)); return identical(this, other) || (other.runtimeType == runtimeType&&other is Settings&&(identical(other.socket, socket) || other.socket == socket)&&(identical(other.homeserver, homeserver) || other.homeserver == homeserver)&&(identical(other.failureUri, failureUri) || other.failureUri == failureUri)&&(identical(other.successUri, successUri) || other.successUri == successUri)&&(identical(other.username, username) || other.username == username)&&(identical(other.adminName, adminName) || other.adminName == adminName)&&(identical(other.adminRoom, adminRoom) || other.adminRoom == adminRoom)&&(identical(other.email, email) || other.email == email)&&(identical(other.mailName, mailName) || other.mailName == mailName)&&(identical(other.inviteTo, inviteTo) || other.inviteTo == inviteTo)&&(identical(other.mailDomain, mailDomain) || other.mailDomain == mailDomain)&&(identical(other.smtpPasswordFile, smtpPasswordFile) || other.smtpPasswordFile == smtpPasswordFile)&&(identical(other.botPasswordFile, botPasswordFile) || other.botPasswordFile == botPasswordFile)&&(identical(other.mailUsername, mailUsername) || other.mailUsername == mailUsername)&&(identical(other.plainText, plainText) || other.plainText == plainText)&&(identical(other.subject, subject) || other.subject == subject)&&(identical(other.markdown, markdown) || other.markdown == markdown));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash(runtimeType,socket,homeserver,failureUri,successUri,name,adminName,adminRoom,email,emailAlias,mailName,inviteTo,mailDomain,smtpPasswordFile,botPasswordFile,userName,outgoingPort); int get hashCode => Object.hash(runtimeType,socket,homeserver,failureUri,successUri,username,adminName,adminRoom,email,mailName,inviteTo,mailDomain,smtpPasswordFile,botPasswordFile,mailUsername,plainText,subject,markdown);
@override @override
String toString() { String toString() {
return 'Settings(socket: $socket, homeserver: $homeserver, failureUri: $failureUri, successUri: $successUri, name: $name, adminName: $adminName, adminRoom: $adminRoom, email: $email, emailAlias: $emailAlias, mailName: $mailName, inviteTo: $inviteTo, mailDomain: $mailDomain, smtpPasswordFile: $smtpPasswordFile, botPasswordFile: $botPasswordFile, userName: $userName, outgoingPort: $outgoingPort)'; return 'Settings(socket: $socket, homeserver: $homeserver, failureUri: $failureUri, successUri: $successUri, username: $username, adminName: $adminName, adminRoom: $adminRoom, email: $email, mailName: $mailName, inviteTo: $inviteTo, mailDomain: $mailDomain, smtpPasswordFile: $smtpPasswordFile, botPasswordFile: $botPasswordFile, mailUsername: $mailUsername, plainText: $plainText, subject: $subject, markdown: $markdown)';
} }
@ -49,7 +49,7 @@ abstract mixin class $SettingsCopyWith<$Res> {
factory $SettingsCopyWith(Settings value, $Res Function(Settings) _then) = _$SettingsCopyWithImpl; factory $SettingsCopyWith(Settings value, $Res Function(Settings) _then) = _$SettingsCopyWithImpl;
@useResult @useResult
$Res call({ $Res call({
String socket, Uri homeserver, Uri failureUri, Uri successUri, String name, String adminName, String adminRoom, String email, String? emailAlias, String mailName, String? inviteTo, String mailDomain, String smtpPasswordFile, String botPasswordFile, String? userName, int outgoingPort String socket, Uri homeserver, Uri failureUri, Uri successUri, String username, String adminName, String adminRoom, String email, String mailName, String? inviteTo, String mailDomain, String smtpPasswordFile, String botPasswordFile, String mailUsername, String plainText, String subject, String markdown
}); });
@ -66,25 +66,26 @@ class _$SettingsCopyWithImpl<$Res>
/// Create a copy of Settings /// Create a copy of Settings
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? socket = null,Object? homeserver = null,Object? failureUri = null,Object? successUri = null,Object? name = null,Object? adminName = null,Object? adminRoom = null,Object? email = null,Object? emailAlias = freezed,Object? mailName = null,Object? inviteTo = freezed,Object? mailDomain = null,Object? smtpPasswordFile = null,Object? botPasswordFile = null,Object? userName = freezed,Object? outgoingPort = null,}) { @pragma('vm:prefer-inline') @override $Res call({Object? socket = null,Object? homeserver = null,Object? failureUri = null,Object? successUri = null,Object? username = null,Object? adminName = null,Object? adminRoom = null,Object? email = null,Object? mailName = null,Object? inviteTo = freezed,Object? mailDomain = null,Object? smtpPasswordFile = null,Object? botPasswordFile = null,Object? mailUsername = null,Object? plainText = null,Object? subject = null,Object? markdown = null,}) {
return _then(_self.copyWith( return _then(_self.copyWith(
socket: null == socket ? _self.socket : socket // ignore: cast_nullable_to_non_nullable socket: null == socket ? _self.socket : socket // ignore: cast_nullable_to_non_nullable
as String,homeserver: null == homeserver ? _self.homeserver : homeserver // ignore: cast_nullable_to_non_nullable as String,homeserver: null == homeserver ? _self.homeserver : homeserver // ignore: cast_nullable_to_non_nullable
as Uri,failureUri: null == failureUri ? _self.failureUri : failureUri // ignore: cast_nullable_to_non_nullable as Uri,failureUri: null == failureUri ? _self.failureUri : failureUri // ignore: cast_nullable_to_non_nullable
as Uri,successUri: null == successUri ? _self.successUri : successUri // ignore: cast_nullable_to_non_nullable as Uri,successUri: null == successUri ? _self.successUri : successUri // ignore: cast_nullable_to_non_nullable
as Uri,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable as Uri,username: null == username ? _self.username : username // ignore: cast_nullable_to_non_nullable
as String,adminName: null == adminName ? _self.adminName : adminName // ignore: cast_nullable_to_non_nullable as String,adminName: null == adminName ? _self.adminName : adminName // ignore: cast_nullable_to_non_nullable
as String,adminRoom: null == adminRoom ? _self.adminRoom : adminRoom // ignore: cast_nullable_to_non_nullable as String,adminRoom: null == adminRoom ? _self.adminRoom : adminRoom // ignore: cast_nullable_to_non_nullable
as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
as String,emailAlias: freezed == emailAlias ? _self.emailAlias : emailAlias // ignore: cast_nullable_to_non_nullable as String,mailName: null == mailName ? _self.mailName : mailName // ignore: cast_nullable_to_non_nullable
as String?,mailName: null == mailName ? _self.mailName : mailName // ignore: cast_nullable_to_non_nullable
as String,inviteTo: freezed == inviteTo ? _self.inviteTo : inviteTo // ignore: cast_nullable_to_non_nullable as String,inviteTo: freezed == inviteTo ? _self.inviteTo : inviteTo // ignore: cast_nullable_to_non_nullable
as String?,mailDomain: null == mailDomain ? _self.mailDomain : mailDomain // ignore: cast_nullable_to_non_nullable as String?,mailDomain: null == mailDomain ? _self.mailDomain : mailDomain // ignore: cast_nullable_to_non_nullable
as String,smtpPasswordFile: null == smtpPasswordFile ? _self.smtpPasswordFile : smtpPasswordFile // ignore: cast_nullable_to_non_nullable as String,smtpPasswordFile: null == smtpPasswordFile ? _self.smtpPasswordFile : smtpPasswordFile // ignore: cast_nullable_to_non_nullable
as String,botPasswordFile: null == botPasswordFile ? _self.botPasswordFile : botPasswordFile // ignore: cast_nullable_to_non_nullable as String,botPasswordFile: null == botPasswordFile ? _self.botPasswordFile : botPasswordFile // ignore: cast_nullable_to_non_nullable
as String,userName: freezed == userName ? _self.userName : userName // ignore: cast_nullable_to_non_nullable as String,mailUsername: null == mailUsername ? _self.mailUsername : mailUsername // ignore: cast_nullable_to_non_nullable
as String?,outgoingPort: null == outgoingPort ? _self.outgoingPort : outgoingPort // ignore: cast_nullable_to_non_nullable as String,plainText: null == plainText ? _self.plainText : plainText // ignore: cast_nullable_to_non_nullable
as int, as String,subject: null == subject ? _self.subject : subject // ignore: cast_nullable_to_non_nullable
as String,markdown: null == markdown ? _self.markdown : markdown // ignore: cast_nullable_to_non_nullable
as String,
)); ));
} }
@ -95,25 +96,26 @@ as int,
@JsonSerializable() @JsonSerializable()
class _Settings implements Settings { class _Settings implements Settings {
const _Settings({required this.socket, required this.homeserver, required this.failureUri, required this.successUri, required this.name, required this.adminName, required this.adminRoom, required this.email, required this.emailAlias, required this.mailName, required this.inviteTo, required this.mailDomain, required this.smtpPasswordFile, required this.botPasswordFile, this.userName, this.outgoingPort = 465}); const _Settings({required this.socket, required this.homeserver, required this.failureUri, required this.successUri, required this.username, required this.adminName, required this.adminRoom, required this.email, required this.mailName, required this.inviteTo, required this.mailDomain, required this.smtpPasswordFile, required this.botPasswordFile, required this.mailUsername, required this.plainText, required this.subject, required this.markdown});
factory _Settings.fromJson(Map<String, dynamic> json) => _$SettingsFromJson(json); factory _Settings.fromJson(Map<String, dynamic> json) => _$SettingsFromJson(json);
@override final String socket; @override final String socket;
@override final Uri homeserver; @override final Uri homeserver;
@override final Uri failureUri; @override final Uri failureUri;
@override final Uri successUri; @override final Uri successUri;
@override final String name; @override final String username;
@override final String adminName; @override final String adminName;
@override final String adminRoom; @override final String adminRoom;
@override final String email; @override final String email;
@override final String? emailAlias;
@override final String mailName; @override final String mailName;
@override final String? inviteTo; @override final String? inviteTo;
@override final String mailDomain; @override final String mailDomain;
@override final String smtpPasswordFile; @override final String smtpPasswordFile;
@override final String botPasswordFile; @override final String botPasswordFile;
@override final String? userName; @override final String mailUsername;
@override@JsonKey() final int outgoingPort; @override final String plainText;
@override final String subject;
@override final String markdown;
/// Create a copy of Settings /// Create a copy of Settings
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@ -128,16 +130,16 @@ Map<String, dynamic> toJson() {
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Settings&&(identical(other.socket, socket) || other.socket == socket)&&(identical(other.homeserver, homeserver) || other.homeserver == homeserver)&&(identical(other.failureUri, failureUri) || other.failureUri == failureUri)&&(identical(other.successUri, successUri) || other.successUri == successUri)&&(identical(other.name, name) || other.name == name)&&(identical(other.adminName, adminName) || other.adminName == adminName)&&(identical(other.adminRoom, adminRoom) || other.adminRoom == adminRoom)&&(identical(other.email, email) || other.email == email)&&(identical(other.emailAlias, emailAlias) || other.emailAlias == emailAlias)&&(identical(other.mailName, mailName) || other.mailName == mailName)&&(identical(other.inviteTo, inviteTo) || other.inviteTo == inviteTo)&&(identical(other.mailDomain, mailDomain) || other.mailDomain == mailDomain)&&(identical(other.smtpPasswordFile, smtpPasswordFile) || other.smtpPasswordFile == smtpPasswordFile)&&(identical(other.botPasswordFile, botPasswordFile) || other.botPasswordFile == botPasswordFile)&&(identical(other.userName, userName) || other.userName == userName)&&(identical(other.outgoingPort, outgoingPort) || other.outgoingPort == outgoingPort)); return identical(this, other) || (other.runtimeType == runtimeType&&other is _Settings&&(identical(other.socket, socket) || other.socket == socket)&&(identical(other.homeserver, homeserver) || other.homeserver == homeserver)&&(identical(other.failureUri, failureUri) || other.failureUri == failureUri)&&(identical(other.successUri, successUri) || other.successUri == successUri)&&(identical(other.username, username) || other.username == username)&&(identical(other.adminName, adminName) || other.adminName == adminName)&&(identical(other.adminRoom, adminRoom) || other.adminRoom == adminRoom)&&(identical(other.email, email) || other.email == email)&&(identical(other.mailName, mailName) || other.mailName == mailName)&&(identical(other.inviteTo, inviteTo) || other.inviteTo == inviteTo)&&(identical(other.mailDomain, mailDomain) || other.mailDomain == mailDomain)&&(identical(other.smtpPasswordFile, smtpPasswordFile) || other.smtpPasswordFile == smtpPasswordFile)&&(identical(other.botPasswordFile, botPasswordFile) || other.botPasswordFile == botPasswordFile)&&(identical(other.mailUsername, mailUsername) || other.mailUsername == mailUsername)&&(identical(other.plainText, plainText) || other.plainText == plainText)&&(identical(other.subject, subject) || other.subject == subject)&&(identical(other.markdown, markdown) || other.markdown == markdown));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash(runtimeType,socket,homeserver,failureUri,successUri,name,adminName,adminRoom,email,emailAlias,mailName,inviteTo,mailDomain,smtpPasswordFile,botPasswordFile,userName,outgoingPort); int get hashCode => Object.hash(runtimeType,socket,homeserver,failureUri,successUri,username,adminName,adminRoom,email,mailName,inviteTo,mailDomain,smtpPasswordFile,botPasswordFile,mailUsername,plainText,subject,markdown);
@override @override
String toString() { String toString() {
return 'Settings(socket: $socket, homeserver: $homeserver, failureUri: $failureUri, successUri: $successUri, name: $name, adminName: $adminName, adminRoom: $adminRoom, email: $email, emailAlias: $emailAlias, mailName: $mailName, inviteTo: $inviteTo, mailDomain: $mailDomain, smtpPasswordFile: $smtpPasswordFile, botPasswordFile: $botPasswordFile, userName: $userName, outgoingPort: $outgoingPort)'; return 'Settings(socket: $socket, homeserver: $homeserver, failureUri: $failureUri, successUri: $successUri, username: $username, adminName: $adminName, adminRoom: $adminRoom, email: $email, mailName: $mailName, inviteTo: $inviteTo, mailDomain: $mailDomain, smtpPasswordFile: $smtpPasswordFile, botPasswordFile: $botPasswordFile, mailUsername: $mailUsername, plainText: $plainText, subject: $subject, markdown: $markdown)';
} }
@ -148,7 +150,7 @@ abstract mixin class _$SettingsCopyWith<$Res> implements $SettingsCopyWith<$Res>
factory _$SettingsCopyWith(_Settings value, $Res Function(_Settings) _then) = __$SettingsCopyWithImpl; factory _$SettingsCopyWith(_Settings value, $Res Function(_Settings) _then) = __$SettingsCopyWithImpl;
@override @useResult @override @useResult
$Res call({ $Res call({
String socket, Uri homeserver, Uri failureUri, Uri successUri, String name, String adminName, String adminRoom, String email, String? emailAlias, String mailName, String? inviteTo, String mailDomain, String smtpPasswordFile, String botPasswordFile, String? userName, int outgoingPort String socket, Uri homeserver, Uri failureUri, Uri successUri, String username, String adminName, String adminRoom, String email, String mailName, String? inviteTo, String mailDomain, String smtpPasswordFile, String botPasswordFile, String mailUsername, String plainText, String subject, String markdown
}); });
@ -165,25 +167,26 @@ class __$SettingsCopyWithImpl<$Res>
/// Create a copy of Settings /// Create a copy of Settings
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? socket = null,Object? homeserver = null,Object? failureUri = null,Object? successUri = null,Object? name = null,Object? adminName = null,Object? adminRoom = null,Object? email = null,Object? emailAlias = freezed,Object? mailName = null,Object? inviteTo = freezed,Object? mailDomain = null,Object? smtpPasswordFile = null,Object? botPasswordFile = null,Object? userName = freezed,Object? outgoingPort = null,}) { @override @pragma('vm:prefer-inline') $Res call({Object? socket = null,Object? homeserver = null,Object? failureUri = null,Object? successUri = null,Object? username = null,Object? adminName = null,Object? adminRoom = null,Object? email = null,Object? mailName = null,Object? inviteTo = freezed,Object? mailDomain = null,Object? smtpPasswordFile = null,Object? botPasswordFile = null,Object? mailUsername = null,Object? plainText = null,Object? subject = null,Object? markdown = null,}) {
return _then(_Settings( return _then(_Settings(
socket: null == socket ? _self.socket : socket // ignore: cast_nullable_to_non_nullable socket: null == socket ? _self.socket : socket // ignore: cast_nullable_to_non_nullable
as String,homeserver: null == homeserver ? _self.homeserver : homeserver // ignore: cast_nullable_to_non_nullable as String,homeserver: null == homeserver ? _self.homeserver : homeserver // ignore: cast_nullable_to_non_nullable
as Uri,failureUri: null == failureUri ? _self.failureUri : failureUri // ignore: cast_nullable_to_non_nullable as Uri,failureUri: null == failureUri ? _self.failureUri : failureUri // ignore: cast_nullable_to_non_nullable
as Uri,successUri: null == successUri ? _self.successUri : successUri // ignore: cast_nullable_to_non_nullable as Uri,successUri: null == successUri ? _self.successUri : successUri // ignore: cast_nullable_to_non_nullable
as Uri,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable as Uri,username: null == username ? _self.username : username // ignore: cast_nullable_to_non_nullable
as String,adminName: null == adminName ? _self.adminName : adminName // ignore: cast_nullable_to_non_nullable as String,adminName: null == adminName ? _self.adminName : adminName // ignore: cast_nullable_to_non_nullable
as String,adminRoom: null == adminRoom ? _self.adminRoom : adminRoom // ignore: cast_nullable_to_non_nullable as String,adminRoom: null == adminRoom ? _self.adminRoom : adminRoom // ignore: cast_nullable_to_non_nullable
as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
as String,emailAlias: freezed == emailAlias ? _self.emailAlias : emailAlias // ignore: cast_nullable_to_non_nullable as String,mailName: null == mailName ? _self.mailName : mailName // ignore: cast_nullable_to_non_nullable
as String?,mailName: null == mailName ? _self.mailName : mailName // ignore: cast_nullable_to_non_nullable
as String,inviteTo: freezed == inviteTo ? _self.inviteTo : inviteTo // ignore: cast_nullable_to_non_nullable as String,inviteTo: freezed == inviteTo ? _self.inviteTo : inviteTo // ignore: cast_nullable_to_non_nullable
as String?,mailDomain: null == mailDomain ? _self.mailDomain : mailDomain // ignore: cast_nullable_to_non_nullable as String?,mailDomain: null == mailDomain ? _self.mailDomain : mailDomain // ignore: cast_nullable_to_non_nullable
as String,smtpPasswordFile: null == smtpPasswordFile ? _self.smtpPasswordFile : smtpPasswordFile // ignore: cast_nullable_to_non_nullable as String,smtpPasswordFile: null == smtpPasswordFile ? _self.smtpPasswordFile : smtpPasswordFile // ignore: cast_nullable_to_non_nullable
as String,botPasswordFile: null == botPasswordFile ? _self.botPasswordFile : botPasswordFile // ignore: cast_nullable_to_non_nullable as String,botPasswordFile: null == botPasswordFile ? _self.botPasswordFile : botPasswordFile // ignore: cast_nullable_to_non_nullable
as String,userName: freezed == userName ? _self.userName : userName // ignore: cast_nullable_to_non_nullable as String,mailUsername: null == mailUsername ? _self.mailUsername : mailUsername // ignore: cast_nullable_to_non_nullable
as String?,outgoingPort: null == outgoingPort ? _self.outgoingPort : outgoingPort // ignore: cast_nullable_to_non_nullable as String,plainText: null == plainText ? _self.plainText : plainText // ignore: cast_nullable_to_non_nullable
as int, as String,subject: null == subject ? _self.subject : subject // ignore: cast_nullable_to_non_nullable
as String,markdown: null == markdown ? _self.markdown : markdown // ignore: cast_nullable_to_non_nullable
as String,
)); ));
} }

View file

@ -11,18 +11,19 @@ _Settings _$SettingsFromJson(Map<String, dynamic> json) => _Settings(
homeserver: Uri.parse(json['homeserver'] as String), homeserver: Uri.parse(json['homeserver'] as String),
failureUri: Uri.parse(json['failureUri'] as String), failureUri: Uri.parse(json['failureUri'] as String),
successUri: Uri.parse(json['successUri'] as String), successUri: Uri.parse(json['successUri'] as String),
name: json['name'] as String, username: json['username'] as String,
adminName: json['adminName'] as String, adminName: json['adminName'] as String,
adminRoom: json['adminRoom'] as String, adminRoom: json['adminRoom'] as String,
email: json['email'] as String, email: json['email'] as String,
emailAlias: json['emailAlias'] as String?,
mailName: json['mailName'] as String, mailName: json['mailName'] as String,
inviteTo: json['inviteTo'] as String?, inviteTo: json['inviteTo'] as String?,
mailDomain: json['mailDomain'] as String, mailDomain: json['mailDomain'] as String,
smtpPasswordFile: json['smtpPasswordFile'] as String, smtpPasswordFile: json['smtpPasswordFile'] as String,
botPasswordFile: json['botPasswordFile'] as String, botPasswordFile: json['botPasswordFile'] as String,
userName: json['userName'] as String?, mailUsername: json['mailUsername'] as String,
outgoingPort: (json['outgoingPort'] as num?)?.toInt() ?? 465, plainText: json['plainText'] as String,
subject: json['subject'] as String,
markdown: json['markdown'] as String,
); );
Map<String, dynamic> _$SettingsToJson(_Settings instance) => <String, dynamic>{ Map<String, dynamic> _$SettingsToJson(_Settings instance) => <String, dynamic>{
@ -30,16 +31,17 @@ Map<String, dynamic> _$SettingsToJson(_Settings instance) => <String, dynamic>{
'homeserver': instance.homeserver.toString(), 'homeserver': instance.homeserver.toString(),
'failureUri': instance.failureUri.toString(), 'failureUri': instance.failureUri.toString(),
'successUri': instance.successUri.toString(), 'successUri': instance.successUri.toString(),
'name': instance.name, 'username': instance.username,
'adminName': instance.adminName, 'adminName': instance.adminName,
'adminRoom': instance.adminRoom, 'adminRoom': instance.adminRoom,
'email': instance.email, 'email': instance.email,
'emailAlias': instance.emailAlias,
'mailName': instance.mailName, 'mailName': instance.mailName,
'inviteTo': instance.inviteTo, 'inviteTo': instance.inviteTo,
'mailDomain': instance.mailDomain, 'mailDomain': instance.mailDomain,
'smtpPasswordFile': instance.smtpPasswordFile, 'smtpPasswordFile': instance.smtpPasswordFile,
'botPasswordFile': instance.botPasswordFile, 'botPasswordFile': instance.botPasswordFile,
'userName': instance.userName, 'mailUsername': instance.mailUsername,
'outgoingPort': instance.outgoingPort, 'plainText': instance.plainText,
'subject': instance.subject,
'markdown': instance.markdown,
}; };

View file

@ -33,14 +33,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.7.0" version: "2.7.0"
asn1lib:
dependency: transitive
description:
name: asn1lib
sha256: "9a8f69025044eb466b9b60ef3bc3ac99b4dc6c158ae9c56d25eeccf5bc56d024"
url: "https://pub.dev"
source: hosted
version: "1.6.5"
async: async:
dependency: transitive dependency: transitive
description: description:
@ -57,14 +49,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
basic_utils:
dependency: transitive
description:
name: basic_utils
sha256: "2064b21d3c41ed7654bc82cc476fd65542e04d60059b74d5eed490a4da08fc6c"
url: "https://pub.dev"
source: hosted
version: "5.7.0"
blurhash_dart: blurhash_dart:
dependency: transitive dependency: transitive
description: description:
@ -157,10 +141,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: canonical_json name: canonical_json
sha256: d6be1dd66b420c6ac9f42e3693e09edf4ff6edfee26cb4c28c1c019fdb8c0c15 sha256: "618db0b1ea4238a3ef2f325908beee6269550d73b69dc5220456b75ce3cec072"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.2" version: "1.1.3"
checked_yaml: checked_yaml:
dependency: transitive dependency: transitive
description: description:
@ -265,14 +249,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.1.0" version: "3.1.0"
encrypt:
dependency: transitive
description:
name: encrypt
sha256: "62d9aa4670cc2a8798bab89b39fc71b6dfbacf615de6cf5001fb39f7e4a996a2"
url: "https://pub.dev"
source: hosted
version: "5.0.3"
enhanced_enum: enhanced_enum:
dependency: transitive dependency: transitive
description: description:
@ -281,30 +257,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.2.4" version: "0.2.4"
enough_convert:
dependency: transitive
description:
name: enough_convert
sha256: c67d85ca21aaa0648f155907362430701db41f7ec8e6501a58ad9cd9d8569d01
url: "https://pub.dev"
source: hosted
version: "1.6.0"
enough_mail:
dependency: "direct main"
description:
name: enough_mail
sha256: a88d8c56907caeffdebc4cf34f3a5665c09a8d7496ef5e09b3166f41cf409f81
url: "https://pub.dev"
source: hosted
version: "2.1.6"
event_bus:
dependency: transitive
description:
name: event_bus
sha256: "1a55e97923769c286d295240048fc180e7b0768902c3c2e869fe059aafa15304"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
fast_immutable_collections: fast_immutable_collections:
dependency: "direct main" dependency: "direct main"
description: description:
@ -445,10 +397,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: intl name: intl
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.19.0" version: "0.20.2"
io: io:
dependency: transitive dependency: transitive
description: description:
@ -497,6 +449,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.0" version: "1.3.0"
mailer:
dependency: "direct main"
description:
name: mailer
sha256: "7b8691b080809ea1b2fa2f1b0d49c7c089fb328bd23e68aa5818b9cf5f4b420d"
url: "https://pub.dev"
source: hosted
version: "7.1.0"
markdown: markdown:
dependency: "direct main" dependency: "direct main"
description: description:
@ -569,14 +529,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "7.0.0" version: "7.0.0"
pointycastle:
dependency: transitive
description:
name: pointycastle
sha256: "4be0097fcf3fd3e8449e53730c631200ebc7b88016acecab2b0da2f0149222fe"
url: "https://pub.dev"
source: hosted
version: "3.9.1"
pool: pool:
dependency: transitive dependency: transitive
description: description:
@ -617,6 +569,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.5.0" version: "1.5.0"
punycoder:
dependency: transitive
description:
name: punycoder
sha256: aed79c05986a18782caa9bad649a4a786e840e1baaf6a2e1aa3a25d143d28e6e
url: "https://pub.dev"
source: hosted
version: "0.2.2"
random_string: random_string:
dependency: transitive dependency: transitive
description: description:
@ -853,10 +813,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: unorm_dart name: unorm_dart
sha256: "5b35bff83fce4d76467641438f9e867dc9bcfdb8c1694854f230579d68cd8f4b" sha256: "0c69186b03ca6addab0774bcc0f4f17b88d4ce78d9d4d8f0619e30a99ead58e7"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.2.0" version: "0.3.2"
vm_service: vm_service:
dependency: transitive dependency: transitive
description: description:

View file

@ -18,11 +18,11 @@ dependencies:
fast_immutable_collections: ^11.0.4 fast_immutable_collections: ^11.0.4
cli_tools: ^0.6.0 cli_tools: ^0.6.0
args: ^2.7.0 args: ^2.7.0
enough_mail: ^2.1.6
markdown: ^7.3.0 markdown: ^7.3.0
matrix: ^1.1.0 matrix: ^1.1.0
sqflite_common_ffi: ^2.3.6 sqflite_common_ffi: ^2.3.6
collection: ^1.19.1 collection: ^1.19.1
mailer: ^7.1.0
dev_dependencies: dev_dependencies:
build_runner: ^2.4.6 build_runner: ^2.4.6