Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
FullJid.cs
2using Waher.Script;
7
9{
14 {
23 : base(Jid, Start, Length, Expression)
24 {
25 }
26
30 public override string FunctionName => nameof(FullJid);
31
35 public override string[] DefaultArgumentNames => new string[] { "JID" };
36
44 {
45 int i = Argument.IndexOf('@');
46 if (i < 0)
47 return new StringValue(Argument);
48
49 i = Argument.IndexOf('/', i + 1);
50 if (i > 0)
51 return new StringValue(Argument);
52
54 if (Item is null)
55 throw new ScriptRuntimeException("Not connected with " + Argument, this);
56
57 if (!Item.HasLastPresence || !Item.LastPresence.IsOnline)
58 throw new ScriptRuntimeException(Argument + " not online.", this);
59
60 return new StringValue(Item.LastPresenceFullJid);
61 }
62 }
63}
Static class managing the runtime environment of the IoT Gateway.
Definition: Gateway.cs:126
static XmppClient XmppClient
XMPP Client connection of gateway.
Definition: Gateway.cs:3187
Returns the Full JID of a JID. If JID is a Bare JID, the Full JID of the last online presence is retu...
Definition: FullJid.cs:14
override string[] DefaultArgumentNames
Default Argument names
Definition: FullJid.cs:35
FullJid(ScriptNode Jid, int Start, int Length, Expression Expression)
Returns the Full JID of a JID. If JID is a Bare JID, the Full JID of the last online presence is retu...
Definition: FullJid.cs:22
override string FunctionName
Name of the function
Definition: FullJid.cs:30
override IElement EvaluateScalar(string Argument, Variables Variables)
Evaluates the function.
Definition: FullJid.cs:43
Maintains information about an item in the roster.
Definition: RosterItem.cs:75
bool HasLastPresence
If the roster item has received presence from an online resource having the given bare JID.
Definition: RosterItem.cs:425
string LastPresenceFullJid
Full JID of last resource sending online presence.
Definition: RosterItem.cs:343
PresenceEventArgs LastPresence
Last presence received from a resource having this bare JID.
Definition: RosterItem.cs:356
Class managing a script expression.
Definition: Expression.cs:39
Base class for funcions of one scalar variable.
ScriptNode Argument
Function argument.
Base class for all nodes in a parsed script tree.
Definition: ScriptNode.cs:69
int Length
Length of expression covered by node.
Definition: ScriptNode.cs:101
int Start
Start position in script expression.
Definition: ScriptNode.cs:92
Collection of variables.
Definition: Variables.cs:25
Basic interface for all types of elements.
Definition: IElement.cs:20