public void Disconnect(User user) { Connection.CurrentGroup.RemoveUser(user); OnUserDisconnect(user); PresentationController.UserDisconneced(user); if (Connection.CurrentPresentation != null && Connection.CurrentPresentation.Author.CompareTo(user.Username) == 0) { ClPresentationEnd(); } foreach (User u in users.Keys) { if (u.Username == user.Username) { lock (syncObj) { this.users.Remove(u); foreach (User key in users.Keys) { ISharePCallback callback = users[key]; try { callback.RefreshUsers(Connection.CurrentGroup.userList); callback.UserLeave(user); } catch { usersToRemove.Add(key); } } RemoveUsers(); } return; } } }
public void BanUser(string username) { lock (syncObj) { foreach (User key in users.Keys) { if (key.Username.CompareTo(username) == 0) { Log.LogInfo("Banning user: " + username); ISharePCallback callback = users[key]; try { callback.BanUser(); } catch { usersToRemove.Add(key); } usersInBan.Add(key); Connection.CurrentGroup.RemoveUser(key); PresentationController.UserDisconneced(key); foreach (User u in users.Keys) { ISharePCallback cb = users[u]; try { cb.RefreshUsers(Connection.CurrentGroup.userList); cb.UserLeave(u); } catch { usersToRemove.Add(u); } } if (Connection.CurrentPresentation != null && Connection.CurrentPresentation.Author.CompareTo(key.Username) == 0) { ClPresentationEnd(); } break; } } RemoveUsers(); } }