/// <summary> /// Removes the RosterItem from the roster with the given Jid /// </summary> /// <param name="jid">The jid.</param> /// <returns>true when removed, false when the item did not exists and could not be removed.</returns> public bool RemoveRosterItem(Jid jid) { var bjc = new BareJidComparer(); var item = GetRoster().FirstOrDefault(r => r.Jid.Equals(jid, bjc)); if (item != null) { item.Remove(); return(true); } return(false); }
public RosterItem this [Jid jid] { get { var items = GetRoster(); if (items != null) { var bjc = new BareJidComparer(); return(items.FirstOrDefault(r => r.Jid.Equals(jid, bjc))); } return(null); } }
/// <summary> /// Does the Roster contain an RosterItem with the given Jid? /// </summary> /// <param name="jid"></param> /// <returns></returns> public bool ContainsRosterItem(Jid jid) { var items = GetRoster(); if (items == null) { return(false); } if (!items.Any()) { return(false); } var bjc = new BareJidComparer(); return(items.Any(r => r.Jid.Equals(jid, bjc))); }