public DiscoHandler(ICaps caps, ICaps clientCaps) { Handle( el => el.OfType <Iq>() && el.Cast <Iq>().Type == IqType.Get && el.Cast <Iq>().Query.OfType <Info>(), async(context, xmppXElement) => { var iq = xmppXElement.Cast <Iq>(); var info = xmppXElement.Cast <Iq>().Query.Cast <Info>(); if (info.Node == null || info.Node == caps.Node + "#" + clientCaps.CapsHash) { var resIq = new Iq() { Id = iq.Id, To = iq.From, Type = IqType.Result }; resIq.Add(clientCaps.DiscoInfo); await SendAsync(resIq); } else { var dIq = new DiscoInfoIq { Type = IqType.Error, To = iq.From, Id = iq.Id, Info = { Node = info.Node }, Error = new Error(Matrix.Xmpp.Base.ErrorCondition.ItemNotFound) }; await SendAsync(dIq); } }); }
public PresenceManager(XmppClientEx xmppClient, ICaps clientCaps, IMapper mapper) { this.clientCaps = clientCaps; this.xmppClient = xmppClient; this.mapper = mapper; }