2using System.Collections.Generic;
3using System.Threading.Tasks;
27 : base(
"Xmpp/SendPresenceSubscription",
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 CustomXml = (string)Parameters[
"PCustomXml"]?.AssociatedObjectValue;
57 string Language = (string)Parameters[
"PLanguage"]?.AssociatedObjectValue;
58 string Id = (string)Parameters[
"PId"]?.AssociatedObjectValue;
60 if (
string.IsNullOrEmpty(Id))
61 Id = Guid.NewGuid().ToString();
63 if (
string.IsNullOrEmpty(CustomXml))
73 Dictionary<string, object> NewItem;
94 NewItem =
new Dictionary<string, object>()
96 {
"bareJid", Item?.
BareJid ?? To },
98 {
"status", Item?.
State ?? SubscriptionState.None },
99 {
"name", Item?.
Name ?? string.Empty },
100 {
"Groups", Item?.
Groups ??
new string[0] }
109 Item?.
Name ??
string.Empty,
null,
null,
null);
117 NewItem =
new Dictionary<string, object>()
119 {
"bareJid", Item.BareJid.Value },
120 {
"pendingSubscription", Item.PendingSubscription },
121 {
"status", Item.Subscription },
122 {
"name", Item.Name },
123 {
"Groups", Item.Groups }
131 {
"RosterItem", NewItem }
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 bool IsValidXml(string Xml)
Checks if a string is valid 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...
Maintains information about an item in the roster.
SubscriptionState State
roup Current subscription state.
string[] Groups
Any groups the roster item belongs to.
string BareJid
Bare JID of the roster item.
PendingSubscription PendingSubscription
If there's a pending unanswered presence subscription or unsubscription request made to the contact.
string Name
Name of the roster item.
Contains information about one XMPP address.
CaseInsensitiveString Domain
Domain name.
async Task< bool > Presence(string Type, string Id, XmppAddress From, string Language, Stanza Stanza, ISender Sender)
Presence stanza.
Manages an XMPP client connection. Implements XMPP, as defined in https://tools.ietf....
Task RequestPresenceSubscription(string BareJid)
Requests subscription of presence information from a contact.
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.
string UserName
User Name.
async Task< IRosterItem > GetRosterItem(CaseInsensitiveString UserName, CaseInsensitiveString Jid)
Gets a roster item for an account.
async Task< IRosterItem > SetRosterItem(CaseInsensitiveString UserName, CaseInsensitiveString Jid, string Name, SubscriptionStatus? Subscription, bool? PendingSubscription, string[] Groups)
Sets a roster item in a users roster.
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 IsValidBareJID(string JID)
Checks if a string is a valid Bare JID.
static async Task< string > GetApprovedLegalIDXml(string Account)
Gets XML containing the latest approvied Legal ID for an account, for inclusion in requests to peers.
Sends a presence subscription request to an XMPP account.
override async Task POST(HttpRequest Request, HttpResponse Response, Dictionary< string, IElement > Parameters)
Executes the POST method on the resource.
SendPresenceSubscription()
Sends a presence subscription request to an XMPP account.
Service Module hosting the XMPP broker and its components.
Interface for roster items.
string Name
Name of roster item.
PendingSubscription
Pending subscription states.