2using System.Text.RegularExpressions;
3using System.Threading.Tasks;
25 : base(
@"^groupgraph\s*.*$")
32 public override string Name =>
"GroupGraph";
42 public override async Task
Execute(
ChatState State,
string[] Arguments,
string OrgMessage, Match Details,
45 string Script = OrgMessage.Substring(10).Trim();
49 if (
string.IsNullOrEmpty(Script))
52 Color = SKColors.Empty;
61 StringBuilder sb =
new StringBuilder();
62 string Title = IoTGateway.Gateway.XmppClient.BareJID;
64 sb.AppendLine(
"```dot");
65 sb.AppendLine(
"digraph G {");
66 sb.AppendLine(
"rankdir=LR");
70 foreach (
RosterItem Item
in IoTGateway.Gateway.XmppClient.Roster)
72 foreach (
string Group
in Item.
Groups)
76 sb.Append(
"\" -> \"");
78 sb.Append(
"\" [label=\"");
80 sb.AppendLine(
"\"];");
87 await ResponseCallback(sb.ToString(),
string.Empty);
97 new HelpItem(
"GroupGraph[ SCRIPT]",
"Returns a GraphViz graph of the current broker and how it is connected to roster items with groups. Such a graph illustrates information flow authorized by group membership. Optional script can be provided, and its result embedded in the graph. Consolidating responses from multiple brokers generates a groups graph of all brokers.")
Maintains information about an item in the roster.
string[] Groups
Any groups the roster item belongs to.
string BareJid
Bare JID of the roster item.
Class managing a script expression.
async Task< object > EvaluateAsync(Variables Variables)
Evaluates the expression, using the variables provided in the Variables collection....
readonly Variables Session
Session variables
An administrative command whose syntax is validated with a regular expression.
Contains an item of information about a command.
Returns a GraphViz graph of the current broker and how it is connected to roster items with groups....
override HelpItem[] GetHelp()
Markdown description of syntax.
override async Task Execute(ChatState State, string[] Arguments, string OrgMessage, Match Details, ResponseCallbackHandler ResponseCallback)
Executes the command.
override string Name
Command name
GroupGraph()
Returns a GraphViz graph of the current broker and how it is connected to roster items with groups....
Executes script (if provided), and returns the result in the form of a GraphViz graph of the current ...
delegate Task< string > ResponseCallbackHandler(string Markdown, string MessageId)
Delegate for response callback handler methods.