2using System.Collections.Generic;
3using System.Threading.Tasks;
4using System.Windows.Input;
5using System.Windows.Media;
19 internal bool SupportsAccessAuthorize;
20 internal bool SupportsAccessOpen;
21 internal bool SupportsAccessPresence;
22 internal bool SupportsAccessRoster;
23 internal bool SupportsAccessWhitelist;
24 internal bool SupportsCollections;
25 internal bool SupportsNodeConfiguration;
26 internal bool SupportsCreateAndConfigure;
27 internal bool SupportsCreateNodes;
28 internal bool SupportsDeleteItems;
29 internal bool SupportsDeleteNodes;
30 internal bool SupportsItemIds;
31 internal bool SupportsLastPublished;
32 internal bool SupportsLeasedSubscription;
33 internal bool SupportsManageSubscriptions;
34 internal bool SupportsemberAffiliation;
35 internal bool SupportsMetaData;
36 internal bool SupportsModifyAffiliations;
37 internal bool SupportsMultiCollection;
38 internal bool SupportsMultiItems;
39 internal bool SupportsOutcastAffiliation;
40 internal bool SupportsPersistentItems;
41 internal bool SupportsPresenceSubscribe;
42 internal bool SupportsPublish;
43 internal bool SupportsPublishOnlyAffiliation;
44 internal bool SupportsPublisheAffiliation;
45 internal bool SupportsPurgeNodes;
46 internal bool SupportsRetractItems;
47 internal bool SupportsRetrieveAffiliations;
48 internal bool SupportsRetrieveDefault;
49 internal bool SupportsRetrieveDefaultSub;
50 internal bool SupportsRetrieveItems;
51 internal bool SupportsRetrieveSubscriptions;
52 internal bool SupportsSubscribe;
53 internal bool SupportsSubscriptionOptions;
54 internal bool SupportsSubscriptionNotifications;
57 : base(
Parent, JID, Name, Node, Features)
98 this.children =
new SortedDictionary<string, TreeNode>()
100 {
string.Empty,
new Loading(
this) }
103 this.pubSubClient.ItemNotification += this.PubSubClient_ItemNotification;
104 this.pubSubClient.ItemRetracted += this.PubSubClient_ItemRetracted;
105 this.pubSubClient.NodePurged += this.PubSubClient_NodePurged;
106 this.pubSubClient.SubscriptionRequest += this.PubSubClient_SubscriptionRequest;
112 return Task.CompletedTask;
120 return Task.CompletedTask;
126 Node.ItemRetracted(e);
128 return Task.CompletedTask;
134 Node.ItemNotification(e);
136 return Task.CompletedTask;
143 public override string ToolTip
147 return "Publish/Subscribe Service";
151 private bool loadingChildren =
false;
155 if (!this.loadingChildren && !this.IsLoaded)
157 Mouse.OverrideCursor = Cursors.Wait;
159 this.loadingChildren =
true;
160 this.Account.Client.SendServiceItemsDiscoveryRequest(this.pubSubClient.ComponentAddress, (Sender, e) =>
162 this.loadingChildren = false;
163 MainWindow.MouseDefault();
167 SortedDictionary<string, TreeNode> Children = new SortedDictionary<string, TreeNode>();
169 this.NodesRemoved(this.children.Values, this);
171 foreach (Item Item in e.Items)
173 this.Account.Client.SendServiceDiscoveryRequest(this.PubSubClient.ComponentAddress, Item.Node, (sender2, e2) =>
177 Item Item2 = (Item)e2.State;
178 string Jid = Item2.JID;
179 string Node = Item2.Node;
180 string Name = Item2.Name;
181 NodeType NodeType = NodeType.leaf;
184 foreach (Identity Identity in e2.Identities)
186 if (Identity.Category ==
"pubsub")
188 if (!Enum.TryParse(Identity.Type, out NodeType))
189 NodeType = NodeType.leaf;
191 if (!string.IsNullOrEmpty(Identity.Name))
192 Name = Identity.Name;
198 Children[Item2.Node] = NewNode = new PubSubNode(this, Jid, Node, Name, NodeType);
199 this.children = new SortedDictionary<string, TreeNode>(Children);
203 this.NodesAdded(new TreeNode[] { NewNode }, this);
206 return Task.CompletedTask;
214 return Task.CompletedTask;
222 public override bool CanAddChildren =>
true;
224 public override void Add()
226 Mouse.OverrideCursor = Cursors.Wait;
228 this.pubSubClient.GetDefaultNodeConfiguration((Sender, e) =>
234 int c = e.Form.Fields.Length;
235 Field[] Fields = new Field[c + 1];
236 DataForm Form = null;
238 Array.Copy(e.Form.Fields, 0, Fields, 1, c);
239 Fields[0] = new TextSingleField(null,
"Node",
"Node Name:", true, new string[] { string.Empty },
null,
"Name of the node to create.",
242 Form =
new DataForm(this.pubSubClient.Client,
245 string NodeName = Form[
"Node"].ValueString;
246 string Title = Form[
"pubsub#title"]?.ValueString ?? string.Empty;
248 if (!Enum.TryParse(Form[
"pubsub#node_type"]?.ValueString ?? string.Empty, out NodeType Type))
249 Type = NodeType.leaf;
251 Mouse.OverrideCursor = Cursors.Wait;
253 this.pubSubClient.CreateNode(NodeName, e.Form, (sender3, e3) =>
255 MainWindow.MouseDefault();
261 PubSubNode Node = new PubSubNode(this, this.pubSubClient.ComponentAddress, NodeName, Title, Type);
263 if (this.children is null)
264 this.children = new SortedDictionary<string, TreeNode>() { { Node.Key, Node } };
269 this.children[Node.Key] = Node;
273 MainWindow.UpdateGui(() =>
275 this.Account?.View?.NodeAdded(this, Node);
277 return Task.CompletedTask;
282 MainWindow.ErrorBox(
"Unable to create node: " + e3.ErrorText);
284 return Task.CompletedTask;
287 return Task.CompletedTask;
292 return Task.CompletedTask;
293 },
string.Empty,
string.Empty, Fields);
304 return Task.CompletedTask;
Interaction logic for ParameterDialog.xaml
static async Task< ParameterDialog > CreateAsync(DataForm Form)
Interaction logic for ParameterDialog.xaml
Interaction logic for xaml
Represents a data source in a concentrator.
Represents a node in a Publish/Subscribe service.
override void Add()
Is called when the user wants to add a node to the current node.
override void LoadChildren()
Method is called to make sure children are loaded.
Abstract base class for tree nodes in the connection view.
TreeNode Parent
Parent node. May be null if a root node.
bool TryGetChild(string ChildKey, out TreeNode Child)
Tries to get the child node corresponding to a given key.
Class representing a normal XMPP account.
string ErrorText
Any error specific text.
bool Ok
If the response is an OK result response (true), or an error response (false).
Event argument for item notification events.
Event argument for node notification events.
string NodeName
Name of node.
Event argument for item notification events.
Client managing communication with a Publish/Subscribe component. https://xmpp.org/extensions/xep-006...
const string NamespacePubSubMultiItems
http://jabber.org/protocol/pubsub#multi-items
const string NamespacePubSubOutcastAffiliation
http://jabber.org/protocol/pubsub#outcast-affiliation
const string NamespacePubSubLastPublished
http://jabber.org/protocol/pubsub#last-published
const string NamespacePubSubDeleteItems
http://jabber.org/protocol/pubsub#delete-items
const string NamespacePubSubRetrieveDefaultSub
http://jabber.org/protocol/pubsub#retrieve-default-sub
const string NamespacePubSubModifyAffiliations
http://jabber.org/protocol/pubsub#modify-affiliations
const string NamespacePubSubCollections
http://jabber.org/protocol/pubsub#collections
const string NamespacePubSubPublish
http://jabber.org/protocol/pubsub#publish
const string NamespacePubSubCreateNodes
http://jabber.org/protocol/pubsub#create-nodes
const string NamespacePubSubRetrieveSubscriptions
http://jabber.org/protocol/pubsub#retrieve-subscriptions
const string NamespacePubSubRetractItems
http://jabber.org/protocol/pubsub#retract-items
const string NamespacePubSubSubscriptionOptions
http://jabber.org/protocol/pubsub#subscription-options
const string NamespacePubSubLeasedSubscription
http://jabber.org/protocol/pubsub#leased-subscription
const string NamespacePubSubAccessRoster
http://jabber.org/protocol/pubsub#access-roster
const string NamespacePubSubManageSubscriptions
http://jabber.org/protocol/pubsub#manage-subscriptions
const string NamespacePubSubAccessPresence
http://jabber.org/protocol/pubsub#access-presence
const string NamespacePubSubPresenceSubscribe
http://jabber.org/protocol/pubsub#presence-subscribe
const string NamespacePubSubPersistentItems
http://jabber.org/protocol/pubsub#persistent-items
const string NamespacePubSubCreateAndConfigure
http://jabber.org/protocol/pubsub#create-and-configure
const string NamespacePubSubMultiCollection
http://jabber.org/protocol/pubsub#multi-collection
const string NamespacePubSubDeleteNodes
http://jabber.org/protocol/pubsub#delete-nodes
const string NamespacePubSubMetaData
http://jabber.org/protocol/pubsub#meta-data
const string NamespacePubSubemberAffiliation
http://jabber.org/protocol/pubsub#member-affiliation
const string NamespacePubSubSubscribe
http://jabber.org/protocol/pubsub#subscribe
const string NamespacePubSubRetrieveDefault
http://jabber.org/protocol/pubsub#retrieve-default
const string NamespacePubSubSubscriptionNotifications
http://jabber.org/protocol/pubsub#subscription-notifications
const string NamespacePubSubAccessAuthorize
http://jabber.org/protocol/pubsub#access-authorize
const string NamespacePubSubItemIds
http://jabber.org/protocol/pubsub#item-ids
const string NamespacePubSubRetrieveAffiliations
http://jabber.org/protocol/pubsub#retrieve-affiliations
const string NamespacePubSubRetrieveItems
http://jabber.org/protocol/pubsub#retrieve-items
const string NamespacePubSubNodeConfiguration
http://jabber.org/protocol/pubsub#config-node
const string NamespacePubSubPurgeNodes
http://jabber.org/protocol/pubsub#purge-nodes
const string NamespacePubSubAccessWhitelist
http://jabber.org/protocol/pubsub#access-whitelist
const string NamespacePubSubPublishOnlyAffiliation
http://jabber.org/protocol/pubsub#publish-only-affiliation
const string NamespacePubSubAccessOpen
http://jabber.org/protocol/pubsub#access-open
const string NamespacePubSubPublisheAffiliation
http://jabber.org/protocol/pubsub#publisher-affiliation