Examples of JamesUser


Examples of org.apache.james.services.JamesUser

        return false;
    }

    public String checkAlias(String username)
            throws RemoteException {
        JamesUser user = (JamesUser)users.getUserByName(username);
        if (user == null) {
            getLogger().error("No such user " + username + " found!");
            throw new RemoteException("No such user " + username + " found!");
        }
        if (user.getAliasing()) {
            String alias = user.getAlias();
            getLogger().info("Alias is set to " + alias + " for user " + username);
            return alias;
        }
        getLogger().info("No alias is set for this user " + username);
        return null;
View Full Code Here

Examples of org.apache.james.services.JamesUser


    public boolean setForward(String username,
                              String forward)
            throws RemoteException {
        JamesUser user = (JamesUser)users.getUserByName(username);
        if (user == null) {
            getLogger().error("No such user " + username + " found!");
            throw new RemoteException("No such user " + username + " found!");
        }
        MailAddress forwardAddress;
        try {
            forwardAddress = new MailAddress(forward);
        } catch (ParseException pe) {
            getLogger().error("Parse exception with that email address: " + pe.getMessage());
            throw new RemoteException("Parse exception with that email address: " + pe.getMessage());
        }
        if (user.setForwardingDestination(forwardAddress)) {
            user.setForwarding(true);
            users.updateUser(user);
            getLogger().info("Forwarding destination for " + username + " set to: " + forwardAddress.toString());
            return true;
        }
        getLogger().error("Error setting forward for user " + username);
View Full Code Here

Examples of org.apache.james.services.JamesUser

        return false;
    }

    public boolean unsetForward(String username)
            throws RemoteException {
        JamesUser user = (JamesUser)users.getUserByName(username);
        if (user == null) {
            getLogger().error("No such user " + username + " found!");
            throw new RemoteException("No such user " + username + " found!");
        }
        if (user.getForwarding()) {
            user.setForwarding(false);
            users.updateUser(user);
            getLogger().info("Forward for user " + username + " unset.");
            return true;
        }
        getLogger().info("Forwarding not active for user " + username);
View Full Code Here

Examples of org.apache.james.services.JamesUser

        return false;
    }

    public String checkForward(String username)
            throws RemoteException {
        JamesUser user = (JamesUser)users.getUserByName(username);
        if (user == null) {
            getLogger().error("No such user " + username + " found!");
            throw new RemoteException("No such user " + username + " found!");
        }
        if (user.getForwarding()) {
            String forward = user.getForwardingDestination().toString();
            getLogger().info("Forward is set to " + forward + " for user " + username);
            return forward;
        }
        getLogger().info("No forward set for user " + username);
        return null;
View Full Code Here

Examples of org.apache.james.services.JamesUser

            }
        }
        else {
            username = recipient.getUser();
        }
        JamesUser user;
        if ( enableAliases || enableForwarding ) {
            user = ( JamesUser ) localusers.getUserByName( username );
            if ( enableAliases && user.getAliasing() ) {
                username = user.getAlias();
            }
            // Forwarding takes precedence over local aliases
            if ( enableForwarding && user.getForwarding() ) {
                MailAddress forwardTo = user.getForwardingDestination();
                if ( forwardTo == null ) {
                    StringBuffer errorBuffer =
                            new StringBuffer( 128 )
                            .append( "Forwarding was enabled for " )
                            .append( username )
View Full Code Here

Examples of org.apache.james.services.JamesUser

     */
    protected String getPrimaryName(String originalUsername) {
        String username;
        try {
            username = localusers.getRealName(originalUsername);
            JamesUser user = (JamesUser) localusers.getUserByName(username);
            if (user.getAliasing()) {
                username = user.getAlias();
            }
        }
        catch (Exception e) {
            username = originalUsername;
        }
View Full Code Here

Examples of org.apache.james.services.JamesUser

        if (! (baseuser instanceof JamesUser ) ) {
            writeLoggedFlushedResponse("Can't set alias for this user type.");
            return true;
        }
       
        JamesUser user = (JamesUser) baseuser;
        JamesUser aliasUser = (JamesUser) users.getUserByName(alias);
        if (aliasUser == null) {
            writeLoggedFlushedResponse("Alias unknown to server - create that user first.");
            return true;
        }
View Full Code Here

Examples of org.apache.james.services.JamesUser

            return true;
        } else if (! (baseuser instanceof JamesUser ) ) {
            writeLoggedFlushedResponse("Can't set forwarding for this user type.");
            return true;
        }
        JamesUser user = (JamesUser)baseuser;
        // Verify acceptable email address
        MailAddress forwardAddr;
        try {
             forwardAddr = new MailAddress(forward);
        } catch(ParseException pe) {
            writeLoggedResponse("Parse exception with that email address: " + pe.getMessage());
            writeLoggedFlushedResponse("Forwarding address not added for " + username);
            return true;
        }

        boolean success = user.setForwardingDestination(forwardAddr);
        if (success) {
            user.setForwarding(true);
            users.updateUser(user);
            StringBuffer responseBuffer =
                new StringBuffer(64)
                        .append("Forwarding destination for ")
                        .append(username)
View Full Code Here

Examples of org.apache.james.services.JamesUser

        } else if (! (baseuser instanceof JamesUser ) ) {
            writeLoggedFlushedResponse("Can't show aliases for this user type.");
            return true;
        }

        JamesUser user = (JamesUser)baseuser;
        if ( user == null ) {
            writeLoggedFlushedResponse("No such user " + username);
            return true;
        }

        if ( !user.getAliasing() ) {
            writeLoggedFlushedResponse("User " + username + " does not currently have an alias");
            return true;
        }

        String alias = user.getAlias();

        if ( alias == null || alias.equals("") ) {    //  defensive programming -- neither should occur
            String errmsg = "For user " + username + ", the system indicates that aliasing is set but no alias was found";
            out.println(errmsg);
            getLogger().error(errmsg);
View Full Code Here

Examples of org.apache.james.services.JamesUser

            return true;
        } else if (! (baseuser instanceof JamesUser ) ) {
            writeLoggedFlushedResponse("Can't set forwarding for this user type.");
            return true;
        }
        JamesUser user = (JamesUser)baseuser;
        if ( user == null ) {
            writeLoggedFlushedResponse("No such user " + username);
            return true;
        }

        if ( !user.getForwarding() ) {
            writeLoggedFlushedResponse("User " + username + " is not currently being forwarded");
            return true;
        }

        MailAddress fwdAddr = user.getForwardingDestination();

        if ( fwdAddr == null ) {    //  defensive programming -- should not occur
            String errmsg = "For user " + username + ", the system indicates that forwarding is set but no forwarding destination was found";
            out.println(errmsg);
            getLogger().error(errmsg);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.