private void Xmpp_OnRosterItem(object sender, RosterItem item) { if (!Friends.ContainsKey(item.Jid.User)) { Friends.Add(item.Jid.User, new ChatFriend(item)); } }
public void RemoveFriend(int id) { if (Friends.ContainsKey(id)) { Friends.Remove(id); } }
public void AddFriend(int id, MessengerFriend friend) { if (!Friends.ContainsKey(id)) { Friends.Add(id, friend); } }
private void Xmpp_OnMessage(object sender, Message msg) { if (Friends.ContainsKey(msg.From.User) && !msg.From.User.Equals(msg.To.User)) { Friends[msg.From.User].ReceiveMessage(msg.Body); } else { } MessageReceived?.Invoke(this, msg); }
private void Xmpp_OnPresence(object sender, Presence pres) { if (Friends.ContainsKey(pres.From.User)) { Friends[pres.From.User].UpdatePresence(pres); OnFriendListChanged(false); } else if (!pres.From.User.Equals(xmpp.MyJID.User)) { } PresenceRecieved?.Invoke(this, pres); }
public bool IsFriends(int userTwoId) => Friends.ContainsKey(userTwoId);
public bool IsFriend(User user) => Friends.ContainsKey(user.Id);