Ejemplo n.º 1
0
        private void CancelHandler(object Sender, IqEventArgs e)
        {
            SensorDataServerRequest Request;
            string Id  = XML.Attribute(e.Query, "id");
            string Key = e.From + " " + Id;

            lock (this.requests)
            {
                if (this.requests.TryGetValue(Key, out Request))
                {
                    this.requests.Remove(Key);
                }
                else
                {
                    Request = null;
                }
            }

            if (Request != null && !Request.Started)
            {
                this.scheduler.Remove(Request.When);
            }

            e.IqResult(string.Empty);
        }
Ejemplo n.º 2
0
        private void RemovedHandler(object Sender, IqEventArgs e)
        {
            XmlElement     E         = e.Query;
            string         NodeId    = XML.Attribute(E, "id");
            string         SourceId  = XML.Attribute(E, "src");
            string         Partition = XML.Attribute(E, "pt");
            ThingReference Node;

            if (string.IsNullOrEmpty(NodeId) && string.IsNullOrEmpty(SourceId) && string.IsNullOrEmpty(Partition))
            {
                Node = ThingReference.Empty;
            }
            else
            {
                Node = new ThingReference(NodeId, SourceId, Partition);
            }

            NodeEventArgs    e2 = new NodeEventArgs(e, Node);
            NodeEventHandler h  = this.Removed;

            if (h != null)
            {
                try
                {
                    h(this, e2);
                }
                catch (Exception ex)
                {
                    Log.Critical(ex);
                }
            }

            e.IqResult(string.Empty);
        }
Ejemplo n.º 3
0
        private void OpenHandler(object Sender, IqEventArgs e)
        {
            int    BlockSize = XML.Attribute(e.Query, "block-size", 0);
            string StreamId  = XML.Attribute(e.Query, "sid");
            string Stanza    = XML.Attribute(e.Query, "stanza", "iq");

            if (Stanza != "message" && Stanza != "iq")
            {
                throw new BadRequestException("Invalid stanza type.", e.IQ);
            }

            if (BlockSize <= 0)
            {
                throw new BadRequestException("Invalid block size.", e.IQ);
            }

            if (BlockSize > this.maxBlockSize)
            {
                throw new ResourceConstraintException("Requested block size too large. Maximum acceptable is " +
                                                      this.maxBlockSize.ToString(), e.IQ);
            }

            ValidateStreamEventHandler h  = this.OnOpen;
            ValidateStreamEventArgs    e2 = new ValidateStreamEventArgs(this.client, e, StreamId, BlockSize);

            if (h != null)
            {
                try
                {
                    h(this, e2);
                }
                catch (Exception ex)
                {
                    Log.Critical(ex);
                }
            }

            if (e2.DataCallback is null || e2.CloseCallback is null)
            {
                throw new NotAcceptableException("Stream not expected.", e.IQ);
            }

            this.AssertCacheCreated();

            string Key = e.From + " " + StreamId;

            if (this.cache.ContainsKey(Key))
            {
                throw new NotAcceptableException("Stream already open.", e.IQ);
            }

            IncomingStream Input = new IncomingStream(e2.DataCallback, e2.CloseCallback, e2.State, BlockSize);

            this.cache[Key] = Input;

            e.IqResult(string.Empty);
        }
Ejemplo n.º 4
0
        private Task CloseHandler(object Sender, IqEventArgs e)
        {
            string         StreamId = XML.Attribute(e.Query, "sid");
            string         Key      = e.From + " " + StreamId;
            IncomingStream Input;
            OutgoingStream Output;

            lock (this.synchObject)
            {
                if (this.cache is null)
                {
                    Input = null;
                }
                else if (this.cache.TryGetValue(Key, out Input))
                {
                    this.cache.Remove(Key);
                }
                else
                {
                    Input = null;
                }
            }

            if (Input is null)
            {
                lock (this.output)
                {
                    if (!this.output.TryGetValue(StreamId, out Output))
                    {
                        throw new ItemNotFoundException("Stream not recognized.", e.Query);
                    }

                    this.output.Remove(StreamId);
                }

                Output.Abort();
                Output.Dispose();
            }
            else
            {
                if (Input.BlocksMissing)
                {
                    Input.Closed(CloseReason.Aborted);
                }
                else
                {
                    Input.Closed(CloseReason.Done);
                }

                Input.Dispose();
            }

            e.IqResult(string.Empty);

            return(Task.CompletedTask);
        }
