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.
26 * This file contains the data structures and interfaces needed for application,
27 * to interact with Email Engine.
28 * @file Emf_Mapi_Folder.c
29 * @brief This file contains the data structures and interfaces of mailbox related Functionality provided by
35 #include "Msg_Convert.h"
36 #include "em-storage.h"
37 #include "ipc-library.h"
40 /* API - Create a mailbox */
42 EXPORT_API int email_add_mailbox(emf_mailbox_t* new_mailbox, int on_server, unsigned* handle)
44 EM_DEBUG_FUNC_BEGIN();
46 char* local_mailbox_stream = NULL;
48 int err = EMF_ERROR_NONE;
49 EM_IF_NULL_RETURN_VALUE(new_mailbox, EMF_ERROR_INVALID_PARAM);
51 HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_ADD_MAILBOX);
53 EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
55 local_mailbox_stream = em_convert_mailbox_to_byte_stream(new_mailbox, &size);
57 EM_PROXY_IF_NULL_RETURN_VALUE(local_mailbox_stream, hAPI, EMF_ERROR_NULL_VALUE);
59 if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, local_mailbox_stream, size))
60 EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
61 EM_SAFE_FREE(local_mailbox_stream);
63 if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &on_server, sizeof(int)))
64 EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
66 if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
67 EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
68 EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
71 err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
72 EM_DEBUG_LOG(" >>>>> error VALUE [%d]", err);
75 *handle = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
76 EM_DEBUG_LOG(" >>>>> Handle [%d]", *handle);
80 ipcEmailAPI_Destroy(hAPI);
82 EM_DEBUG_FUNC_END("err [%d]", err);
87 /* API - Delete a mailbox */
89 EXPORT_API int email_delete_mailbox(emf_mailbox_t* mailbox, int on_server, unsigned* handle)
91 EM_DEBUG_FUNC_BEGIN("mailbox[%p]", mailbox);
93 char* local_mailbox_stream = NULL;
94 int err = EMF_ERROR_NONE;
97 EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);
98 EM_IF_NULL_RETURN_VALUE(mailbox->account_id, EMF_ERROR_INVALID_PARAM) ;
100 HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_DELETE_MAILBOX);
102 EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
104 local_mailbox_stream = em_convert_mailbox_to_byte_stream(mailbox, &size);
106 EM_PROXY_IF_NULL_RETURN_VALUE(local_mailbox_stream, hAPI, EMF_ERROR_NULL_VALUE);
108 if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, local_mailbox_stream, size))
109 EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
110 EM_SAFE_FREE(local_mailbox_stream);
112 if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &on_server, sizeof(int)))
113 EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
116 if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
117 EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
118 EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
121 err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
122 EM_DEBUG_LOG("error VALUE [%d]", err);
125 *handle = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
126 EM_DEBUG_LOG("Handle [%d]", handle);
129 ipcEmailAPI_Destroy(hAPI);
131 EM_DEBUG_FUNC_END("err [%d]", err);
135 /* API - Update a mailbox */
138 EXPORT_API int email_update_mailbox(emf_mailbox_t* old_mailbox, emf_mailbox_t* new_mailbox)
140 EM_DEBUG_FUNC_BEGIN();
142 char* local_mailbox_stream = NULL;
143 int err = EMF_ERROR_NONE;
146 EM_DEBUG_LOG(" old_mailbox[%p], new_mailbox[%p]", old_mailbox, new_mailbox);
148 EM_IF_NULL_RETURN_VALUE(old_mailbox, EMF_ERROR_INVALID_PARAM);
149 EM_IF_NULL_RETURN_VALUE(old_mailbox->account_id, EMF_ERROR_INVALID_PARAM);
150 EM_IF_NULL_RETURN_VALUE(new_mailbox, EMF_ERROR_INVALID_PARAM);
151 EM_IF_ACCOUNT_ID_NULL(new_mailbox->account_id, EMF_ERROR_INVALID_PARAM);
153 HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_UPDATE_MAILBOX);
155 EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
158 local_mailbox_stream = em_convert_mailbox_to_byte_stream(old_mailbox, &size);
160 EM_PROXY_IF_NULL_RETURN_VALUE(local_mailbox_stream, hAPI, EMF_ERROR_NULL_VALUE);
162 if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, local_mailbox_stream, size))
163 EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
164 EM_SAFE_FREE(local_mailbox_stream);
166 local_mailbox_stream = em_convert_mailbox_to_byte_stream(new_mailbox, &size);
168 EM_PROXY_IF_NULL_RETURN_VALUE(local_mailbox_stream, hAPI, EMF_ERROR_NULL_VALUE);
170 if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, local_mailbox_stream, size))
171 EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
172 EM_SAFE_FREE(local_mailbox_stream);
174 if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &on_server, sizeof(int)))
175 EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
177 if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
178 EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
179 EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
181 err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
183 EM_DEBUG_LOG("error VALUE [%d]", err);
184 ipcEmailAPI_Destroy(hAPI);
187 EM_DEBUG_FUNC_END("err [%d]", err);
192 EXPORT_API int email_get_sync_mailbox_list(int account_id, emf_mailbox_t** mailbox_list, int* count)
194 EM_DEBUG_FUNC_BEGIN();
196 emf_mailbox_tbl_t* mailbox = NULL;
197 int err = EMF_ERROR_NONE ;
199 EM_IF_NULL_RETURN_VALUE(mailbox_list, EMF_ERROR_INVALID_PARAM);
200 EM_IF_ACCOUNT_ID_NULL(account_id, EMF_ERROR_INVALID_PARAM);
201 EM_IF_NULL_RETURN_VALUE(count, EMF_ERROR_INVALID_PARAM);
203 if (!em_storage_get_mailbox(account_id, 0, EMAIL_MAILBOX_SORT_BY_NAME_ASC, &counter, &mailbox, true, &err)) { /* TODO: confirm me */
204 EM_DEBUG_EXCEPTION("em_storage_get_mailbox failed [%d]", err);
206 err = em_storage_get_emf_error_from_em_storage_error(err);
209 err = EMF_ERROR_NONE;
212 if (!(*mailbox_list = em_core_malloc(sizeof(emf_mailbox_t) * counter))) {
213 EM_DEBUG_EXCEPTION("malloc failed...");
214 err= EMF_ERROR_OUT_OF_MEMORY;
218 *mailbox_list = NULL;
224 em_storage_free_mailbox(&mailbox, counter, NULL);
225 EM_DEBUG_FUNC_END("err [%d]", err);
230 EXPORT_API int email_get_mailbox_list(int account_id, int mailbox_sync_type, emf_mailbox_t** mailbox_list, int* count)
232 EM_DEBUG_FUNC_BEGIN();
234 int mailbox_count = 0;
235 emf_mailbox_tbl_t* mailbox_tbl_list = NULL;
236 int err =EMF_ERROR_NONE;
239 EM_IF_NULL_RETURN_VALUE(mailbox_list, EMF_ERROR_INVALID_PARAM);
240 EM_IF_ACCOUNT_ID_NULL(account_id, EMF_ERROR_INVALID_PARAM);
241 EM_IF_NULL_RETURN_VALUE(count, EMF_ERROR_INVALID_PARAM);
243 if (!em_storage_get_mailbox(account_id, mailbox_sync_type, EMAIL_MAILBOX_SORT_BY_NAME_ASC, &mailbox_count, &mailbox_tbl_list, true, &err)) {
244 EM_DEBUG_EXCEPTION("em_storage_get_mailbox failed [%d]", err);
245 err = em_storage_get_emf_error_from_em_storage_error(err);
248 err = EMF_ERROR_NONE;
250 if (mailbox_count > 0) {
251 if (!(*mailbox_list = em_core_malloc(sizeof(emf_mailbox_t) * mailbox_count))) {
252 EM_DEBUG_EXCEPTION("malloc failed for mailbox_list");
253 err= EMF_ERROR_OUT_OF_MEMORY;
257 for (i = 0; i < mailbox_count; i++) {
258 (*mailbox_list)[i].mailbox_id = mailbox_tbl_list[i].mailbox_id;
259 (*mailbox_list)[i].account_id = account_id;
260 (*mailbox_list)[i].name = mailbox_tbl_list[i].mailbox_name;
261 mailbox_tbl_list[i].mailbox_name = NULL;
262 (*mailbox_list)[i].alias = mailbox_tbl_list[i].alias;
263 mailbox_tbl_list[i].alias = NULL;
264 (*mailbox_list)[i].local = mailbox_tbl_list[i].local_yn;
265 (*mailbox_list)[i].mailbox_type = mailbox_tbl_list[i].mailbox_type;
266 (*mailbox_list)[i].synchronous = mailbox_tbl_list[i].sync_with_server_yn;
267 (*mailbox_list)[i].unread_count = mailbox_tbl_list[i].unread_count;
268 (*mailbox_list)[i].total_mail_count_on_local = mailbox_tbl_list[i].total_mail_count_on_local;
269 (*mailbox_list)[i].total_mail_count_on_server = mailbox_tbl_list[i].total_mail_count_on_server;
270 (*mailbox_list)[i].has_archived_mails = mailbox_tbl_list[i].has_archived_mails;
271 (*mailbox_list)[i].mail_slot_size = mailbox_tbl_list[i].mail_slot_size;
274 *mailbox_list = NULL;
276 *count = mailbox_count;
279 if (mailbox_tbl_list != NULL)
280 em_storage_free_mailbox(&mailbox_tbl_list, mailbox_count, NULL);
282 EM_DEBUG_FUNC_END("err [%d]", err);
288 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)
290 EM_DEBUG_FUNC_BEGIN();
292 int mailbox_count = 0;
293 emf_mailbox_tbl_t* mailbox_tbl_list = NULL;
294 int err =EMF_ERROR_NONE;
297 EM_IF_NULL_RETURN_VALUE(mailbox_list, EMF_ERROR_INVALID_PARAM);
298 EM_IF_ACCOUNT_ID_NULL(account_id, EMF_ERROR_INVALID_PARAM);
299 EM_IF_NULL_RETURN_VALUE(count, EMF_ERROR_INVALID_PARAM);
301 if (!em_storage_get_mailbox_ex(account_id, mailbox_sync_type, with_count, &mailbox_count, &mailbox_tbl_list, true, &err)) {
302 EM_DEBUG_EXCEPTION("em_storage_get_mailbox_ex failed [%d]", err);
303 err = em_storage_get_emf_error_from_em_storage_error(err);
306 err = EMF_ERROR_NONE;
308 if (mailbox_count > 0) {
309 if (!(*mailbox_list = em_core_malloc(sizeof(emf_mailbox_t) * mailbox_count))) {
310 EM_DEBUG_EXCEPTION("malloc failed for mailbox_list");
311 err= EMF_ERROR_OUT_OF_MEMORY;
315 for (i = 0; i < mailbox_count; i++) {
316 (*mailbox_list)[i].mailbox_id = mailbox_tbl_list[i].mailbox_id;
317 (*mailbox_list)[i].account_id = account_id;
318 (*mailbox_list)[i].name = mailbox_tbl_list[i].mailbox_name;
319 mailbox_tbl_list[i].mailbox_name = NULL;
320 (*mailbox_list)[i].alias = mailbox_tbl_list[i].alias;
321 mailbox_tbl_list[i].alias = NULL;
322 (*mailbox_list)[i].local = mailbox_tbl_list[i].local_yn;
323 (*mailbox_list)[i].mailbox_type = mailbox_tbl_list[i].mailbox_type;
324 (*mailbox_list)[i].synchronous = mailbox_tbl_list[i].sync_with_server_yn;
325 (*mailbox_list)[i].unread_count = mailbox_tbl_list[i].unread_count;
326 (*mailbox_list)[i].total_mail_count_on_local = mailbox_tbl_list[i].total_mail_count_on_local;
327 (*mailbox_list)[i].total_mail_count_on_server = mailbox_tbl_list[i].total_mail_count_on_server;
328 (*mailbox_list)[i].has_archived_mails = mailbox_tbl_list[i].has_archived_mails;
329 (*mailbox_list)[i].mail_slot_size = mailbox_tbl_list[i].mail_slot_size;
332 *mailbox_list = NULL;
335 *count = mailbox_count;
338 if (mailbox_tbl_list != NULL)
339 em_storage_free_mailbox(&mailbox_tbl_list, mailbox_count, NULL);
341 EM_DEBUG_FUNC_END("err [%d]", err);
346 EXPORT_API int email_get_mailbox_by_name(int account_id, const char *pMailboxName, emf_mailbox_t **pMailbox)
348 EM_DEBUG_FUNC_BEGIN();
350 int err = EMF_ERROR_NONE;
351 emf_mailbox_t* curr_mailbox = NULL;
352 emf_mailbox_tbl_t* local_mailbox = NULL;
354 EM_IF_NULL_RETURN_VALUE(pMailbox, EMF_ERROR_INVALID_PARAM);
356 return EMF_ERROR_INVALID_PARAM;
358 if (!em_storage_get_mailbox_by_name(account_id, -1, (char*)pMailboxName, &local_mailbox, true, &err)) /* Warning removal changes */ {
359 if (err == EM_STORAGE_ERROR_MAILBOX_NOT_FOUND)
360 err = EMF_ERROR_MAILBOX_NOT_FOUND; else if (err == EM_STORAGE_ERROR_INVALID_PARAM)
361 err = EMF_ERROR_INVALID_PARAM; else if (err == EM_STORAGE_ERROR_OUT_OF_MEMORY)
362 err = EMF_ERROR_OUT_OF_MEMORY; else if (err == EM_STORAGE_ERROR_DB_FAILURE)
363 err = EMF_ERROR_DB_FAILURE; else
364 err = EMF_ERROR_UNKNOWN;
368 curr_mailbox = em_core_malloc(sizeof(emf_mailbox_t));
369 memset(curr_mailbox, 0x00, sizeof(emf_mailbox_t));
371 curr_mailbox->account_id = local_mailbox->account_id;
372 if(local_mailbox->mailbox_name)
373 curr_mailbox->name = strdup(local_mailbox->mailbox_name);
374 curr_mailbox->local = local_mailbox->local_yn;
375 if(local_mailbox->alias)
376 curr_mailbox->alias= strdup(local_mailbox->alias);
377 curr_mailbox->synchronous = local_mailbox->sync_with_server_yn;
378 curr_mailbox->mailbox_type = local_mailbox->mailbox_type;
379 curr_mailbox->unread_count = local_mailbox->unread_count;
380 curr_mailbox->total_mail_count_on_local= local_mailbox->total_mail_count_on_local;
381 curr_mailbox->total_mail_count_on_server= local_mailbox->total_mail_count_on_server;
382 curr_mailbox->has_archived_mails = local_mailbox->has_archived_mails;
383 curr_mailbox->mail_slot_size = local_mailbox->mail_slot_size;
386 *pMailbox = curr_mailbox;
388 em_storage_free_mailbox(&local_mailbox, 1, &err);
389 EM_DEBUG_FUNC_END("err [%d]", err);
394 EXPORT_API int email_get_child_mailbox_list(int account_id, const char *parent_mailbox, emf_mailbox_t** mailbox_list, int* count)
396 EM_DEBUG_FUNC_BEGIN("account_id[%d], parent_mailbox[%p], mailbox_list[%p], count[%p]", account_id, parent_mailbox, mailbox_list, count);
398 int err = EMF_ERROR_NONE;
400 emf_mailbox_tbl_t* mailbox_tbl = NULL;
403 EM_IF_NULL_RETURN_VALUE(account_id, EMF_ERROR_INVALID_PARAM);
404 EM_IF_NULL_RETURN_VALUE(mailbox_list, EMF_ERROR_INVALID_PARAM);
405 EM_IF_NULL_RETURN_VALUE(count, EMF_ERROR_INVALID_PARAM);
407 *mailbox_list = NULL;
410 if (!em_storage_get_child_mailbox_list(account_id,(char*)parent_mailbox, &counter, &mailbox_tbl, true, &err)) {
411 EM_DEBUG_EXCEPTION("em_storage_get_child_mailbox_list failed[%d]", err);
413 err = em_storage_get_emf_error_from_em_storage_error(err);
416 err = EMF_ERROR_NONE;
419 if (!(*mailbox_list = em_core_malloc(sizeof(emf_mailbox_t) * counter))) {
420 EM_DEBUG_EXCEPTION("malloc failed for mailbox_list");
422 err= EMF_ERROR_OUT_OF_MEMORY;
426 memset(*mailbox_list, 0x00, (sizeof(emf_mailbox_t) * counter));
428 for (i = 0; i < counter; i++) {
429 (*mailbox_list)[i].mailbox_id = mailbox_tbl[i].mailbox_id;
430 (*mailbox_list)[i].account_id = account_id;
431 (*mailbox_list)[i].name = mailbox_tbl[i].mailbox_name; mailbox_tbl[i].mailbox_name = NULL;
432 (*mailbox_list)[i].alias = mailbox_tbl[i].alias; mailbox_tbl[i].alias = NULL;
433 (*mailbox_list)[i].local = mailbox_tbl[i].local_yn;
434 (*mailbox_list)[i].mailbox_type = mailbox_tbl[i].mailbox_type;
435 (*mailbox_list)[i].synchronous = mailbox_tbl[i].sync_with_server_yn;
436 (*mailbox_list)[i].unread_count = mailbox_tbl[i].unread_count;
437 (*mailbox_list)[i].total_mail_count_on_local = mailbox_tbl[i].total_mail_count_on_local;
438 (*mailbox_list)[i].total_mail_count_on_server = mailbox_tbl[i].total_mail_count_on_server;
439 (*mailbox_list)[i].has_archived_mails = mailbox_tbl[i].has_archived_mails;
440 (*mailbox_list)[i].mail_slot_size = mailbox_tbl[i].mail_slot_size;
443 *mailbox_list = NULL;
448 if (mailbox_tbl != NULL)
449 em_storage_free_mailbox(&mailbox_tbl, counter, NULL);
450 EM_DEBUG_FUNC_END("err [%d]", err);
454 /* sowmya.kr, 05-Apr-2010, new MAPI*/
456 EXPORT_API int email_get_mailbox_by_mailbox_type(int account_id, emf_mailbox_type_e mailbox_type, emf_mailbox_t** mailbox)
458 EM_DEBUG_FUNC_BEGIN();
460 int err = EMF_ERROR_NONE;
461 emf_mailbox_t* curr_mailbox = NULL;
462 emf_mailbox_tbl_t* local_mailbox = NULL;
464 EM_IF_NULL_RETURN_VALUE(mailbox, EMF_ERROR_INVALID_PARAM);
465 EM_IF_NULL_RETURN_VALUE(account_id, EMF_ERROR_INVALID_PARAM) ;
468 if(mailbox_type < EMF_MAILBOX_TYPE_INBOX || mailbox_type > EMF_MAILBOX_TYPE_ALL_EMAILS)
469 return EMF_ERROR_INVALID_PARAM;
470 if (!em_storage_get_mailbox_by_mailbox_type(account_id, mailbox_type, &local_mailbox, true, &err)) {
471 EM_DEBUG_EXCEPTION("em_storage_get_mailbox_by_mailbox_type failed [%d]", err);
472 err = em_storage_get_emf_error_from_em_storage_error(err);
475 err = EMF_ERROR_NONE;
476 curr_mailbox = em_core_malloc(sizeof(emf_mailbox_t));
477 memset(curr_mailbox, 0x00, sizeof(emf_mailbox_t));
479 curr_mailbox->account_id = local_mailbox->account_id;
480 if(local_mailbox->mailbox_name)
481 curr_mailbox->name = strdup(local_mailbox->mailbox_name);
482 curr_mailbox->local = local_mailbox->local_yn;
483 if(local_mailbox->alias)
484 curr_mailbox->alias= strdup(local_mailbox->alias);
485 curr_mailbox->synchronous = 1;
486 curr_mailbox->mailbox_type = local_mailbox->mailbox_type;
487 curr_mailbox->unread_count = local_mailbox->unread_count;
488 curr_mailbox->total_mail_count_on_local = local_mailbox->total_mail_count_on_local;
489 curr_mailbox->total_mail_count_on_server = local_mailbox->total_mail_count_on_server;
490 curr_mailbox->has_archived_mails = local_mailbox->has_archived_mails;
491 curr_mailbox->mail_slot_size = local_mailbox->mail_slot_size;
494 *mailbox = curr_mailbox;
498 em_storage_free_mailbox(&local_mailbox, 1, NULL);
499 EM_DEBUG_FUNC_END("err [%d]", err);
503 EXPORT_API int email_set_mail_slot_size(int account_id, char* mailbox_name, int new_slot_size/*, unsigned* handle*/)
505 EM_DEBUG_FUNC_BEGIN("account_id[%d], mailbox_name[%p], new_slot_size[%d]", account_id, mailbox_name, new_slot_size);
507 int err = EMF_ERROR_NONE, *handle = NULL;
509 if(new_slot_size < 0) {
510 EM_DEBUG_EXCEPTION("new_slot_size should be greater than 0 or should be equal to 0");
511 return EMF_ERROR_INVALID_PARAM;
514 HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_SET_MAIL_SLOT_SIZE);
516 EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
519 if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &account_id, sizeof(int)))
520 EM_DEBUG_EXCEPTION(" ipcEmailAPI_AddParameter for account_id failed");
522 if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, &new_slot_size, sizeof(int)))
523 EM_DEBUG_EXCEPTION(" ipcEmailAPI_AddParameter for new_slot_size failed");
526 if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, mailbox_name, strlen(mailbox_name) ))
527 EM_DEBUG_EXCEPTION(" ipcEmailAPI_AddParameter for mailbox_name failed");
530 if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
531 EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
532 EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
534 err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
535 EM_DEBUG_LOG("email_set_mail_slot_size error VALUE [%d]", err);
537 *handle = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
538 EM_DEBUG_LOG("email_set_mail_slot_size handle VALUE [%d]", handle);
540 ipcEmailAPI_Destroy(hAPI);
544 EM_DEBUG_FUNC_END("err [%d]", err);