4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
23 #ifndef __EMF_MAPI_FOLDER_H__ /* mailbox */
24 #define __EMF_MAPI_FOLDER_H__
26 #include "emf-types.h"
29 * @defgroup EMAIL_FRAMEWORK Email Service
35 * @ingroup EMAIL_FRAMEWORK
36 * @defgroup EMAIL_MAPI_FOLDER Email mailbox(Mailbox) API
42 * This file contains the data structures and interfaces needed for application,
43 * to interact with Email Engine.
44 * @file Emf_Mapi_Folder.h
45 * @author Kyuho Jo <kyuho.jo@samsung.com>
46 * @author Sunghyun Kwon <sh0701.kwon@samsung.com>
48 * @brief This file contains the data structures and interfaces of mailbox [mailbox] provided by
53 * #include "emf_mapi_folder.h"
56 * other_app_invoke_uniform_api_sample(int *error_code)
59 * emf_mailbox_t *new_mailbox =NULL;
60 * emf_mailbox_t *mailbox_list = NULL;
63 * unsigned handle = 0;
65 * char *pParentMailbox;
67 * memset(&mbox,0x00,sizeof(emf_mailbox_t));
68 * mbox.name = strdup("test");
69 * mbox.alias = strdup("Personal");
70 * mbox.account_id = 1;
71 * printf("Enter local_yn(1/0)");
72 * scanf("%d",&local_yn);
73 * mbox.local=local_yn;
74 * mbox.mailbox_type = 7;
76 * //create new mailbox
78 * if(EMF_ERR_NONE != email_add_mailbox(&mbox,local_yn,&handle))
79 * printf("email_add_mailbox failed\n");
81 * printf("email_add_mailbox success");
84 * new_mailbox = malloc(sizeof(emf_mailbox_t));
85 * memset(new_mailbox,0x00,sizeof(emf_mailbox_t));
87 * new_mailbox->name = strdup("PersonalUse");
89 * if(EMF_ERROR_NONE != email_update_mailbox(&mbox,new_mailbox))
90 * printf("email_update_mailbox failed\n");
92 * printf("email_update_mailbox success\n");
95 * if(EMF_ERROR_NONE != email_delete_mailbox(mbox,local_yn,&handle))
96 * printf("email_delete_mailbox failed\n");
98 * printf("email_delete_mailbox success\n");
101 * email_free_mailbox("new_mailbox,1");
104 * if(EMF_ERROR_NONE != email_get_mailbox_list(account_id,local_yn,&mailbox_list,&count))
109 * //Get mailbox by name
110 * pMailboxName = strdup("test");
111 * if(EMF_ERROR_NONE != email_get_mailbox_by_name(account_id,pMailboxName,&mailbox_list))
116 * //Get child mailbox list
117 * pParentMailbox = strdup("test");
118 * if(EMF_ERROR_NONE != email_get_child_mailbox_list(account_id, paerent_mailbox,&mailbox_list,&count))
123 * //Get mailbox by mailbox_type
124 * printf("Enter mailbox_type\n");
125 * scanf("%d",&mailbox_type);
126 * if(EMF_ERROR_NONE != email_get_mailbox_by_mailbox_type(account_id,mailbox_type,&mailbox_list))
142 #endif /* __cplusplus */
148 * @fn EXPORT_API int email_add_mailbox(emf_mailbox_t* new_mailbox, int on_server, unsigned* handle)
149 * @brief Create a new mailbox or mailbox.This function is invoked when user wants to create a new mailbox for the specified account.
150 * If On_server is true then it will create the mailbox on server as well as in local also.
152 * @return This function returns EMF_ERROR_NONE on success or error code(refer to EMF_ERROR_XXX) on failure.
153 * @param[in] new_mailbox Specifies the pointer of creating mailbox information.
154 * @param[in] on_server Specifies the creating mailbox information on server.
155 * @param[out] handle Specifies the sending handle.
160 EXPORT_API int email_add_mailbox(emf_mailbox_t* new_mailbox, int on_server, unsigned* handle);
166 * @fn EXPORT_API int email_delete_mailbox(emf_mailbox_t* mailbox, int on_server, unsigned* handle)
167 * @brief Delete a mailbox or mailbox.This function deletes the existing mailbox for specified account based on the option on_server.
168 * If the on_server is true then it deletes mailbox from server as well as locally.
170 * @return This function returns EMF_ERROR_NONE on success or error code(refer to EMF_ERROR_XXX) on failure.
171 * @param[in] mailbox Specifies the pointer of deleting mailbox information.
172 * @param[in] on_server Specifies the creating mailbox information on server.
173 * @param[out] handle Specifies the sending handle.
174 * @exception #EMF_ERROR_INVALID_PARAM -Invaid argument
178 EXPORT_API int email_delete_mailbox(emf_mailbox_t* mailbox, int on_server, unsigned* handle);
183 * @fn EXPORT_API int email_update_mailbox(emf_mailbox_t* old_mailbox, emf_mailbox_t* new_mailbox)
184 * @brief Change mailbox or mailbox information.This function is invoked when user wants to change the existing mail box information.
185 * This supports ONLY updating mailbox_type in local db. This can be used to match a specific mail box and a specific mailbox_type.
187 * @return This function returns EMF_ERROR_NONE on success or error code(refer to EMF_ERROR_XXX) on failure.
188 * @param[in] old_mailbox Specifies the information of previous mailbox. <br>mandatory field : account_id, name
189 * @param[in] new_mailbox Specifies the information of new mailbox. <br
190 * @exception #EMF_ERROR_INVALID_PARAM -Invaid argument
191 * @see emf_mailbox_t, emf_mailbox_type_e
194 EXPORT_API int email_update_mailbox(emf_mailbox_t* old_mailbox, emf_mailbox_t* new_mailbox);
196 EXPORT_API int email_get_sync_mailbox_list(int account_id, emf_mailbox_t** mailbox_list, int* count) DEPRECATED;
202 * @fn email_get_mailbox_list(int account_id, int mailbox_sync_type, emf_mailbox_t** mailbox_list, int* count)
203 * @brief Get all mailboxes from account.
205 * @return This function returns EMF_ERROR_NONE on success or error code(refer to EMF_ERROR_XXX) on failure.
206 * @param[in] account_id Specifies the account ID.
207 * @param[in] mailbox_sync_type Specifies the sync type.
208 * @param[out] mailbox_list Specifies the pointer of mailbox structure pointer.(possibly NULL)
209 * @param[out] count The mailbox count is saved here.(possibly 0)
214 * #include "Emf_Mapi_Message.h"
216 * _api_sample_get_mailbox_list()
218 * int account_id =0,count = 0;
219 * int mailbox_sync_type;
220 * int error_code = EMF_ERROR_NONE;
221 * emf_mailbox_t *mailbox_list=NULL;
223 * printf("\n > Enter account id: ");
224 * scanf("%d", &account_id);
225 * printf("\n > Enter mailbox_sync_type: ");
226 * scanf("%d", &mailbox_sync_type);
228 * if((EMF_ERROR_NONE != email_get_mailbox_list(account_id, mailbox_sync_type, &mailbox_list, &count)))
230 * printf(" Error\n");
234 * printf("Success\n");
235 * email_free_mailbox(&mailbox_list,count);
241 EXPORT_API int email_get_mailbox_list(int account_id, int mailbox_sync_type, emf_mailbox_t** mailbox_list, int* count);
243 EXPORT_API int email_get_mailbox_list_ex(int account_id, int mailbox_sync_type, int with_count, emf_mailbox_t** mailbox_list, int* count);
248 * @fn EXPORT_API int email_get_mailbox_by_name(int account_id, const char *pMailboxName, emf_mailbox_t **pMailbox);
249 * @brief Get the mailbox information by name.This function gets the mailbox by given mailbox name for a specified account.
251 * @return This function returns EMF_ERROR_NONE on success or error code(refer to EMF_ERROR_XXX) on failure.
252 * @param[in] account_id Specifies the information of account Id.
253 * @param[in] pMailboxName Specifies the mailbox name.
254 * @param[out] pMailbox Specifies the information of mailbox
260 EXPORT_API int email_get_mailbox_by_name(int account_id, const char *pMailboxName, emf_mailbox_t **pMailbox);
262 // Belows are for A Project
267 * @fn email_get_child_mailbox_list(int account_id, char *parent_mailbox, emf_mailbox_t** mailbox_list, int* count)
268 * @brief Get all sub mailboxes for given parent mailbox.This function gives all the child mailbox list for a given parent mailbox for specified account.
270 * @return This function returns EMF_ERROR_NONE on success or error code(refer to EMF_ERROR_XXX) on failure.
271 * @param[in] account_id Specifies the account ID.
272 * @param[in] parent_mailbox Specifies the parent mailbox
273 * @param[out] mailbox_list Specifies the pointer of mailbox structure pointer.(possibly NULL)
274 * @param[out] count The mailbox count
275 * @exception #EMF_ERROR_INVALID_PARAM -Invalid argument
278 * @return This function returns true on success or false on failure.
280 EXPORT_API int email_get_child_mailbox_list(int account_id, const char *parent_mailbox, emf_mailbox_t** mailbox_list, int* count);
285 * @fn email_get_mailbox_by_mailbox_type(int account_id, emf_mailbox_type_e mailbox_type, emf_mailbox_t** mailbox)
286 * @brief Get mailbox by mailbox_type.This function is invoked when user wants to know the mailbox information by mailbox_type for the given account.
288 * @return This function returns EMF_ERROR_NONE on success or error code(refer to EMF_ERROR_XXX) on failure.
289 * @param[in] account_id Specifies the account ID.
290 * @param[in] mailbox_type Specifies the mailbox type.
291 * @param[out] mailbox Specifies the pointer of mailbox structure pointer.(possibly NULL)
296 EXPORT_API int email_get_mailbox_by_mailbox_type(int account_id, emf_mailbox_type_e mailbox_type, emf_mailbox_t** mailbox);
300 * @fn email_set_mail_slot_size(int account_id, char* mailbox_name, int new_slot_size, unsigned* handle)
301 * @brief Set mail slot size.This function is invoked when user wants to set the size of mail slot.
303 * @return This function returns EMF_ERROR_NONE on success or error code(refer to EMF_ERROR_XXX) on failure.
304 * @param[in] account_id Specifies the account ID.
305 * @param[in] mailbox_name Specifies the mailbox name.
306 * @param[in] new_slot_size Specifies the mail slot size.
311 EXPORT_API int email_set_mail_slot_size(int account_id, char* mailbox_name, int new_slot_size/*, unsigned* handle*/);
316 #endif /* __cplusplus */
324 #endif /* __EMF_MAPI_FOLDER_H__ */