예제 #1
0
 /// <summary>
 /// Event arguments for IsFriend events.
 /// </summary>
 /// <param name="Client">XMPP Client used.</param>
 /// <param name="e">Message with request.</param>
 public QuestionEventArgs(ProvisioningClient Client, MessageEventArgs e)
     : base(e)
 {
     this.client    = Client;
     this.jid       = XML.Attribute(e.Content, "jid");
     this.remoteJid = XML.Attribute(e.Content, "remoteJid");
     this.key       = XML.Attribute(e.Content, "key");
 }
        /// <summary>
        /// Abstract base class containing event arguments for node question events.
        /// </summary>
        /// <param name="Client">Provisioning Client used.</param>
        /// <param name="e">Message with request.</param>
        public NodeQuestionEventArgs(ProvisioningClient Client, MessageEventArgs e)
            : base(Client, e)
        {
            this.serviceTokens = XML.Attribute(e.Content, "st").Split(space, StringSplitOptions.RemoveEmptyEntries);
            this.deviceTokens  = XML.Attribute(e.Content, "dt").Split(space, StringSplitOptions.RemoveEmptyEntries);
            this.userTokens    = XML.Attribute(e.Content, "ut").Split(space, StringSplitOptions.RemoveEmptyEntries);

            foreach (XmlNode N in e.Content.ChildNodes)
            {
                if (N is XmlElement E && E.LocalName == "nd")
                {
                    this.nodeId    = XML.Attribute(E, "id");
                    this.sourceId  = XML.Attribute(E, "src");
                    this.partition = XML.Attribute(E, "pt");

                    break;
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Event arguments for CanControl events.
        /// </summary>
        /// <param name="ProvisioningClient">XMPP Provisioning Client used.</param>
        /// <param name="e">Message with request.</param>
        public CanControlEventArgs(ProvisioningClient ProvisioningClient, MessageEventArgs e)
            : base(ProvisioningClient, e)
        {
            this.provisioningClient = ProvisioningClient;
            List <string> Parameters = null;

            foreach (XmlNode N in e.Content.ChildNodes)
            {
                if (N is XmlElement E && E.LocalName == "p")
                {
                    if (Parameters == null)
                    {
                        Parameters = new List <string>();
                    }

                    Parameters.Add(XML.Attribute(E, "n"));
                }
            }

            if (Parameters != null)
            {
                this.parameters = Parameters.ToArray();
            }
        }
예제 #4
0
        /// <summary>
        /// Event arguments for CanRead events.
        /// </summary>
        /// <param name="ProvisioningClient">XMPP Provisioning Client used.</param>
        /// <param name="e">Message with request.</param>
        public CanReadEventArgs(ProvisioningClient ProvisioningClient, MessageEventArgs e)
            : base(ProvisioningClient, e)
        {
            this.provisioningClient = ProvisioningClient;
            this.fieldTypes         = (FieldType)0;

            foreach (XmlAttribute Attr in e.Content.Attributes)
            {
                switch (Attr.LocalName)
                {
                case "all":
                    if (CommonTypes.TryParse(Attr.Value, out bool b) && b)
                    {
                        this.fieldTypes |= FieldType.All;
                    }
                    break;

                case "m":
                    if (CommonTypes.TryParse(Attr.Value, out b) && b)
                    {
                        this.fieldTypes |= FieldType.Momentary;
                    }
                    break;

                case "p":
                    if (CommonTypes.TryParse(Attr.Value, out b) && b)
                    {
                        this.fieldTypes |= FieldType.Peak;
                    }
                    break;

                case "s":
                    if (CommonTypes.TryParse(Attr.Value, out b) && b)
                    {
                        this.fieldTypes |= FieldType.Status;
                    }
                    break;

                case "c":
                    if (CommonTypes.TryParse(Attr.Value, out b) && b)
                    {
                        this.fieldTypes |= FieldType.Computed;
                    }
                    break;

                case "i":
                    if (CommonTypes.TryParse(Attr.Value, out b) && b)
                    {
                        this.fieldTypes |= FieldType.Identity;
                    }
                    break;

                case "h":
                    if (CommonTypes.TryParse(Attr.Value, out b) && b)
                    {
                        this.fieldTypes |= FieldType.Historical;
                    }
                    break;
                }
            }

            List <string> Fields = null;

            foreach (XmlNode N in e.Content.ChildNodes)
            {
                if (N is XmlElement E && E.LocalName == "f")
                {
                    if (Fields is null)
                    {
                        Fields = new List <string>();
                    }

                    Fields.Add(XML.Attribute(E, "n"));
                }
            }

            if (Fields != null)
            {
                this.fields = Fields.ToArray();
            }
            else
            {
                this.fields = null;
            }
        }
예제 #5
0
 /// <summary>
 /// Event arguments for IsFriend events.
 /// </summary>
 /// <param name="Client">Provisioning Client used.</param>
 /// <param name="e">Message with request.</param>
 public IsFriendEventArgs(ProvisioningClient Client, MessageEventArgs e)
     : base(Client, e)
 {
 }