internal RosterItem(JId jid, string name, RosterItemSubscriptionType subscriptionType) { JId = jid; Name = name; SubscriptionType = subscriptionType; Groups = new List<string>(); }
public void Add(JId jid, string name, string[] groups) { if (jid == JId) { throw new InvalidOperationException("You cannot add yourself to your roster"); } if (_items.ContainsKey(jid)) { return; //TODO what should happen here? Exception? } var content = new XElement(XName.Get("item",Namespace) , new XAttribute("jid", jid), new XAttribute("name", name)); if(groups != null && groups.Length > 0) { foreach (string group in groups) { content.Add(new XElement(XName.Get("group", Namespace), group)); } } SendIQ(new IQRequest("query", new []{ content }, IQRequestType.Set, null)); }
protected DirectedStanza(JId from, JId to, string id) { From = from; To = to; }
internal static PresenceStanza CreateInitial(JId jid, string id) { return CreateBroadcastGeneral(jid, id, PresenceAvailabilityStatus.None); }
internal static PresenceStanza CreateCancelSubscription(JId to, string id) { return new PresenceStanza(null, to, id, PresenceType.Unsubscribed, PresenceAvailabilityStatus.None, string.Empty); }
internal static PresenceStanza CreateBroadcastUnavilable(JId from, string id) { return new PresenceStanza(from, null, id, PresenceType.Unavailable, PresenceAvailabilityStatus.None, string.Empty); }
internal static PresenceStanza CreateBroadcastGeneral(JId from,string id, PresenceAvailabilityStatus presenceAvailabilityStatus, string detailedStatus) { return new PresenceStanza(from, null, id, PresenceType.None, presenceAvailabilityStatus, detailedStatus); }
private PresenceStanza(JId from, JId to, string id, PresenceType presenceType, PresenceAvailabilityStatus presenceAvailabilityStatus, string detailStatus) : base(from, to, id) { this.presenceType = presenceType; this.presenceAvailabilityStatus = presenceAvailabilityStatus; }
private IQResponse(JId from, JId to, string innerElementLocalName, XElement[] content, IQResponseType requestType, Error error) : base(to, innerElementLocalName, content) { From = from; ResponseType = requestType; Error = error; }
internal IQResponse(JId from, JId to, Error error) : this(from, to, null, null, IQResponseType.Error, error) { }
internal IQResponse(JId from, JId to, string innerElementLocalName, XElement[] content) : this(from, to, innerElementLocalName, content, IQResponseType.Result, null) { }
internal IQRequest(JId to, string innerElementLocalName, XElement[] content, IQRequestType requestType, Action<IQResponse> responseCallback) : base(to, innerElementLocalName, content) { RequestType = requestType; ResponseCallback = responseCallback; }
protected IQ(JId to, string innerElementLocalName, XElement[] content) { To = to; InnerElementLocalName = innerElementLocalName; Content = content; }
internal ClientInitialStream(JId to, Version version) { To = to; Version = version; }
internal MessageStanza(JId from, JId to, string id, string body) : base(from, to, id) { this.body = body; }