1 /*
2 * Copyright (c) 2004-2007 Creative Sphere Limited.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 *
10 * Creative Sphere - initial API and implementation
11 *
12 */
13 package org.abstracthorizon.mercury.imap.cmd;
14
15 import java.io.IOException;
16 import org.abstracthorizon.mercury.common.command.CommandException;
17 import org.abstracthorizon.mercury.imap.IMAPSession;
18 import org.abstracthorizon.mercury.imap.response.ByeResponse;
19 import org.abstracthorizon.mercury.imap.util.ParserException;
20
21 /**
22 * Logout IMAP command
23 *
24 * @author Daniel Sendula
25 */
26 public class Logout extends IMAPCommand {
27
28 /**
29 * Constructor
30 * @param mnemonic mnemonic
31 */
32 public Logout(String mnemonic) {
33 super(mnemonic);
34 }
35
36 /**
37 * Executes the command
38 * @param session
39 * @throws ParserException
40 * @throws MessagingException
41 * @throws CommandException
42 * @throws IOException
43 */
44 protected void execute(IMAPSession session) throws CommandException, ParserException, IOException {
45 checkEOL(session);
46
47 new ByeResponse(session).submit();
48 try {
49 sendOK(session);
50 } catch (IOException e) {
51 // we don't care if client exited earier!
52 }
53 session.close();
54 }
55 }