2using System.Collections.Generic;
5using System.Threading.Tasks;
44 get => this.addresses;
45 set => this.addresses = value;
55 StringBuilder sb =
new StringBuilder();
58 foreach (
string s
in this.addresses)
75 public override string Resource =>
"/Settings/Notification.md";
97 return Task.CompletedTask;
115 this.testAddresses = WebServer.
Register(
"/Settings/TestNotificationAddresses",
null, this.TestNotificationAddresses,
true,
false,
true);
117 return base.InitSetup(WebServer);
128 return base.UnregisterSetup(WebServer);
144 if (!(Obj is
string Address))
147 string TabID = Request.
Header[
"X-TabID"];
149 List<CaseInsensitiveString>
Addresses =
new List<CaseInsensitiveString>();
151 Response.StatusCode = 200;
155 foreach (
string Part
in Address.Split(
';'))
157 string s = Part.Trim();
158 if (
string.IsNullOrEmpty(s))
164 MailAddress Addr =
new MailAddress(s);
172 if (this.addresses.
Length > 0)
174 await
Gateway.
SendNotification(
"Test\r\n===========\r\n\r\nThis message was generated to test the notification feature of **" +
178 if (!
string.IsNullOrEmpty(TabID))
179 await Response.
Write(1);
183 if (!
string.IsNullOrEmpty(TabID))
184 await Response.
Write(0);
198 return Task.FromResult(
true);
214 return Task.FromResult(
false);
222 return Task.FromResult(
false);
226 this.addresses = Jids;
228 return Task.FromResult(
true);
Contains a markdown document. This markdown document class supports original markdown,...
static string Encode(string s)
Encodes all special characters in a string so that it can be included in a markdown document without ...
Static class managing the runtime environment of the IoT Gateway.
static IUser AssertUserAuthenticated(HttpRequest Request, string Privilege)
Makes sure a request is being made from a session with a successful user login.
static Task SendNotification(Graph Graph)
Sends a graph as a notification message to configured notification recipients.
static XmppClient XmppClient
XMPP Client connection of gateway.
static string ApplicationName
Application Name.
Notification Configuration
override Task< bool > SimplifiedConfiguration()
Simplified configuration by configuring simple default values.
override Task ConfigureSystem()
Is called during startup to configure the system.
NotificationConfiguration()
Notification Configuration
override Task InitSetup(HttpServer WebServer)
Initializes the setup object.
override string ConfigPrivilege
Minimum required privilege for a user to be allowed to change the configuration defined by the class.
override Task< bool > EnvironmentConfiguration()
Environment configuration by configuring values available in environment variables.
override string Resource
Resource to be redirected to, to perform the configuration.
string AddressesString
A string containing all addresses, delimited by "; ".
override int Priority
Priority of the setting. Configurations are sorted in ascending order.
override Task UnregisterSetup(HttpServer WebServer)
Unregisters the setup object.
static NotificationConfiguration Instance
Current instance of configuration.
const string GATEWAY_NOTIFICATION_JIDS
JIDs of operators of gateway.
override void SetStaticInstance(ISystemConfiguration Configuration)
Sets the static instance of the configuration.
override Task< string > Title(Language Language)
Gets a title for the system configuration.
CaseInsensitiveString[] Addresses
Notification addresses.
Abstract base class for system configurations.
void LogEnvironmentError(string EnvironmentVariable, object Value)
Logs an error to the event log, telling the operator an environment variable value contains an error.
The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repe...
Represents an HTTP request.
HttpRequestHeader Header
Request header.
bool HasData
If the request has data.
async Task< object > DecodeDataAsync()
Decodes data sent in request.
Base class for all HTTP resources.
Represets a response of an HTTP client request.
async Task SendResponse()
Sends the response back to the client. If the resource is synchronous, there's no need to call this m...
async Task Write(byte[] Data)
Returns binary data in the response.
Implements an HTTP server.
HttpResource Register(HttpResource Resource)
Registers a resource with the server.
bool Unregister(HttpResource Resource)
Unregisters a resource from the server.
Manages an XMPP client connection. Implements XMPP, as defined in https://tools.ietf....
static readonly Regex BareJidRegEx
Regular expression for Bare JIDs
Represents a case-insensitive string.
int Length
Gets the number of characters in the current CaseInsensitiveString object.
static bool IsNullOrEmpty(CaseInsensitiveString value)
Indicates whether the specified string is null or an CaseInsensitiveString.Empty string.
CaseInsensitiveString[] Split(params char[] separator)
Returns a string array that contains the substrings in this instance that are delimited by elements o...
Static interface for database persistence. In order to work, a database provider has to be assigned t...
static async Task Update(object Object)
Updates an object in the database.
Contains information about a language.
Task< string > GetStringAsync(Type Type, int Id, string Default)
Gets the string value of a string ID. If no such string exists, a string is created with the default ...
Interface for system configurations. The gateway will scan all module for system configuration classe...