add more settings

This commit is contained in:
Henry Hiles 2026-02-28 17:27:31 -05:00
commit c1ebcfcd61
No known key found for this signature in database
5 changed files with 31 additions and 15 deletions

View file

@ -24,11 +24,13 @@ void main(List<String> argsRaw) async {
..addOption("adminName", mandatory: true)
..addOption("adminRoom", mandatory: true)
..addOption("email", mandatory: true)
..addOption("emailAlias", mandatory: false)
..addOption("mailName", mandatory: true)
..addOption("mailDomain", mandatory: true)
..addOption("smtpPasswordFile", mandatory: true)
..addOption("botPasswordFile", mandatory: true)
..addOption("emailAlias")
..addOption("userName")
..addOption("outgoingPort")
..addOption("inviteTo");
final container = ProviderContainer();

View file

@ -10,6 +10,8 @@ class MailClientController extends AutoDisposeAsyncNotifier<MailClient> {
final settings = ref.watch(SettingsController.provider)!;
final account = MailAccount.fromManualSettings(
email: settings.email,
userName: settings.userName ?? "",
outgoingPort: settings.outgoingPort,
name: settings.mailName,
incomingHost: settings.mailDomain,
outgoingHost: settings.mailDomain,

View file

@ -20,6 +20,8 @@ abstract class Settings with _$Settings {
required String mailDomain,
required String smtpPasswordFile,
required String botPasswordFile,
String? userName,
@Default(465) int outgoingPort,
}) = _Settings;
factory Settings.fromJson(Map<String, dynamic> json) =>

View file

@ -16,7 +16,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
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 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;
/// Create a copy of Settings
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@ -29,16 +29,16 @@ $SettingsCopyWith<Settings> get copyWith => _$SettingsCopyWithImpl<Settings>(thi
@override
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));
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));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,socket,homeserver,failureUri,successUri,name,adminName,adminRoom,email,emailAlias,mailName,inviteTo,mailDomain,smtpPasswordFile,botPasswordFile);
int get hashCode => Object.hash(runtimeType,socket,homeserver,failureUri,successUri,name,adminName,adminRoom,email,emailAlias,mailName,inviteTo,mailDomain,smtpPasswordFile,botPasswordFile,userName,outgoingPort);
@override
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)';
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)';
}
@ -49,7 +49,7 @@ abstract mixin class $SettingsCopyWith<$Res> {
factory $SettingsCopyWith(Settings value, $Res Function(Settings) _then) = _$SettingsCopyWithImpl;
@useResult
$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 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
});
@ -66,7 +66,7 @@ class _$SettingsCopyWithImpl<$Res>
/// Create a copy of Settings
/// 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,}) {
@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,}) {
return _then(_self.copyWith(
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
@ -82,7 +82,9 @@ as String,inviteTo: freezed == inviteTo ? _self.inviteTo : inviteTo // ignore: c
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,botPasswordFile: null == botPasswordFile ? _self.botPasswordFile : botPasswordFile // ignore: cast_nullable_to_non_nullable
as String,
as String,userName: freezed == userName ? _self.userName : userName // ignore: cast_nullable_to_non_nullable
as String?,outgoingPort: null == outgoingPort ? _self.outgoingPort : outgoingPort // ignore: cast_nullable_to_non_nullable
as int,
));
}
@ -93,7 +95,7 @@ as String,
@JsonSerializable()
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});
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});
factory _Settings.fromJson(Map<String, dynamic> json) => _$SettingsFromJson(json);
@override final String socket;
@ -110,6 +112,8 @@ class _Settings implements Settings {
@override final String mailDomain;
@override final String smtpPasswordFile;
@override final String botPasswordFile;
@override final String? userName;
@override@JsonKey() final int outgoingPort;
/// Create a copy of Settings
/// with the given fields replaced by the non-null parameter values.
@ -124,16 +128,16 @@ Map<String, dynamic> toJson() {
@override
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));
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));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,socket,homeserver,failureUri,successUri,name,adminName,adminRoom,email,emailAlias,mailName,inviteTo,mailDomain,smtpPasswordFile,botPasswordFile);
int get hashCode => Object.hash(runtimeType,socket,homeserver,failureUri,successUri,name,adminName,adminRoom,email,emailAlias,mailName,inviteTo,mailDomain,smtpPasswordFile,botPasswordFile,userName,outgoingPort);
@override
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)';
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)';
}
@ -144,7 +148,7 @@ abstract mixin class _$SettingsCopyWith<$Res> implements $SettingsCopyWith<$Res>
factory _$SettingsCopyWith(_Settings value, $Res Function(_Settings) _then) = __$SettingsCopyWithImpl;
@override @useResult
$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 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
});
@ -161,7 +165,7 @@ class __$SettingsCopyWithImpl<$Res>
/// Create a copy of Settings
/// 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,}) {
@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,}) {
return _then(_Settings(
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
@ -177,7 +181,9 @@ as String,inviteTo: freezed == inviteTo ? _self.inviteTo : inviteTo // ignore: c
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,botPasswordFile: null == botPasswordFile ? _self.botPasswordFile : botPasswordFile // ignore: cast_nullable_to_non_nullable
as String,
as String,userName: freezed == userName ? _self.userName : userName // ignore: cast_nullable_to_non_nullable
as String?,outgoingPort: null == outgoingPort ? _self.outgoingPort : outgoingPort // ignore: cast_nullable_to_non_nullable
as int,
));
}

View file

@ -21,6 +21,8 @@ _Settings _$SettingsFromJson(Map<String, dynamic> json) => _Settings(
mailDomain: json['mailDomain'] as String,
smtpPasswordFile: json['smtpPasswordFile'] as String,
botPasswordFile: json['botPasswordFile'] as String,
userName: json['userName'] as String?,
outgoingPort: (json['outgoingPort'] as num?)?.toInt() ?? 465,
);
Map<String, dynamic> _$SettingsToJson(_Settings instance) => <String, dynamic>{
@ -38,4 +40,6 @@ Map<String, dynamic> _$SettingsToJson(_Settings instance) => <String, dynamic>{
'mailDomain': instance.mailDomain,
'smtpPasswordFile': instance.smtpPasswordFile,
'botPasswordFile': instance.botPasswordFile,
'userName': instance.userName,
'outgoingPort': instance.outgoingPort,
};