1/*
2 * Copyright (C) 2008-2009 Marc Blank
3 * Licensed to The Android Open Source Project.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18package com.android.emailcommon.service;
19
20oneway interface IEmailServiceCallback {
21    /*
22     * Ordinary results:
23     *   statuscode = 1, progress = 0:      "starting"
24     *   statuscode = 0, progress = n/a:    "finished"
25     *
26     * If there is an error, it must be reported as follows:
27     *   statuscode = err, progress = n/a:  "stopping due to error"
28     *
29     * *Optionally* a callback can also include intermediate values from 1..99 e.g.
30     *   statuscode = 1, progress = 0:      "starting"
31     *   statuscode = 1, progress = 30:     "working"
32     *   statuscode = 1, progress = 60:     "working"
33     *   statuscode = 0, progress = n/a:    "finished"
34     */
35
36    /**
37     * Callback to indicate that an account is being synced (updating folder list)
38     * accountId = the account being synced
39     * statusCode = 0 for OK, 1 for progress, other codes for error
40     * progress = 0 for "start", 1..100 for optional progress reports
41     */
42    void syncMailboxListStatus(long accountId, int statusCode, int progress);
43
44    /**
45     * Callback to indicate that a mailbox is being synced
46     * mailboxId = the mailbox being synced
47     * statusCode = 0 for OK, 1 for progress, other codes for error
48     * progress = 0 for "start", 1..100 for optional progress reports
49     */
50    void syncMailboxStatus(long mailboxId, int statusCode, int progress);
51
52    /**
53     * Callback to indicate that a particular attachment is being synced
54     * messageId = the message that owns the attachment
55     * attachmentId = the attachment being synced
56     * statusCode = 0 for OK, 1 for progress, other codes for error
57     * progress = 0 for "start", 1..100 for optional progress reports
58     */
59    void loadAttachmentStatus(long messageId, long attachmentId, int statusCode, int progress);
60
61    /**
62     * Callback to indicate that a particular message is being sent
63     * messageId = the message being sent
64     * statusCode = 0 for OK, 1 for progress, other codes for error
65     * progress = 0 for "start", 1..100 for optional progress reports
66     */
67    void sendMessageStatus(long messageId, String subject, int statusCode, int progress);
68
69    /**
70     * Callback to indicate that a particular message is being loaded
71     * messageId = the message being sent
72     * statusCode = 0 for OK, 1 for progress, other codes for error
73     * progress = 0 for "start", 1..100 for optional progress reports
74     */
75    void loadMessageStatus(long messageId, int statusCode, int progress);
76}
77