public SPFSession()

in resolver/src/main/java/org/apache/james/jspf/core/SPFSession.java [88:122]


    public SPFSession(String mailFrom, String heloDomain, String clientIP) {
        super();
        this.mailFrom = mailFrom.trim();
        this.hostName = heloDomain.trim();
       
        try {
            this.ipAddress = IPAddr.getProperIpAddress(clientIP.trim());
            // get the in Address
            this.inAddress = IPAddr.getInAddress(clientIP);
        } catch (PermErrorException e) {
            // ip was not rfc conform
            this.setCurrentResultExpanded(e.getResult());
        }

        // if nullsender is used postmaster@helo will be used as email
        if (mailFrom.equals("")) {
            this.currentSenderPart = "postmaster";
            this.senderDomain = hostName;
            this.mailFrom = currentSenderPart + "@" + hostName;
        } else {
            String[] fromParts = mailFrom.split("@");
            // What to do when mailFrom is "@example.com" ?
            if (fromParts.length > 1) {
                this.senderDomain = fromParts[fromParts.length -1];
                this.currentSenderPart = mailFrom.substring(0, mailFrom.length() - senderDomain.length() - 1);
                if (this.currentSenderPart.length() == 0) {
                    this.currentSenderPart = "postmaster";
                }
            } else {
                this.currentSenderPart = "postmaster";
                this.senderDomain = mailFrom;
            }
        }
        this.currentDomain = this.senderDomain;
    }