internal XmppPing() { /* * Client pings a server * * <iq to='capulet.lit' id='c2s1' type='get'> * <ping xmlns='urn:xmpp:ping'/> * </iq> */ PingIq piq = new PingIq(new agsXMPP.Jid("capulet.lit")); piq.Type = agsXMPP.protocol.client.IqType.get; piq.Id = "c2s1"; Program.Print(piq); // Send ping with autogenerated id PingIq piq2 = new PingIq(new agsXMPP.Jid("capulet.lit")); piq2.Type = agsXMPP.protocol.client.IqType.get; Program.Print(piq2); }
private static void OnIq(object sender, IQ iq) { try { if (iq.Query == null) return; if (iq.Type != IqType.get) return; if (iq.Query.GetType() == typeof(agsXMPP.protocol.iq.version.Version)) { VersionIq _iq = new VersionIq(); _iq.To = iq.From; _iq.Id = iq.Id; _iq.Type = IqType.result; _iq.Query.Name = ""; _iq.Query.Ver = ""; _iq.Query.Os = ""; _mCon.Send(_iq); } else if (iq.Query.GetType() == typeof(Time)) { TimeIq _iq = new TimeIq(); _iq.To = iq.From; _iq.Id = iq.Id; _iq.Type = IqType.result; _iq.Query.Tz = Common.Now.ToString(); _mCon.Send(_iq); } else if (iq.Query.GetType() == typeof(Ping)) { PingIq _iq = new PingIq(); _iq.To = iq.From; _iq.Id = iq.Id; _iq.Type = IqType.result; _mCon.Send(_iq); } } catch (Exception e) { LogManager.GetLogger("Debug").Error(e.Message); } }