/**
  * Copy to groups.
  *
  * @param currentUser the current user
  * @param newUser the new user
  */
 private static void copyToGroups(String currentUser, String newUser) {
   GroupManager groupManager = GroupManager.getInstance();
   for (Group group : groupManager.getGroups()) {
     if (group.isUser(currentUser)) {
       group.getMembers().add(XMPPServer.getInstance().createJID(newUser, null));
     }
   }
 }
 public void addUserToGroup(String userJid, String groupName) throws GroupNotFoundException {
   log.debug("addUserToGroup " + userJid + " GroupName " + groupName);
   JID jid = new JID(userJid);
   Group group = groupManager.getGroup(groupName, true);
   if (group.getAdmins().contains(jid)) {
     log.debug("Admins already has " + jid);
   } else {
     group.getMembers().add(jid);
   }
 }
 public void removeUserFromGroup(String userJid, String groupName) throws GroupNotFoundException {
   JID jid = new JID(userJid);
   Group group = groupManager.getGroup(groupName, true);
   group.getMembers().remove(jid);
   group.getAdmins().remove(jid);
 }