Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
PepExtension.cs
1using System;
2using System.Collections.Generic;
3using System.Threading.Tasks;
6
8{
13 {
20 : base(Parent, Model)
21 {
22 }
23
27 public override string LocalName => nameof(PepExtension);
28
36 {
37 return new PepExtension(Parent, Model);
38 }
39
46 public override Task<object> Add(IActor Instance, Waher.Networking.XMPP.XmppClient Client)
47 {
48 PepClient Extension = new PepClient(Client);
49 Client.SetTag("PEP", Extension);
50
51 Extension.NonPepItemNotification += (Sender, e) =>
52 {
53 this.Model.ExternalEvent(Instance, "NonPepItemNotification",
54 new KeyValuePair<string, object>("e", e),
55 new KeyValuePair<string, object>("Client", Client));
56
57 return Task.CompletedTask;
58 };
59
60 Extension.NonPepItemRetraction += (Sender, e) =>
61 {
62 this.Model.ExternalEvent(Instance, "NonPepItemRetraction",
63 new KeyValuePair<string, object>("e", e),
64 new KeyValuePair<string, object>("Client", Client));
65
66 return Task.CompletedTask;
67 };
68
69 Extension.OnUserActivity += (Sender, e) =>
70 {
71 this.Model.ExternalEvent(Instance, "OnUserActivity",
72 new KeyValuePair<string, object>("e", e),
73 new KeyValuePair<string, object>("Client", Client));
74
75 return Task.CompletedTask;
76 };
77
78 Extension.OnUserAvatarMetaData += (Sender, e) =>
79 {
80 this.Model.ExternalEvent(Instance, "OnUserAvatarMetaData",
81 new KeyValuePair<string, object>("e", e),
82 new KeyValuePair<string, object>("Client", Client));
83
84 return Task.CompletedTask;
85 };
86
87 Extension.OnUserLocation += (Sender, e) =>
88 {
89 this.Model.ExternalEvent(Instance, "OnUserLocation",
90 new KeyValuePair<string, object>("e", e),
91 new KeyValuePair<string, object>("Client", Client));
92
93 return Task.CompletedTask;
94 };
95
96 Extension.OnUserMood += (Sender, e) =>
97 {
98 this.Model.ExternalEvent(Instance, "OnUserMood",
99 new KeyValuePair<string, object>("e", e),
100 new KeyValuePair<string, object>("Client", Client));
101
102 return Task.CompletedTask;
103 };
104
105 Extension.OnUserTune += (Sender, e) =>
106 {
107 this.Model.ExternalEvent(Instance, "OnUserTune",
108 new KeyValuePair<string, object>("e", e),
109 new KeyValuePair<string, object>("Client", Client));
110
111 return Task.CompletedTask;
112 };
113
114 return Task.FromResult<object>(Extension);
115 }
116
117 }
118}
Root node of a simulation model
Definition: Model.cs:49
bool ExternalEvent(IExternalEventsNode Source, string Name, params KeyValuePair< string, object >[] Arguments)
Method called when an external event has been received.
Definition: Model.cs:889
override Task< object > Add(IActor Instance, Waher.Networking.XMPP.XmppClient Client)
Adds the extension to the client.
Definition: PepExtension.cs:46
override ISimulationNode Create(ISimulationNode Parent, Model Model)
Creates a new instance of the node.
Definition: PepExtension.cs:35
override string LocalName
Local name of XML element defining contents of class.
Definition: PepExtension.cs:27
PepExtension(ISimulationNode Parent, Model Model)
PEP XMPP extension
Definition: PepExtension.cs:19
Abstract base class for XMPP extensions.
Client managing the Personal Eventing Protocol (XEP-0163). https://xmpp.org/extensions/xep-0163....
Definition: PepClient.cs:19
Manages an XMPP client connection. Implements XMPP, as defined in https://tools.ietf....
Definition: XmppClient.cs:59
Basic interface for simulator nodes. Implementing this interface allows classes with default contruct...
ISimulationNode Parent
Parent node in the simulation model.
Basic interface for simulator nodes. Implementing this interface allows classes with default contruct...
Definition: IActor.cs:11
Definition: App.xaml.cs:4