From bf3ff44e32269fad1fa51181a2dd2a0c85ec3ee8 Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Mon, 24 Mar 2025 14:43:00 +0100 Subject: [PATCH] Collapsed into single option --- .../Library/Modules/Builtin/SendHttpMessage.cs | 7 +------ .../Modules/Builtin/SendJabberMessage.cs | 6 +++--- Duplicati/Library/Modules/Builtin/SendMail.cs | 6 +++--- .../Modules/Builtin/SendTelegramMessage.cs | 6 +++--- Duplicati/Library/Modules/Builtin/Strings.cs | 18 ++++++++---------- 5 files changed, 18 insertions(+), 25 deletions(-) diff --git a/Duplicati/Library/Modules/Builtin/SendHttpMessage.cs b/Duplicati/Library/Modules/Builtin/SendHttpMessage.cs index 9e83ed4b2..1f16ac323 100644 --- a/Duplicati/Library/Modules/Builtin/SendHttpMessage.cs +++ b/Duplicati/Library/Modules/Builtin/SendHttpMessage.cs @@ -81,10 +81,6 @@ namespace Duplicati.Library.Modules.Builtin /// private const string OPTION_EXTRA_PARAMETERS = "send-http-extra-parameters"; /// - /// Option used to specify extra parameters - /// - private const string OPTION_EXTRA_DATA_PARAMETERS = "send-http-extra-data-parameters"; - /// /// Option used to specify report level /// private const string OPTION_SENDLEVEL = "send-http-level"; @@ -221,7 +217,6 @@ namespace Duplicati.Library.Modules.Builtin new CommandLineArgument(OPTION_MESSAGE, CommandLineArgument.ArgumentType.String, Strings.SendHttpMessage.SendhttpmessageShort, Strings.SendHttpMessage.SendhttpmessageLong, DEFAULT_BODY), new CommandLineArgument(OPTION_MESSAGE_PARAMETER_NAME, CommandLineArgument.ArgumentType.String, Strings.SendHttpMessage.SendhttpmessageparameternameShort, Strings.SendHttpMessage.SendhttpmessageparameternameLong, DEFAULT_MESSAGE_PARAMETER_NAME), new CommandLineArgument(OPTION_EXTRA_PARAMETERS, CommandLineArgument.ArgumentType.String, Strings.SendHttpMessage.SendhttpextraparametersShort, Strings.SendHttpMessage.SendhttpextraparametersLong), - new CommandLineArgument(OPTION_EXTRA_DATA_PARAMETERS, CommandLineArgument.ArgumentType.String, Strings.SendHttpMessage.SendhttpextradataparametersShort, Strings.SendHttpMessage.SendhttpextradataparametersLong), new CommandLineArgument(OPTION_SENDLEVEL, CommandLineArgument.ArgumentType.String, Strings.SendHttpMessage.SendhttplevelShort, Strings.SendHttpMessage.SendhttplevelLong(ParsedResultType.Success.ToString(), ParsedResultType.Warning.ToString(), ParsedResultType.Error.ToString(), ParsedResultType.Fatal.ToString(), "All"), DEFAULT_LEVEL, null, Enum.GetNames(typeof(ParsedResultType)).Union(new string[] { "All" } ).ToArray()), new CommandLineArgument(OPTION_SENDALL, CommandLineArgument.ArgumentType.Boolean, Strings.SendHttpMessage.SendhttpanyoperationShort, Strings.SendHttpMessage.SendhttpanyoperationLong), @@ -250,7 +245,7 @@ namespace Duplicati.Library.Modules.Builtin protected override string LogFilterOptionName => OPTION_LOG_FILTER; protected override string LogLinesOptionName => OPTION_MAX_LOG_LINES; protected override string ResultFormatOptionName => OPTION_RESULT_FORMAT; - protected override string ExtraDataOptionName => OPTION_EXTRA_DATA_PARAMETERS; + protected override string ExtraDataOptionName => OPTION_EXTRA_PARAMETERS; /// /// This method is the interception where the module can interact with the execution environment and modify the settings. diff --git a/Duplicati/Library/Modules/Builtin/SendJabberMessage.cs b/Duplicati/Library/Modules/Builtin/SendJabberMessage.cs index 049e09a39..c740bd613 100644 --- a/Duplicati/Library/Modules/Builtin/SendJabberMessage.cs +++ b/Duplicati/Library/Modules/Builtin/SendJabberMessage.cs @@ -53,7 +53,7 @@ namespace Duplicati.Library.Modules.Builtin /// /// Option used to specify extra parameters /// - private const string OPTION_EXTRA_DATA_PARAMETERS = "send-xmpp-extra-data-parameters"; + private const string OPTION_EXTRA_PARAMETERS = "send-xmpp-extra-parameters"; /// /// Option used to specify report level @@ -142,7 +142,7 @@ namespace Duplicati.Library.Modules.Builtin [ new CommandLineArgument(OPTION_RECIPIENT, CommandLineArgument.ArgumentType.String, Strings.SendJabberMessage.SendxmpptoShort, Strings.SendJabberMessage.SendxmpptoLong), new CommandLineArgument(OPTION_MESSAGE, CommandLineArgument.ArgumentType.String, Strings.SendJabberMessage.SendxmppmessageShort, Strings.SendJabberMessage.SendxmppmessageLong, DEFAULT_BODY), - new CommandLineArgument(OPTION_EXTRA_DATA_PARAMETERS, CommandLineArgument.ArgumentType.String, Strings.SendJabberMessage.SendxmppextradataparametersShort, Strings.SendJabberMessage.SendxmppextradataparametersLong), + new CommandLineArgument(OPTION_EXTRA_PARAMETERS, CommandLineArgument.ArgumentType.String, Strings.SendJabberMessage.SendxmppextraparametersShort, Strings.SendJabberMessage.SendxmppextraparametersLong), new CommandLineArgument(OPTION_USERNAME, CommandLineArgument.ArgumentType.String, Strings.SendJabberMessage.SendxmppusernameShort, Strings.SendJabberMessage.SendxmppusernameLong), new CommandLineArgument(OPTION_PASSWORD, CommandLineArgument.ArgumentType.String, Strings.SendJabberMessage.SendxmpppasswordShort, Strings.SendJabberMessage.SendxmpppasswordLong), new CommandLineArgument(OPTION_SENDLEVEL, CommandLineArgument.ArgumentType.String, Strings.SendJabberMessage.SendxmpplevelShort, Strings.SendJabberMessage.SendxmpplevelLong(ParsedResultType.Success.ToString(), ParsedResultType.Warning.ToString(), ParsedResultType.Error.ToString(), ParsedResultType.Fatal.ToString(), "All"), DEFAULT_LEVEL, null, Enum.GetNames(typeof(ParsedResultType)).Union(new string[] { "All" } ).ToArray()), @@ -164,7 +164,7 @@ namespace Duplicati.Library.Modules.Builtin protected override string LogFilterOptionName => OPTION_LOG_FILTER; protected override string LogLinesOptionName => OPTION_MAX_LOG_LINES; protected override string ResultFormatOptionName => OPTION_RESULT_FORMAT; - protected override string ExtraDataOptionName => OPTION_EXTRA_DATA_PARAMETERS; + protected override string ExtraDataOptionName => OPTION_EXTRA_PARAMETERS; /// /// This method is the interception where the module can interact with the execution environment and modify the settings. diff --git a/Duplicati/Library/Modules/Builtin/SendMail.cs b/Duplicati/Library/Modules/Builtin/SendMail.cs index fe23dc6f9..d33b7964b 100644 --- a/Duplicati/Library/Modules/Builtin/SendMail.cs +++ b/Duplicati/Library/Modules/Builtin/SendMail.cs @@ -82,7 +82,7 @@ namespace Duplicati.Library.Modules.Builtin /// /// Option used to specify extra parameters /// - private const string OPTION_EXTRA_DATA_PARAMETERS = "send-mail-extra-data-parameters"; + private const string OPTION_EXTRA_PARAMETERS = "send-mail-extra-parameters"; /// /// Option used to set the log level for mail reports @@ -166,7 +166,7 @@ namespace Duplicati.Library.Modules.Builtin new CommandLineArgument(OPTION_PASSWORD, CommandLineArgument.ArgumentType.String, Strings.SendMail.OptionPasswordShort, Strings.SendMail.OptionPasswordLong), new CommandLineArgument(OPTION_SENDLEVEL, CommandLineArgument.ArgumentType.String, Strings.SendMail.OptionSendlevelShort, Strings.SendMail.OptionSendlevelLong(ParsedResultType.Success.ToString(), ParsedResultType.Warning.ToString(), ParsedResultType.Error.ToString(), ParsedResultType.Fatal.ToString(), "All"), DEFAULT_LEVEL, null, Enum.GetNames(typeof(ParsedResultType)).Union(new string [] { "All" }).ToArray()), new CommandLineArgument(OPTION_SENDALL, CommandLineArgument.ArgumentType.Boolean, Strings.SendHttpMessage.SendhttpanyoperationShort, Strings.SendHttpMessage.SendhttpanyoperationLong), - new CommandLineArgument(OPTION_EXTRA_DATA_PARAMETERS, CommandLineArgument.ArgumentType.String, Strings.SendMail.SendmailextradataparametersShort, Strings.SendMail.SendmailextradataparametersLong), + new CommandLineArgument(OPTION_EXTRA_PARAMETERS, CommandLineArgument.ArgumentType.String, Strings.SendMail.SendmailextraparametersShort, Strings.SendMail.SendmailextraparametersLong), new CommandLineArgument(OPTION_LOG_LEVEL, CommandLineArgument.ArgumentType.Enumeration, Strings.ReportHelper.OptionLoglevelShort, Strings.ReportHelper.OptionLoglevelLong, DEFAULT_LOG_LEVEL.ToString(), null, Enum.GetNames(typeof(Logging.LogMessageType))), new CommandLineArgument(OPTION_LOG_FILTER, CommandLineArgument.ArgumentType.String, Strings.ReportHelper.OptionLogfilterShort, Strings.ReportHelper.OptionLogfilterLong), @@ -183,7 +183,7 @@ namespace Duplicati.Library.Modules.Builtin protected override string LogFilterOptionName => OPTION_LOG_FILTER; protected override string LogLinesOptionName => OPTION_MAX_LOG_LINES; protected override string ResultFormatOptionName => OPTION_RESULT_FORMAT; - protected override string ExtraDataOptionName => OPTION_EXTRA_DATA_PARAMETERS; + protected override string ExtraDataOptionName => OPTION_EXTRA_PARAMETERS; /// /// This method is the interception where the module can interact with the execution environment and modify the settings. diff --git a/Duplicati/Library/Modules/Builtin/SendTelegramMessage.cs b/Duplicati/Library/Modules/Builtin/SendTelegramMessage.cs index 0a2ab52e2..5f7323f5c 100644 --- a/Duplicati/Library/Modules/Builtin/SendTelegramMessage.cs +++ b/Duplicati/Library/Modules/Builtin/SendTelegramMessage.cs @@ -78,7 +78,7 @@ public class SendTelegramMessage : ReportHelper /// /// Option used to specify extra parameters /// - private const string OPTION_EXTRA_DATA_PARAMETERS = "send-telegram-extra-data-parameters"; + private const string OPTION_EXTRA_PARAMETERS = "send-telegram-extra-parameters"; /// /// Option used to set the log level @@ -143,7 +143,7 @@ public class SendTelegramMessage : ReportHelper [ new CommandLineArgument(OPTION_CHANNEL, CommandLineArgument.ArgumentType.String, Strings.SendTelegramMessage.SendTelegramChannelShort, Strings.SendTelegramMessage.SendTelegramChannelLong), new CommandLineArgument(OPTION_MESSAGE, CommandLineArgument.ArgumentType.String, Strings.SendTelegramMessage.SendTelegramMessageShort, Strings.SendTelegramMessage.SendTelegramMessageLong, DEFAULT_BODY), - new CommandLineArgument(OPTION_EXTRA_DATA_PARAMETERS, CommandLineArgument.ArgumentType.String, Strings.SendTelegramMessage.SendTelegramExtraDataParametersShort, Strings.SendTelegramMessage.SendTelegramExtraDataParametersLong), + new CommandLineArgument(OPTION_EXTRA_PARAMETERS, CommandLineArgument.ArgumentType.String, Strings.SendTelegramMessage.SendTelegramExtraParametersShort, Strings.SendTelegramMessage.SendTelegramExtraParametersLong), new CommandLineArgument(OPTION_BOTID, CommandLineArgument.ArgumentType.String, Strings.SendTelegramMessage.SendTelegramBotIdShort, Strings.SendTelegramMessage.SendTelegramBotIdLong), new CommandLineArgument(OPTION_APIKEY, CommandLineArgument.ArgumentType.String, Strings.SendTelegramMessage.SendTelegramApiKeyShort, Strings.SendTelegramMessage.SendTelegramApiKeyLong), new CommandLineArgument(OPTION_SENDLEVEL, CommandLineArgument.ArgumentType.String, Strings.SendTelegramMessage.SendTelegramLevelShort, Strings.SendTelegramMessage.SendTelegramlevelLong(ParsedResultType.Success.ToString(), ParsedResultType.Warning.ToString(), ParsedResultType.Error.ToString(), ParsedResultType.Fatal.ToString(), "All"), DEFAULT_LEVEL, null, Enum.GetNames(typeof(ParsedResultType)).Union(new string[] { "All" } ).ToArray()), @@ -163,7 +163,7 @@ public class SendTelegramMessage : ReportHelper protected override string LogFilterOptionName => OPTION_LOG_FILTER; protected override string LogLinesOptionName => OPTION_MAX_LOG_LINES; protected override string ResultFormatOptionName => OPTION_RESULT_FORMAT; - protected override string ExtraDataOptionName => OPTION_EXTRA_DATA_PARAMETERS; + protected override string ExtraDataOptionName => OPTION_EXTRA_PARAMETERS; /// /// The server username diff --git a/Duplicati/Library/Modules/Builtin/Strings.cs b/Duplicati/Library/Modules/Builtin/Strings.cs index fbccba239..eec8f6f92 100644 --- a/Duplicati/Library/Modules/Builtin/Strings.cs +++ b/Duplicati/Library/Modules/Builtin/Strings.cs @@ -136,8 +136,8 @@ To enable SMTP over SSL, use the format smtps://example.com. To enable SMTP STAR public static string SendMailLog(string message) { return LC.L(@"Whole SMTP communication: {0}", message); } public static string SendMailFailedRetryError(string failedserver, string message, string retryserver) { return LC.L(@"Failed to send email with server: {0}, message: {1}, retrying with {2}", failedserver, message, retryserver); } public static string SendMailSuccess(string server) { return LC.L(@"Email sent successfully using server: {0}", server); } - public static string SendmailextradataparametersLong { get { return LC.L(@"Use this option to set extra parameters for the message body. This parameter can either be a querystring (e.g. ""parameter1=value1¶meter2=value2"") or a JSON key/value object (e.g. ""{\""parameter1\"": \""value1\"", \""parameter2\"": \""value2\""}"")."); } } - public static string SendmailextradataparametersShort { get { return LC.L(@"Extra parameters for the message sent"); } } + public static string SendmailextraparametersLong { get { return LC.L(@"Use this option to set extra parameters for the message body. This parameter can either be a querystring (e.g. ""parameter1=value1¶meter2=value2"") or a JSON key/value object (e.g. ""{\""parameter1\"": \""value1\"", \""parameter2\"": \""value2\""}"")."); } } + public static string SendmailextraparametersShort { get { return LC.L(@"Extra parameters for the message sent"); } } } internal static class SendJabberMessage { @@ -165,8 +165,8 @@ You can supply multiple options with a comma separator, e.g. ""{0},{1}"". The sp public static string SendxmppanyoperationLong { get { return LC.L(@"By default, messages will only be sent after a backup operation. Use this option to send messages for all operations."); } } public static string SendxmppanyoperationShort { get { return LC.L(@"Send messages for all operations"); } } public static string LoginTimeoutError { get { return LC.L(@"Timeout occurred while logging in to jabber server"); } } - public static string SendxmppextradataparametersLong { get { return LC.L(@"Use this option to set extra parameters for the message body. This parameter can either be a querystring (e.g. ""parameter1=value1¶meter2=value2"") or a JSON key/value object (e.g. ""{\""parameter1\"": \""value1\"", \""parameter2\"": \""value2\""}"")."); } } - public static string SendxmppextradataparametersShort { get { return LC.L(@"Extra parameters for the message sent"); } } + public static string SendxmppextraparametersLong { get { return LC.L(@"Use this option to set extra parameters for the message body. This parameter can either be a querystring (e.g. ""parameter1=value1¶meter2=value2"") or a JSON key/value object (e.g. ""{\""parameter1\"": \""value1\"", \""parameter2\"": \""value2\""}"")."); } } + public static string SendxmppextraparametersShort { get { return LC.L(@"Extra parameters for the message sent"); } } } internal static class SendTelegramMessage @@ -198,8 +198,8 @@ You can supply multiple options with a comma separator, e.g. ""{0},{1}"". The sp public static string SendTelegramLevelShort => LC.L(@"The messages to send"); public static string SendTelegramManyOperationLong => LC.L(@"By default, messages will only be sent after a backup operation. Use this option to send messages for all operations."); public static string SendTelegramManyOperationShort => LC.L(@"Send messages for all operations"); - public static string SendTelegramExtraDataParametersLong { get { return LC.L(@"Use this option to set extra parameters for the message body. This parameter can either be a querystring (e.g. ""parameter1=value1¶meter2=value2"") or a JSON key/value object (e.g. ""{\""parameter1\"": \""value1\"", \""parameter2\"": \""value2\""}"")."); } } - public static string SendTelegramExtraDataParametersShort { get { return LC.L(@"Extra parameters for the message sent"); } } + public static string SendTelegramExtraParametersLong { get { return LC.L(@"Use this option to set extra parameters for the message body. This parameter can either be a querystring (e.g. ""parameter1=value1¶meter2=value2"") or a JSON key/value object (e.g. ""{\""parameter1\"": \""value1\"", \""parameter2\"": \""value2\""}"")."); } } + public static string SendTelegramExtraParametersShort { get { return LC.L(@"Extra parameters for the message sent"); } } } internal static class SendHttpMessage @@ -220,10 +220,8 @@ All command line options are also reported within %value%, e.g. %volsize%. Any u public static string SendhttpmessageShort { get { return LC.L(@"The message template"); } } public static string SendhttpmessageparameternameLong { get { return LC.L(@"Use this option to set a name of the parameter to send the message as."); } } public static string SendhttpmessageparameternameShort { get { return LC.L(@"The name of the parameter to send the message as"); } } - public static string SendhttpextraparametersLong { get { return LC.L(@"Use this option to set extra parameters to add to the http message, e.g. ""parameter1=value1¶meter2=value2"""); } } - public static string SendhttpextraparametersShort { get { return LC.L(@"Extra parameters to add to the http message"); } } - public static string SendhttpextradataparametersLong { get { return LC.L(@"Use this option to set extra parameters for the message body. This parameter can either be a querystring (e.g. ""parameter1=value1¶meter2=value2"") or a JSON key/value object (e.g. ""{\""parameter1\"": \""value1\"", \""parameter2\"": \""value2\""}"")."); } } - public static string SendhttpextradataparametersShort { get { return LC.L(@"Extra parameters for the message sent"); } } + public static string SendhttpextraparametersLong { get { return LC.L(@"Use this option to set extra parameters for the message body. This parameter can either be a querystring (e.g. ""parameter1=value1¶meter2=value2"") or a JSON key/value object (e.g. ""{\""parameter1\"": \""value1\"", \""parameter2\"": \""value2\""}"")."); } } + public static string SendhttpextraparametersShort { get { return LC.L(@"Extra parameters for the message sent"); } } public static string SendhttplevelLong(string success, string warning, string error, string fatal, string all) { return LC.L(@"You can specify one of ""{0}"", ""{1}"", ""{2}"", ""{3}"". You can supply multiple options with a comma separator, e.g. ""{0},{1}"". The special value ""{4}"" is a shorthand for ""{0},{1},{2},{3}"" and will cause all backup operations to send a message.", success, warning, error, fatal, all); } public static string SendhttplevelShort { get { return LC.L(@"The messages to send"); } }