1using System.Text.RegularExpressions;
2using System.Threading.Tasks;
15 : base(
@"^decline(\s+(?'JID'[^\s]+))?$")
22 public override string Name =>
"Decline";
32 public override async Task
Execute(
ChatState State,
string[] Arguments,
string OrgMessage, Match Details,
35 int c = Arguments.Length;
39 Networking.XMPP.Events.PresenceEventArgs[] Requests = IoTGateway.Gateway.XmppClient.SubscriptionRequests;
41 if (Requests.Length == 0)
42 await ResponseCallback(
"No subscription requests pending.",
string.Empty);
45 foreach (Networking.XMPP.Events.PresenceEventArgs e in Requests)
48 await ResponseCallback(
"Subscription request from `" + e.FromBareJID +
"` declined.",
string.Empty);
54 string JID = Arguments[0];
59 await
XmppServerModule.SendErrorMessage(
"No pending subscription request found from `" + JID +
"`.",
string.Empty, ResponseCallback);
63 await ResponseCallback(
"Subscription request from `" + JID +
"` declined.",
string.Empty);
76 new HelpItem(
"accept",
"Accepts all pending subscription requests, or a specific subscription request."),
77 new HelpItem(
"accept JID",
"Accepts a specific subscription request from `JID`.")
Event arguments for presence events.
async Task Decline()
Declines a subscription or unsubscription request.
An administrative command whose syntax is validated with a regular expression.
Contains an item of information about a command.
Declines a subscription request.
Decline()
Declines a subscription request.
override HelpItem[] GetHelp()
Gets help about the command.
override string Name
Command name
override async Task Execute(ChatState State, string[] Arguments, string OrgMessage, Match Details, ResponseCallbackHandler ResponseCallback)
Executes the command.
Service Module hosting the XMPP broker and its components.
delegate Task< string > ResponseCallbackHandler(string Markdown, string MessageId)
Delegate for response callback handler methods.