Examples of AddressList


Examples of org.apache.james.mime4j.dom.address.AddressList

     *
     * @param headerValue
     * @return mailbox
     */
    public static String getMailboxAddress(String headerValue) {
        AddressList aList = LenientAddressBuilder.DEFAULT.parseAddressList(headerValue);
        for (int i = 0; i < aList.size(); i++) {
            Address address = aList.get(i);
            if (address instanceof Mailbox) {
                Mailbox m = (Mailbox) address;
                String mailboxName = m.getLocalPart();
                if (mailboxName == null) {
                    mailboxName = "";
View Full Code Here

Examples of org.apache.james.mime4j.dom.address.AddressList

                if (address != null) {
                    addresses.add(address);
                }
            }
        }
        return new AddressList(addresses, false);
    }
View Full Code Here

Examples of org.apache.james.mime4j.dom.address.AddressList

    private void processAddressList(ParsedField field, String addressListType,
            String metadataField) throws MimeException {
        AddressListField toField = (AddressListField) field;
        if (toField.isValidField()) {
            AddressList addressList = toField.getAddressList();
            for (int i = 0; i < addressList.size(); ++i) {
                metadata.add(metadataField, getDisplayString(addressList.get(i)));
            }
        } else {
            String to = stripOutFieldPrefix(field,
                    addressListType);
            for (String eachTo : to.split(",")) {
View Full Code Here

Examples of org.apache.james.mime4j.dom.address.AddressList

                        // Check if we can index the the address in the right manner
                        if (field != null) {
                                // not sure if we really should reparse it. It maybe be better to check just for the right type.
                                // But this impl was easier in the first place
                                AddressList aList = LenientAddressBuilder.DEFAULT.parseAddressList(MimeUtil.unfold(f.getBody()));
                                for (int i = 0; i < aList.size(); i++) {
                                    Address address = aList.get(i);
                                    if (address instanceof org.apache.james.mime4j.dom.address.Mailbox) {
                                        org.apache.james.mime4j.dom.address.Mailbox mailbox = (org.apache.james.mime4j.dom.address.Mailbox) address;
                                        String value = AddressFormatter.DEFAULT.encode(mailbox).toUpperCase(Locale.ENGLISH);
                                        doc.add(new Field(field, value, Store.NO, Index.ANALYZED));
                                        if (i == 0) {
View Full Code Here

Examples of org.apache.james.mime4j.field.address.AddressList

                        // Check if we can index the the address in the right manner
                        if (field != null) {
                            try {
                                // not sure if we really should reparse it. It maybe be better to check just for the right type.
                                // But this impl was easier in the first place
                                AddressList aList = AddressList.parse(MimeUtil.unfold(f.getBody()));
                                for (int i = 0; i < aList.size(); i++) {
                                    Address address = aList.get(i);
                                    if (address instanceof org.apache.james.mime4j.field.address.Mailbox) {
                                        org.apache.james.mime4j.field.address.Mailbox mailbox = (org.apache.james.mime4j.field.address.Mailbox) address;
                                        String value = mailbox.getEncodedString().toUpperCase(Locale.ENGLISH);
                                        doc.add(new Field(field, value, Store.NO, Index.ANALYZED));
                                        if (i == 0) {
View Full Code Here

Examples of org.apache.james.mime4j.field.address.AddressList

     * @param headerValue
     * @return display
     */
    public static String getDisplayAddress(String headerValue) {
        try {
            AddressList addressList = AddressList.parse(MimeUtil.unfold(headerValue));
            if (addressList != null && addressList.isEmpty() == false) {
                Address address = addressList.get(0);
                if (address instanceof Mailbox) {
                    return getDisplayAddress((Mailbox) address);
                } else if (address instanceof Group) {
                    Group group = (Group) address;
                    if (group != null) {
View Full Code Here

Examples of org.apache.james.mime4j.field.address.AddressList

     * @param headerValue
     * @return mailbox
     */
    public static String getMailboxAddress(String headerValue) {
        try {
            AddressList aList = AddressList.parse(headerValue);
            for (int i = 0; i < aList.size(); i++) {
                Address address = aList.get(i);
                if (address instanceof Mailbox) {
                    Mailbox m = (Mailbox) address;
                    String mailboxName = m.getLocalPart();
                    if (mailboxName == null) {
                        mailboxName ="";
View Full Code Here

Examples of org.apache.james.mime4j.field.address.AddressList

        for (Header header:headers) {
            final String name = header.getName();
            if (headerName.equalsIgnoreCase(name)) {
                final String value = header.getValue();
                try {
                    AddressList aList = AddressList.parse(value);
                    for (int i = 0; i < aList.size(); i++) {
                        Address address = aList.get(i);
                        if (address instanceof Mailbox) {
                            if (((Mailbox) address).getEncodedString().toUpperCase(Locale.ENGLISH).contains(text)) {
                                return true;
                            }
                        } else if (address instanceof Group) {
View Full Code Here

Examples of org.apache.james.mime4j.field.address.AddressList

    public static class Parser implements FieldParser {
        private static Log log = LogFactory.getLog(Parser.class);

        public Field parse(final String name, final String body, final String raw) {
            AddressList addressList = null;
            ParseException parseException = null;
            try {
                addressList = AddressList.parse(body);
            }
            catch (ParseException e) {
View Full Code Here

Examples of org.apache.james.mime4j.field.address.AddressList

            if ("".equals(value.trim())) {
                results = null;
            } else {

                try {
                    AddressList addressList = AddressList.parse(value);
                    final int size = addressList.size();
                    final List<FetchResponse.Envelope.Address> addresses = new ArrayList<FetchResponse.Envelope.Address>(size);
                    for (int i = 0; i < size; i++) {
                        final Address address = addressList.get(i);
                        if (address instanceof Group) {
                            final Group group = (Group) address;
                            addAddresses(group, addresses);

                        } else if (address instanceof org.apache.james.mime4j.field.address.Mailbox) {
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.