/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 2 -*- * * The contents of this file are subject to the Mozilla Public License * Version 1.0 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See * the License for the specific language governing rights and limitations * under the License. * * The Original Code is the Grendel mail/news client. * * The Initial Developer of the Original Code is Netscape Communications * Corporation. Portions created by Netscape are Copyright (C) 1997 * Netscape Communications Corporation. All Rights Reserved. * * Created: Eric Bina , 30 Oct 1997. */ package grendel.storage.addressparser; import java.io.*; import java.util.*; /** * A subclass of RFC822AddressList. Its purpose is to create * a more human readable list of all the addresses of this address list. * To that end it flattens RFC822 groups in place into mailbox lists. * It also attempts to save those occasions when name information * is stored in a comment with an addr-spec instead of being put into * the more complete form of (phrase route-addr). * * @see RFC822AddressList * @author Eric Bina */ public class RFC822MailboxList extends RFC822AddressList { private Vector mailbox_list; private RFC822Mailbox mailboxes[]; public RFC822MailboxList(String str) { super(str); if (this.parser != null) { createMailboxList(); createMailboxArray(); } } /** * @return An array of RFC822Mailbox objects. * Methods on the object are used to get strings * to display. * * @see RFC822Mailbox */ public RFC822Mailbox[] getMailboxArray() { return(this.mailboxes); } /* * Size of the mailbox list. */ public int mailboxCount() { if (this.mailbox_list == null) { return(0); } else { return(this.mailbox_list.size()); } } /*********************** *********************** ** PRIVATE METHODS ** *********************** ***********************/ /* * Make an array of standalone RFC822Mailbox objects * which contain all the needed string data. */ private void createMailboxArray() { int cnt = this.mailbox_list.size(); this.mailboxes = new RFC822Mailbox[cnt]; for (int i=0; i= parser_tokens.size()) { return(false); } token = (RFC822Token)parser_tokens.elementAt(indx); if ((token.isSpecialChar(',') == true)||(token.isSpecialChar(';') == true)) { return(true); } return(false); } /* * Is the index passed into the main token list a comment token? */ private boolean isComment(int indx) { RFC822Token token; if (indx >= this.all_tokens.size()) { return(false); } token = (RFC822Token)this.all_tokens.elementAt(indx); if (token.getType() == RFC822Token.COMMENT) { return(true); } return(false); } }