Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Unsubscribe.cs
1using System.Text.RegularExpressions;
2using System.Threading.Tasks;
3
5{
9 public class Unsubscribe : CommandRegEx
10 {
14 public Unsubscribe()
15 : base(@"^unsubscribe\s+(?'JID'[^\s]+)$")
16 {
17 }
18
22 public override string Name => "Unsubscribe";
23
32 public override async Task Execute(ChatState State, string[] Arguments, string OrgMessage, Match Details,
33 ResponseCallbackHandler ResponseCallback)
34 {
35 string JID = Arguments[0];
36 await IoTGateway.Gateway.XmppClient.RequestPresenceUnsubscription(JID);
37
38 await ResponseCallback("Unsubscribed from `" + JID + "`.", string.Empty);
39 }
40
45 public override HelpItem[] GetHelp()
46 {
47 return new HelpItem[]
48 {
49 new HelpItem("unsubscribe JID", "Unsubscribes from a contact.")
50 };
51 }
52 }
53}
An administrative command whose syntax is validated with a regular expression.
Definition: CommandRegEx.cs:12
Contains an item of information about a command.
Definition: HelpItem.cs:9
override async Task Execute(ChatState State, string[] Arguments, string OrgMessage, Match Details, ResponseCallbackHandler ResponseCallback)
Executes the command.
Definition: Unsubscribe.cs:32
override HelpItem[] GetHelp()
Gets help about the command.
Definition: Unsubscribe.cs:45
delegate Task< string > ResponseCallbackHandler(string Markdown, string MessageId)
Delegate for response callback handler methods.