agsXMPP.IqGrabber.SendIq C# (CSharp) Method

SendIq() public method

Sends an Iq synchronous and return the response or null on timeout. Timeout time used is SynchronousTimeout
public SendIq ( agsXMPP.protocol.client.IQ iq ) : agsXMPP.protocol.client.IQ
iq agsXMPP.protocol.client.IQ The IQ to send
return agsXMPP.protocol.client.IQ
        public IQ SendIq(IQ iq)
        {
            return SendIq(iq, m_SynchronousTimeout);
        }

Same methods

IqGrabber::SendIq ( agsXMPP.protocol.client.IQ iq, int timeout ) : agsXMPP.protocol.client.IQ
IqGrabber::SendIq ( agsXMPP.protocol.client.IQ iq, IqCB cb, object cbArg ) : void

Usage Example

Ejemplo n.º 1
0
        /// <summary>
        /// Send message to HarmonyHub to request Configuration.
        /// Result is parsed by OnIq based on ClientCommandType
        /// </summary>
        public void GetConfig()
        {
            EnsureConnection();

            var iqToSend = new IQ { Type = IqType.get, Namespace = "", From = "1", To = "guest" };
            iqToSend.AddChild(HarmonyDocuments.ConfigDocument());
            iqToSend.GenerateId();

            var iqGrabber = new IqGrabber(Xmpp);
            var iq = iqGrabber.SendIq(iqToSend, 10000);

            if (iq != null)
            {
                var match = IdentityRegex.Match(iq.InnerXml);
                if (match.Success)
                {
                    RawConfig = match.Groups[1].ToString();
                    Config = null;
                    try
                    {
                        Config = new JavaScriptSerializer().Deserialize<HarmonyConfigResult>(RawConfig);
                    }
                    catch { }
                }
            }
        }
All Usage Examples Of agsXMPP.IqGrabber::SendIq