Ejemplo n.º 5
0
 private void DataHandler(object Sender, IqEventArgs e)
 {
     if (this.HandleIncomingData(e.Query, e.From))
     {
         e.IqResult(string.Empty);
     }
     else
     {
         throw new ItemNotFoundException("Stream not recognized.", e.Query);
     }
 }
Ejemplo n.º 6
0
 private async void QueryVCardHandler(object Sender, IqEventArgs e)
 {
     try
     {
         e.IqResult(await this.GetVCardXml());
     }
     catch (Exception ex)
     {
         e.IqError(ex);
     }
 }
Ejemplo n.º 7
0
        private void ForwardedTokenChallengeResponse(object Sender, IqResultEventArgs e2)
        {
            IqEventArgs e = (IqEventArgs)e2.State;

            if (e2.Ok)
            {
                e.IqResult(e2.FirstElement.OuterXml);
            }
            else
            {
                e.IqError(e2.ErrorElement.OuterXml);
            }
        }
Ejemplo n.º 8
0
        private void GetData(object Sender, IqEventArgs e)
        {
            string ContentId = XML.Attribute(e.Query, "cid");
            string FileName  = this.GetFileName(ContentId);

            if (!File.Exists(FileName))
            {
                throw new ItemNotFoundException("Content not found.", e.Query);
            }

            string Xml = File.ReadAllText(FileName, Encoding.ASCII);

            e.IqResult(Xml);
        }
Ejemplo n.º 9
0
        private void AcceptRequest(SensorDataServerRequest Request, IqEventArgs e, string Id)
        {
            string Key = e.From + " " + Id;
            bool   NewRequest;

            lock (this.requests)
            {
                if (NewRequest = !this.requests.ContainsKey(Key))
                {
                    this.requests[Key] = Request;
                }
            }

            if (Request.When > DateTime.Now)
            {
                e.IqResult("<accepted xmlns='" + SensorClient.NamespaceSensorData + "' id='" + XML.Encode(Id) + "' queued='true'/>");
                Request.When = this.scheduler.Add(Request.When, this.StartReadout, Request);
            }
            else
            {
                e.IqResult("<accepted xmlns='" + SensorClient.NamespaceSensorData + "' id='" + XML.Encode(Id) + "'/>");
                this.PerformReadout(Request);
            }
        }
Ejemplo n.º 10
0
        private async Task GetData(object Sender, IqEventArgs e)
        {
            string ContentId = XML.Attribute(e.Query, "cid");
            string FileName  = this.GetFileName(ContentId);

            if (!File.Exists(FileName))
            {
                throw new ItemNotFoundException("Content not found.", e.Query);
            }

            using (FileStream f = File.OpenRead(FileName))
            {
                StreamReader r   = new StreamReader(f, Encoding.ASCII);
                string       Xml = await r.ReadToEndAsync();

                e.IqResult(Xml);
            }
        }
