private User addJabberUserToUserModelOrUpdateInfo(RosterEntry rosterEntry) { // System.out.println("rosterEntry.getName() = " + rosterEntry.getName()); // System.out.println("rosterEntry.getUser() = " + rosterEntry.getUser()); User user = myUserModel.createUser(getSimpleId(rosterEntry.getUser()), getName()); String newGroup = getUserGroup(rosterEntry); if (newGroup != null) { user.setGroup(newGroup, myUserModel); } user.setDisplayName(rosterEntry.getName(), myUserModel); myUserModel.addUser(user); String jabberId = getCurrentJabberID(user, rosterEntry); updateIsIDEtalkClient(jabberId, user); return user; }
private void updateJabberUsers(boolean removeUsersNotInRoster) { LOG.debug("Roster changed - update user model"); Set<User> currentUsers = new HashSet<>(Arrays.asList(myUserModel.getAllUsers())); for (RosterEntry rosterEntry : getRoster().getEntries()) { User user = addJabberUserToUserModelOrUpdateInfo(rosterEntry); currentUsers.remove(user); } if (removeUsersNotInRoster) { removeUsers(currentUsers); } if (LOG.isDebugEnabled()) { LOG.debug("Roster synchronized: " + Arrays.asList(myUserModel.getAllUsers())); } }
private boolean hasJabberContacts() { User[] users = myUserModel.getAllUsers(); for (User user : users) { if (user.getTransportCode().equals(getName())) return true; } return false; }
private void updateUserPresence(String jabberId) { LOG.debug("Presence changed for " + jabberId); final User user = myUserModel.findUser(getSimpleId(jabberId), getName()); if (user != null) { updateIsIDEtalkClient(jabberId, user); final UserPresence presence = _getUserPresence(user); IDEtalkEvent event = createPresenceChangeEvent(user, presence); if (event != null) { getBroadcaster().doChange(event, () -> myUser2Presence.put(user, presence)); } } }
private User self() { return myUserModel.createUser(myFacade.getMyAccount().getJabberId(), getName()); }
boolean isUserInMyContactListAndActive(String userName) { User user = myUserModel.findUser(getSimpleId(userName), getName()); return user != null && user.isOnline(); }
private void removeUsers(Set<User> currentUsers) { for (User user : currentUsers) { myUserModel.removeUser(user); } }
private EventBroadcaster getBroadcaster() { return myUserModel.getBroadcaster(); }