KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > mail > mailchecking > POP3MailCheckingAction


1 //The contents of this file are subject to the Mozilla Public License Version 1.1
2
//(the "License"); you may not use this file except in compliance with the
3
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
4
//
5
//Software distributed under the License is distributed on an "AS IS" basis,
6
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
7
//for the specific language governing rights and
8
//limitations under the License.
9
//
10
//The Original Code is "The Columba Project"
11
//
12
//The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
13
//Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
14
//
15
//All Rights Reserved.
16
package org.columba.mail.mailchecking;
17
18 import org.columba.core.command.CommandProcessor;
19 import org.columba.mail.command.POP3CommandReference;
20 import org.columba.mail.config.AccountItem;
21 import org.columba.mail.pop3.POP3Server;
22 import org.columba.mail.pop3.POP3ServerCollection;
23 import org.columba.mail.pop3.command.FetchNewMessagesCommand;
24
25
26 /**
27  * POP3 mail-checking item.
28  *
29  * @author fdietz
30  */

31 public class POP3MailCheckingAction extends AbstractMailCheckingAction {
32     private int accountUid;
33
34     /**
35  * Constructor
36  *
37  * @param item account item
38  */

39     public POP3MailCheckingAction(AccountItem accountItem) {
40         super(accountItem);
41
42         // account ID
43
accountUid = accountItem.getUid();
44     }
45
46     /**
47  * @see org.columba.mail.mailchecking.AbstractMailCheckingAction#check()
48  */

49     public void check() {
50         POP3Server controller = POP3ServerCollection.getInstance().uidGet(accountUid);
51         
52         setEnabled( false );
53         
54         POP3CommandReference r = new POP3CommandReference(controller);
55
56         FetchNewMessagesCommand c = new FetchNewMessagesCommand(this, r);
57
58         CommandProcessor.getInstance().addOp(c);
59     }
60     /**
61      * @see org.columba.mail.mailchecking.AbstractMailCheckingAction#isCheckAll()
62      */

63     public boolean isCheckAll() {
64         POP3Server controller = POP3ServerCollection.getInstance().uidGet(accountUid);
65
66         return !controller.getAccountItem().getPopItem()
67         .getBooleanWithDefault("exclude_from_checkall",
68                 false);
69     }
70 }
71
Popular Tags