Ejemplo n.º 11
0
        private void UnsubscribeHandler(object Sender, IqEventArgs e)
        {
            string Id = XML.Attribute(e.Query, "id");
            bool   Found;

            lock (this.subscriptionsByThing)
            {
                Found = this.RemoveSubscriptionLocked(e.From, Id, true);
            }

            if (Found)
            {
                e.IqResult(string.Empty);
            }
            else
            {
                e.IqError("<error type='modify'><item-not-found xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"/></error>");
            }
        }
Ejemplo n.º 12
0
        private void ClaimedHandler(object Sender, IqEventArgs e)
        {
            XmlElement     E         = e.Query;
            string         OwnerJid  = XML.Attribute(E, "jid");
            string         NodeId    = XML.Attribute(E, "id");
            string         SourceId  = XML.Attribute(E, "src");
            string         Partition = XML.Attribute(E, "pt");
            bool           Public    = XML.Attribute(E, "public", false);
            ThingReference Node;

            if (string.IsNullOrEmpty(NodeId) && string.IsNullOrEmpty(SourceId) && string.IsNullOrEmpty(Partition))
            {
                Node = ThingReference.Empty;

                if (this.client.TryGetExtension(typeof(ProvisioningClient), out IXmppExtension Extension) &&
                    Extension is ProvisioningClient ProvisioningClient)
                {
                    ProvisioningClient.OwnerJid = OwnerJid;
                }
            }
            else
            {
                Node = new ThingReference(NodeId, SourceId, Partition);
            }

            ClaimedEventArgs    e2 = new ClaimedEventArgs(e, Node, OwnerJid, Public);
            ClaimedEventHandler h  = this.Claimed;

            if (h != null)
            {
                try
                {
                    h(this, e2);
                }
                catch (Exception ex)
                {
                    Log.Critical(ex);
                }
            }

            e.IqResult(string.Empty);
        }
Ejemplo n.º 13
0
        private void GetInterfacesHandler(object Sender, IqEventArgs e)
        {
            XmlElement E            = e.Query;
            string     NodeId       = XML.Attribute(E, "id");
            string     SourceId     = XML.Attribute(E, "src");
            string     Partition    = XML.Attribute(E, "pt");
            string     ServiceToken = XML.Attribute(E, "st");
            string     DeviceToken  = XML.Attribute(E, "dt");
            string     UserToken    = XML.Attribute(E, "ut");

            InteroperabilityServerInterfacesEventHandler h = this.OnGetInterfaces;
            InteroperabilityServerEventArgs e2             = new InteroperabilityServerEventArgs(NodeId, SourceId, Partition, ServiceToken, DeviceToken, UserToken);

            if (h != null)
            {
                try
                {
                    h(this, e2);
                }
                catch (Exception ex)
                {
                    Log.Critical(ex);
                }
            }

            StringBuilder Xml = new StringBuilder();

            Xml.Append("<getInterfacesResponse xmlns='");
            Xml.Append(NamespaceInteroperability);
            Xml.Append("'>");

            foreach (string Interface in e2.Interfaces)
            {
                Xml.Append("<interface name='");
                Xml.Append(XML.Encode(Interface));
                Xml.Append("'/>");
            }

            Xml.Append("</getInterfacesResponse>");

            e.IqResult(Xml.ToString());
        }
Ejemplo n.º 14
0
        private async void ClearCacheHandler(object Sender, IqEventArgs e)
        {
            try
            {
                if (e.From == this.provisioningServerAddress)
                {
                    await this.ClearInternalCache();

                    e.IqResult(string.Empty);
                }
                else
                {
                    e.IqError(new ForbiddenException("Unauthorized sender.", e.IQ));
                }
            }
            catch (Exception ex)
            {
                e.IqError(ex);
            }
        }
Ejemplo n.º 15
0
        private void Clock(object Sender, IqEventArgs e)
        {
            DateTimeHF    Now = SynchronizationClient.Now;
            StringBuilder Xml = new StringBuilder();

            Xml.Append("<resp xmlns='");
            Xml.Append(NamespaceSynchronization);

            if (Now.Ticks.HasValue)
            {
                Xml.Append("' hf='");
                Xml.Append(Now.Ticks.Value.ToString());
                Xml.Append("' freq='");
                Xml.Append(Stopwatch.Frequency.ToString());
            }

            Xml.Append("'>");
            Encode(Now, Xml);
            Xml.Append("</resp>");

            e.IqResult(Xml.ToString());
        }
Ejemplo n.º 16
0
        private void TokenChallengeHandler(object Sender, IqEventArgs e)
        {
            XmlElement     E         = e.Query;
            string         Token     = XML.Attribute(E, "token");
            string         Challenge = E.InnerText;
            CertificateUse Use;

            lock (this.certificates)
            {
                if (!this.certificates.TryGetValue(Token, out Use) || (DateTime.Now - Use.LastUse).TotalMinutes > 1)
                {
                    throw new ForbiddenException("Token not recognized.", e.IQ);
                }
            }

            if (Use.LocalCertificate != null)
            {
                byte[] Bin = System.Convert.FromBase64String(Challenge);

#if WINDOWS_UWP
                CryptographicKey Key = PersistedKeyProvider.OpenPublicKeyFromCertificate(Use.LocalCertificate,
                                                                                         Use.LocalCertificate.SignatureHashAlgorithmName, CryptographicPadding.RsaPkcs1V15);
                IBuffer Buffer = CryptographicBuffer.CreateFromByteArray(Bin);
                Buffer = CryptographicEngine.Decrypt(Key, Buffer, null);
                CryptographicBuffer.CopyToByteArray(Buffer, out Bin);
                string Response = System.Convert.ToBase64String(Bin);
#else
                Bin = Use.LocalCertificate.GetRSAPrivateKey().Decrypt(Bin, RSAEncryptionPadding.Pkcs1);
                string Response = System.Convert.ToBase64String(Bin);
#endif

                e.IqResult("<tokenChallengeResponse xmlns='" + NamespaceProvisioningToken + "'>" + Response + "</tokenChallengeResponse>");
            }
            else
            {
                this.client.SendIqGet(Use.RemoteCertificateJid, e.Query.OuterXml, this.ForwardedTokenChallengeResponse, e);
            }
        }
Ejemplo n.º 17
0
        private void PerformSubscription(bool Req, IqEventArgs e, string Id, Dictionary <string, FieldSubscriptionRule> FieldNames,
                                         ThingReference[] Nodes, FieldType FieldTypes, string ServiceToken, string DeviceToken, string UserToken,
                                         Duration MaxAge, Duration MinInterval, Duration MaxInterval)
        {
            DateTime     Now = DateTime.Now;
            Subscription Subscription;

            if (Req)
            {
                string   Key = e.From + " " + Id;
                string[] Fields2;

                if (FieldNames == null)
                {
                    Fields2 = null;
                }
                else
                {
                    Fields2 = new string[FieldNames.Count];
                    FieldNames.Keys.CopyTo(Fields2, 0);
                }

                SensorDataServerRequest Request = new SensorDataServerRequest(Id, this, e.From, e.From,
                                                                              Nodes, FieldTypes, Fields2, DateTime.MinValue, DateTime.MaxValue, DateTime.MinValue,
                                                                              ServiceToken, DeviceToken, UserToken);
                bool NewRequest;

                lock (this.requests)
                {
                    if (NewRequest = !this.requests.ContainsKey(Key))
                    {
                        this.requests[Key] = Request;
                    }
                }

                if (Request.When > Now)
                {
                    e.IqResult("<accepted xmlns='" + SensorClient.NamespaceSensorData + "' id='" + XML.Encode(Id) + "' queued='true'/>");
                    Request.When = this.scheduler.Add(Request.When, this.StartReadout, Request);
                }
                else
                {
                    e.IqResult("<accepted xmlns='" + SensorClient.NamespaceSensorData + "' id='" + XML.Encode(Id) + "'/>");
                    this.PerformReadout(Request);
                }
            }

            if (Nodes == null)
            {
                Nodes = new ThingReference[] { ThingReference.Empty }
            }
            ;

            lock (this.subscriptionsByThing)
            {
                Subscription = new Subscription(Id, e.From, Nodes, FieldNames, FieldTypes, MaxAge, MinInterval, MaxInterval,
                                                ServiceToken, DeviceToken, UserToken);

                foreach (ThingReference Thing in Nodes)
                {
                    if (!subscriptionsByThing.TryGetValue(Thing, out LinkedList <Subscription> Subscriptions))
                    {
                        Subscriptions = new LinkedList <Subscription>();
                        subscriptionsByThing[Thing] = Subscriptions;
                    }

                    LinkedListNode <Subscription> Next, Loop = Subscriptions.First;
                    while (Loop != null)
                    {
                        Next = Loop.Next;

                        if (Loop.Value.From == e.From)
                        {
                            if (Loop.Value.RemoveNode(Thing))
                            {
                                this.RemoveSubscriptionLocked(e.From, Loop.Value.Id, false);
                            }

                            Subscriptions.Remove(Loop);
                            break;
                        }

                        Loop = Next;
                    }

                    Subscriptions.AddLast(Subscription);
                }

                if (!subscriptionsByJID.TryGetValue(e.From, out Dictionary <string, Subscription> Subscriptions2))
                {
                    Subscriptions2             = new Dictionary <string, Subscription>();
                    subscriptionsByJID[e.From] = Subscriptions2;
                }

                Subscriptions2[Subscription.Id] = Subscription;
            }

            if (!Req)
            {
                e.IqResult("<accepted xmlns='" + SensorClient.NamespaceSensorData + "' id='" + XML.Encode(Id) + "'/>");
            }

            this.UpdateSubscriptionTimers(Now, Subscription);
        }
Ejemplo n.º 18
0
        private void ReturnForm(IqEventArgs e, ControlParameter[] Parameters, LinkedList <IThingReference> Nodes)
        {
            StringBuilder   Xml    = new StringBuilder();
            XmlWriter       Output = XmlWriter.Create(Xml, XML.WriterSettings(false, true));
            IThingReference FirstNode;

            Output.WriteStartElement("x", XmppClient.NamespaceData);
            Output.WriteAttributeString("xmlns", "xdv", null, XmppClient.NamespaceDataValidate);
            Output.WriteAttributeString("xmlns", "xdl", null, XmppClient.NamespaceDataLayout);
            Output.WriteAttributeString("xmlns", "xdd", null, XmppClient.NamespaceDynamicForms);

            if (Nodes is null)
            {
                FirstNode = null;
                Output.WriteElementString("title", this.client.BareJID);
            }
            else
            {
                FirstNode = Nodes.First.Value;

                if (Nodes.First.Next is null)
                {
                    Output.WriteElementString("title", Nodes.First.Value.NodeId);
                }
                else
                {
                    Output.WriteElementString("title", Nodes.Count.ToString() + " nodes");
                }
            }

            LinkedList <string> PagesInOrder = new LinkedList <string>();
            Dictionary <string, LinkedList <ControlParameter> > ParametersPerPage = new Dictionary <string, LinkedList <ControlParameter> >();

            foreach (ControlParameter P in Parameters)
            {
                if (!ParametersPerPage.TryGetValue(P.Page, out LinkedList <ControlParameter> List))
                {
                    PagesInOrder.AddLast(P.Page);
                    List = new LinkedList <ControlParameter>();
                    ParametersPerPage[P.Page] = List;
                }

                List.AddLast(P);
            }

            foreach (string Page in PagesInOrder)
            {
                Output.WriteStartElement("xdl", "page", null);
                Output.WriteAttributeString("label", Page);

                foreach (ControlParameter P in ParametersPerPage[Page])
                {
                    Output.WriteStartElement("xdl", "fieldref", null);
                    Output.WriteAttributeString("var", P.Name);
                    Output.WriteEndElement();
                }

                Output.WriteEndElement();
            }

            foreach (ControlParameter P in Parameters)
            {
                P.ExportToForm(Output, FirstNode);
            }

            Output.WriteEndElement();
            Output.Flush();

            e.IqResult(Xml.ToString());
        }
Ejemplo n.º 19
0
        private void PerformOperations(LinkedList <ControlOperation> Operations, IqEventArgs e, IEnumerable <IThingReference> Nodes,
                                       IEnumerable <string> ParameterNames)
        {
            foreach (ControlOperation Operation in Operations)
            {
                if (!Operation.Set())
                {
                    break;
                }
            }

            StringBuilder Xml = new StringBuilder();

            Xml.Append("<resp xmlns=\"");
            Xml.Append(ControlClient.NamespaceControl);

            if (Nodes != null || ParameterNames != null)
            {
                Xml.Append("\">");

                if (Nodes != null)
                {
                    foreach (IThingReference Node in Nodes)
                    {
                        Xml.Append("<nd id='");
                        Xml.Append(XML.Encode(Node.NodeId));

                        if (!string.IsNullOrEmpty(Node.SourceId))
                        {
                            Xml.Append("' src='");
                            Xml.Append(XML.Encode(Node.SourceId));
                        }

                        if (!string.IsNullOrEmpty(Node.Partition))
                        {
                            Xml.Append("' pt='");
                            Xml.Append(XML.Encode(Node.Partition));
                        }

                        Xml.Append("'/>");
                    }
                }

                if (ParameterNames != null)
                {
                    foreach (string ParameterName in ParameterNames)
                    {
                        Xml.Append("<p n='");
                        Xml.Append(XML.Encode(ParameterName));
                        Xml.Append("'/>");
                    }
                }

                Xml.Append("</resp>");
            }
            else
            {
                Xml.Append("\"/>");
            }

            e.IqResult(Xml.ToString());
        }
Ejemplo n.º 20
0
        private async void GetFormHandler(object Sender, IqEventArgs e)
        {
            try
            {
                LinkedList <ThingReference> Nodes = null;
                XmlElement E;

                foreach (XmlNode N in e.Query.ChildNodes)
                {
                    E = N as XmlElement;
                    if (E == null)
                    {
                        continue;
                    }

                    if (E.LocalName == "nd")
                    {
                        if (Nodes == null)
                        {
                            Nodes = new LinkedList <ThingReference>();
                        }

                        Nodes.AddLast(new ThingReference(
                                          XML.Attribute(E, "id"),
                                          XML.Attribute(E, "src"),
                                          XML.Attribute(E, "pt")));
                    }
                }

                ControlParameter[] Parameters;

                if (Nodes == null)
                {
                    Parameters = await this.GetControlParameters(null);

                    if (Parameters == null)
                    {
                        NotFound(e);
                        return;
                    }
                }
                else
                {
                    Dictionary <string, ControlParameter> Parameters1;
                    Dictionary <string, ControlParameter> Parameters2;
                    LinkedList <string> ToRemove = null;

                    Parameters  = null;
                    Parameters1 = null;

                    foreach (ThingReference Node in Nodes)
                    {
                        if (Parameters1 == null)
                        {
                            Parameters = await this.GetControlParameters(Node);

                            if (Parameters == null)
                            {
                                NotFound(e);
                                return;
                            }

                            Parameters1 = new Dictionary <string, ControlParameter>();

                            foreach (ControlParameter P in Parameters)
                            {
                                Parameters1[P.Name] = P;
                            }
                        }
                        else
                        {
                            Parameters2 = await this.GetControlParametersByName(Node);

                            if (Parameters2 == null)
                            {
                                NotFound(e);
                                return;
                            }

                            foreach (KeyValuePair <string, ControlParameter> P in Parameters1)
                            {
                                if (!Parameters2.TryGetValue(P.Key, out ControlParameter P2) || !P.Value.Equals(P2))
                                {
                                    if (ToRemove == null)
                                    {
                                        ToRemove = new LinkedList <string>();
                                    }

                                    ToRemove.AddLast(P.Key);
                                }
                            }

                            if (ToRemove != null)
                            {
                                foreach (string Key in ToRemove)
                                {
                                    Parameters1.Remove(Key);
                                }

                                ToRemove = null;
                            }
                        }
                    }

                    List <ControlParameter> Left = new List <ControlParameter>();

                    foreach (ControlParameter P in Parameters)
                    {
                        if (Parameters1.ContainsKey(P.Name))
                        {
                            Left.Add(P);
                        }
                    }

                    Parameters = Left.ToArray();
                }

                StringBuilder  Xml    = new StringBuilder();
                XmlWriter      Output = XmlWriter.Create(Xml, XML.WriterSettings(false, true));
                ThingReference FirstNode;

                Output.WriteStartElement("x", XmppClient.NamespaceData);
                Output.WriteAttributeString("xmlns", "xdv", null, XmppClient.NamespaceDataValidate);
                Output.WriteAttributeString("xmlns", "xdl", null, XmppClient.NamespaceDataLayout);
                Output.WriteAttributeString("xmlns", "xdd", null, XmppClient.NamespaceDynamicForms);

                if (Nodes == null)
                {
                    FirstNode = null;
                    Output.WriteElementString("title", this.client.BareJID);
                }
                else
                {
                    FirstNode = Nodes.First.Value;

                    if (Nodes.First.Next == null)
                    {
                        Output.WriteElementString("title", Nodes.First.Value.NodeId);
                    }
                    else
                    {
                        Output.WriteElementString("title", Nodes.Count.ToString() + " nodes");
                    }
                }

                LinkedList <string> PagesInOrder = new LinkedList <string>();
                Dictionary <string, LinkedList <ControlParameter> > ParametersPerPage = new Dictionary <string, LinkedList <ControlParameter> >();

                foreach (ControlParameter P in Parameters)
                {
                    if (!ParametersPerPage.TryGetValue(P.Page, out LinkedList <ControlParameter> List))
                    {
                        PagesInOrder.AddLast(P.Page);
                        List = new LinkedList <ControlParameter>();
                        ParametersPerPage[P.Page] = List;
                    }

                    List.AddLast(P);
                }

                foreach (string Page in PagesInOrder)
                {
                    Output.WriteStartElement("xdl", "page", null);
                    Output.WriteAttributeString("label", Page);

                    foreach (ControlParameter P in ParametersPerPage[Page])
                    {
                        Output.WriteStartElement("xdl", "fieldref", null);
                        Output.WriteAttributeString("var", P.Name);
                        Output.WriteEndElement();
                    }

                    Output.WriteEndElement();
                }

                foreach (ControlParameter P in Parameters)
                {
                    P.ExportToForm(Output, FirstNode);
                }

                Output.WriteEndElement();
                Output.Flush();

                e.IqResult(Xml.ToString());
            }
            catch (Exception ex)
            {
                e.IqError(ex);
            }
        }
Ejemplo n.º 21
0
 private async Task QueryVCardHandler(object Sender, IqEventArgs e)
 {
     e.IqResult(await this.GetVCardXml());
 }