⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 accountlistener.java

📁 The Funambol J2ME Mail Client aims to be a light, easy to use, free email client for J2ME devices.
💻 JAVA
字号:
/*
 * Copyright (C) 2006-2007 Funambol
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package com.funambol.mailclient;

import com.funambol.mail.Message;
import com.funambol.mail.MessageFlags;

/**
 * This interface is used by the User Intereface to set a listener on the
 * Mail Protocol Interface.
 */
public interface AccountListener {
    
    //-------------------------------------------------------------- Constants
    
    /**
     * No error for this session
     */
    public static final int STATUS_SUCCESS = 0;
    /**
     * At least one message has an error during send
     */
    public static final int STATUS_SEND_ERROR = 10;
    /**
     * At least one message has an error during receive
     */
    public static final int STATUS_RECV_ERROR = 11;
    /**
     * An error occurred with the remote server.
     * For instance an invalid messagev or item, but not
     * blocking for the sync.
     */
    public static final int STATUS_SERVER_ERROR = 30;
    /**
     * A problem with the connection to the remote server occurred
     */
    public static final int STATUS_CONNECTION_ERROR = 40;
    
    /**
     * Used when the messages to send or received is not know to
     * the mail protocol subsystem
     */
    public static final int MESSAGE_NUMBER_UNKNOWN = -1;
    
    /**
     * no action is required
     */
    public static final int ACTION_NONE = 0;
    
    /**
     * a reset inbox action is required
     */
    public static final int ACTION_RESET_INBOX = 1;
    
    //--------------------------------------------------------- Public methods
    
    /**
     * Invoked at the beginning of the session, before opening the
     * connection with the server
     */
    public void startSession();
    
    /**
     * Invoked when the server has been reached, at the end of the
     * login phase.
     *
     * @param onConnectAction the type of action to perform at 
     * connection completed as one of AccountListener.ACTION_NONE or 
     * AccountListener.ACTION_RESET_INBOX
     */
    public void connectionCompleted(int onConnectAction);
    
    /**
     * Invoked each time data is received from the server, with the timestamp
     * and the size of the receive data.
     */
    public void dataReceived(String date, int size);
    
    /**
     * Invoked each time a message is received and stored successfully
     * in the client.
     */
    public void msgReceived(Message msg);
    
    /**
     * Invoked each time a message is deleted
     */
    public void msgDeleted(String msgId);
    
    /**
     * Invoked each time a message is received and stored successfully
     * in the client.
     */
    public void msgFlagsUpdated(String msgId, MessageFlags newFlags);
    
    
    /**
     * Invoked each time a message is sent and accepted from the server for
     * delivery.
     */
    public void msgSent();
    
    /**
     * Invoked at the end of a session, before closing the connection with
     * the remote server.
     * The status is a summery of the session, and uses the defines above.
     */
    public void endSession(int status);
    
    /**
     * Invoked when the mail protocol subsystem is ready to send messages to
     * the server.
     *
     * @param number number of messages that will be sent during the
     *               session, if known, or MESSAGE_NUMBER_UNKNOWN otherwise.
     */
    public void startSending(int msgnum);
    
    /**
     * Invoked when the mail protocol subsystem has finished to send message.
     *
     */
    public void endSending();
    
    /**
     * Invoked when the mail protocol subsystem starts receiving messages from
     * the server.
     *
     * @param number number of messages that will be sent during the
     *               session, if known, or MESSAGE_NUMBER_UNKNOWN otherwise.
     */
    public void startReceiving(int number);
    
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -