01: //The contents of this file are subject to the Mozilla Public License Version 1.1
02: //(the "License"); you may not use this file except in compliance with the
03: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
04: //
05: //Software distributed under the License is distributed on an "AS IS" basis,
06: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
07: //for the specific language governing rights and
08: //limitations under the License.
09: //
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: * POP3 mail-checking item.
27: *
28: * @author fdietz
29: */
30: public class POP3MailCheckingAction extends AbstractMailCheckingAction {
31: private int accountUid;
32:
33: /**
34: * Constructor
35: *
36: * @param item account item
37: */
38: public POP3MailCheckingAction(AccountItem accountItem) {
39: super (accountItem);
40:
41: // account ID
42: accountUid = accountItem.getUid();
43: }
44:
45: /**
46: * @see org.columba.mail.mailchecking.AbstractMailCheckingAction#check()
47: */
48: public void check() {
49: POP3Server controller = POP3ServerCollection.getInstance()
50: .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: /**
62: * @see org.columba.mail.mailchecking.AbstractMailCheckingAction#isCheckAll()
63: */
64: public boolean isCheckAll() {
65: POP3Server controller = POP3ServerCollection.getInstance()
66: .uidGet(accountUid);
67:
68: return !controller.getAccountItem().getPopItem()
69: .getBooleanWithDefault("exclude_from_checkall", false);
70: }
71: }
|