2using System.Collections.Generic;
4using System.Threading.Tasks;
27 : base(
"Xmpp/SendTextMessage",
28 new KeyValuePair<Type,
Expression>(typeof(Dictionary<string, object>), new
Expression(jsonPattern)),
48 string To = (string)Parameters[
"PTo"].AssociatedObjectValue;
50 if (
string.IsNullOrEmpty(To))
56 string Message = (string)Parameters[
"PMessage"].AssociatedObjectValue;
58 if (
string.IsNullOrEmpty(Message))
61 string Subject = (string)Parameters[
"PSubject"]?.AssociatedObjectValue;
62 string Language = (string)Parameters[
"PLanguage"]?.AssociatedObjectValue;
63 string Id = (string)Parameters[
"PId"]?.AssociatedObjectValue;
65 StringBuilder Xml =
new StringBuilder();
67 if (!
string.IsNullOrEmpty(Subject))
69 Xml.Append(
"<subject>");
71 Xml.Append(
"</subject>");
76 Xml.Append(
"</body>");
78 if (
string.IsNullOrEmpty(Id))
79 Id = Guid.NewGuid().ToString();
99 string.Empty,
string.Empty, Language,
string.Empty,
string.Empty,
null,
null);
107 Language, Xml.ToString());
A Named dictionary is a dictionary, with a local name and a namespace. Use it to return content that ...
Static class managing loading of resources stored as embedded resources or in content files.
static string LoadResourceAsText(string ResourceName)
Loads a text resource from an embedded resource.
Helps with common XML-related tasks.
static string Encode(string s)
Encodes a string for use in XML.
Static class managing the runtime environment of the IoT Gateway.
static XmppClient XmppClient
XMPP Client connection of gateway.
The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repe...
Represents an HTTP request.
Represets a response of an HTTP client request.
async Task Return(object Object)
Returns an object to the client. This method can only be called once per response,...
The server is currently unable to handle the request due to a temporary overloading or maintenance of...
Manages an XMPP client connection. Implements XMPP, as defined in https://tools.ietf....
Task SendMessage(MessageType Type, string To, string CustomXml, string Body, string Subject, string Language, string ThreadId, string ParentThreadId)
Sends a simple chat message
Static class that dynamically manages types and interfaces available in the runtime environment.
static bool TryGetModuleParameter(string Name, out object Value)
Tries to get a module parameter value.
Class managing a script expression.
CaseInsensitiveString UserName
User Name of account
Account Account
Account object.
static AccountUser AssertUserAuthenticated(HttpRequest Request)
Makes sure the request is made by an authenticated API user.
const string AgentNamespace
https://waher.se/Schema/BrokerAgent.xsd
Abstract base class for XMPP resources.
static bool IsValidJID(string JID)
Checks if a string is a valid Bare or Full JID.
Sends a text message to an XMPP recipient.
SendTextMessage()
Sends a text message to an XMPP recipient.
override async Task POST(HttpRequest Request, HttpResponse Response, Dictionary< string, IElement > Parameters)
Executes the POST method on the resource.
Service Module hosting the XMPP broker and its components.
QoSLevel
Quality of Service Level for asynchronous messages. Support for QoS Levels must be supported by the r...
MessageType
Type of message received.