コード例 #1
0
 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;
 }
コード例 #2
0
  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()));
    }
  }
コード例 #3
0
 private boolean hasJabberContacts() {
   User[] users = myUserModel.getAllUsers();
   for (User user : users) {
     if (user.getTransportCode().equals(getName())) return true;
   }
   return false;
 }
コード例 #4
0
  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));
      }
    }
  }
コード例 #5
0
 private User self() {
   return myUserModel.createUser(myFacade.getMyAccount().getJabberId(), getName());
 }
コード例 #6
0
 boolean isUserInMyContactListAndActive(String userName) {
   User user = myUserModel.findUser(getSimpleId(userName), getName());
   return user != null && user.isOnline();
 }
コード例 #7
0
 private void removeUsers(Set<User> currentUsers) {
   for (User user : currentUsers) {
     myUserModel.removeUser(user);
   }
 }
コード例 #8
0
 private EventBroadcaster getBroadcaster() {
   return myUserModel.getBroadcaster();
 }