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.
25 * This file contains the data structures and interfaces needed for application,
26 * to interact with Email Engine.
27 * @file Emf_Mapi_Account.c
28 * @brief This file contains the data structures and interfaces of Account related Functionality provided by
34 #include "Msg_Convert.h"
35 #include "Emf_Mapi_Account.h"
36 #include "em-storage.h"
37 #include "em-core-mesg.h"
38 #include "em-core-account.h"
39 #include "em-core-utils.h"
40 #include "ipc-library.h"
42 /* API - Adds the Email Account */
43 EXPORT_API int email_add_account(emf_account_t* account)
45 EM_DEBUG_FUNC_BEGIN("account[%p]", account);
46 char* local_account_stream = NULL;
50 int err = EMF_ERROR_NONE;
53 EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
54 return EMF_ERROR_INVALID_PARAM;
57 HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_ADD_ACCOUNT);
59 EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
61 local_account_stream = em_convert_account_to_byte_stream(account, &size);
63 EM_PROXY_IF_NULL_RETURN_VALUE(local_account_stream, hAPI, EMF_ERROR_NULL_VALUE);
65 if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, local_account_stream, size))
66 EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter failed");
68 EM_DEBUG_LOG("APPID[%d], APIID [%d]", ipcEmailAPI_GetAPPID(hAPI), ipcEmailAPI_GetAPIID(hAPI));
70 if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
71 EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
72 EM_SAFE_FREE(local_account_stream);
73 EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
76 ret = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
78 account_id = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
79 EM_DEBUG_LOG("APPID[%d], APIID [%d]", ipcEmailAPI_GetAPPID(hAPI), ipcEmailAPI_GetAPIID(hAPI));
80 account->account_id = account_id;
81 } else { /* get error code */
82 err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
85 ipcEmailAPI_Destroy(hAPI);
88 EM_SAFE_FREE(local_account_stream);
89 EM_DEBUG_FUNC_END("RETURN VALUE [%d], ERROR CODE [%d]", ret, err);
94 EXPORT_API int email_free_account(emf_account_t** account_list, int count)
96 EM_DEBUG_FUNC_BEGIN("account_list[%p], count[%d]", account_list, count);
98 /* default variable */
99 int err = EMF_ERROR_NONE;
102 if (!account_list || !*account_list) {
103 err = EMF_ERROR_INVALID_PARAM;
106 emf_account_t* p = *account_list;
109 for (i = 0; i < count; i++) {
110 EM_SAFE_FREE(p[i].account_name);
111 EM_SAFE_FREE(p[i].receiving_server_addr);
112 EM_SAFE_FREE(p[i].email_addr);
113 EM_SAFE_FREE(p[i].user_name);
114 EM_SAFE_FREE(p[i].password);
115 EM_SAFE_FREE(p[i].sending_server_addr);
116 EM_SAFE_FREE(p[i].sending_user);
117 EM_SAFE_FREE(p[i].sending_password);
118 EM_SAFE_FREE(p[i].display_name);
119 EM_SAFE_FREE(p[i].reply_to_addr);
120 EM_SAFE_FREE(p[i].return_addr);
121 EM_SAFE_FREE(p[i].logo_icon_path);
122 EM_SAFE_FREE(p[i].options.display_name_from);
123 EM_SAFE_FREE(p[i].options.signature);
125 free(p); *account_list = NULL;
129 EM_DEBUG_FUNC_END("ERROR CODE [%d]", err);
134 /* API - Delete the Email Account */
135 EXPORT_API int email_delete_account(int account_id)
137 EM_DEBUG_FUNC_BEGIN("account_id[%d]", account_id);
140 int err = EMF_ERROR_NONE;
142 if (account_id < 0 || account_id == 0) {
143 EM_DEBUG_EXCEPTION(" account_id[%d]", account_id);
144 err = EMF_ERROR_INVALID_PARAM;
148 HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_DELETE_ACCOUNT);
150 EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
153 if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int)))
154 EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter account_id failed ");
156 if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
157 EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed ");
158 EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
161 ret = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
162 if(0==ret) { /* get error code */
163 err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
165 ipcEmailAPI_Destroy(hAPI);
168 EM_DEBUG_FUNC_END("RETURN VALUE [%d], ERROR CODE [%d]", ret, err);
172 /* API - Update the Email Account */
173 EXPORT_API int email_update_account(int account_id, emf_account_t* new_account)
175 EM_DEBUG_FUNC_BEGIN("account_id[%d], new_account[%p]", account_id, new_account);
179 int err = EMF_ERROR_NONE;
180 int with_validation = false, *result_from_ipc = NULL;
181 char* new_account_stream = NULL;
183 if ((account_id <= 0) || !new_account || (with_validation != false && with_validation != true)) {
184 EM_DEBUG_EXCEPTION("account_id[%d], new_account[%p], with_validation[%d]", account_id, new_account, with_validation);
185 err = EMF_ERROR_INVALID_PARAM;
189 HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_UPDATE_ACCOUNT);
191 EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
194 if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int)))
195 EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter account_id failed ");
198 new_account_stream = em_convert_account_to_byte_stream(new_account, &size);
200 EM_PROXY_IF_NULL_RETURN_VALUE(new_account_stream, hAPI, EMF_ERROR_NULL_VALUE);
202 if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, new_account_stream, size))
203 EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter new_account failed ");
205 /* with_validation */
206 if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&with_validation, sizeof(int)))
207 EM_DEBUG_EXCEPTION("ipcEmailAPI_AddParameter with_validation failed ");
209 if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
210 EM_DEBUG_EXCEPTION("ipcEmailProxy_ExecuteAPI failed");
211 /* Prevent defect 18624 */
212 EM_SAFE_FREE(new_account_stream);
213 EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
216 result_from_ipc = (int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
218 if(!result_from_ipc) {
219 EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter fail ");
220 err = EMF_ERROR_IPC_CRASH;
224 ret = *result_from_ipc;
226 if(ret == 0) { /* get error code */
227 result_from_ipc = (int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
228 if(!result_from_ipc) {
229 EM_DEBUG_EXCEPTION("ipcEmailAPI_GetParameter fail ");
230 err = EMF_ERROR_IPC_CRASH;
234 err = *result_from_ipc;
239 ipcEmailAPI_Destroy(hAPI);
242 EM_SAFE_FREE(new_account_stream);
243 EM_DEBUG_FUNC_END("RETURN VALUE [%d], ERROR CODE [%d]", ret, err);
247 /* API - Update the Email Account */
248 EXPORT_API int email_update_account_with_validation(int account_id, emf_account_t* new_account)
250 EM_DEBUG_FUNC_BEGIN("account_id[%d], new_account[%p]", account_id, new_account);
254 int err = EMF_ERROR_NONE;
255 int with_validation = true;
256 char* new_account_stream = NULL;
258 if ((account_id <= 0) || !new_account || (with_validation != false && with_validation != true)) {
259 EM_DEBUG_EXCEPTION(" account_id[%d], new_account[%p], with_validation[%d]", account_id, new_account, with_validation);
260 err = EMF_ERROR_INVALID_PARAM;
264 HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_UPDATE_ACCOUNT);
266 EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
269 if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int)))
270 EM_DEBUG_EXCEPTION("email_update_account--ipcEmailAPI_AddParameter account_id failed ");
273 new_account_stream = em_convert_account_to_byte_stream(new_account, &size);
275 EM_PROXY_IF_NULL_RETURN_VALUE(new_account_stream, hAPI, EMF_ERROR_NULL_VALUE);
277 if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, new_account_stream, size))
278 EM_DEBUG_EXCEPTION("email_update_account--ipcEmailAPI_AddParameter new_account failed ");
280 /* with_validation */
281 if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&with_validation, sizeof(int)))
282 EM_DEBUG_EXCEPTION("email_update_account--ipcEmailAPI_AddParameter with_validation failed ");
285 if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
286 EM_DEBUG_EXCEPTION("email_update_account--ipcEmailProxy_ExecuteAPI failed ");
287 /* Prevent defect 18624 */
288 EM_SAFE_FREE(new_account_stream);
289 EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
292 ret = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
293 if(ret == 0) { /* get error code */
294 err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
297 ipcEmailAPI_Destroy(hAPI);
300 EM_SAFE_FREE(new_account_stream);
301 EM_DEBUG_FUNC_END("RETURN VALUE [%d], ERROR CODE [%d]", ret, err);
308 /* API - Get the account Information based on the account ID */
309 EXPORT_API int email_get_account(int account_id, int pulloption, emf_account_t** account)
311 EM_DEBUG_FUNC_BEGIN();
313 int err = EMF_ERROR_NONE;
314 emf_mail_account_tbl_t *account_tbl = NULL;
316 EM_IF_NULL_RETURN_VALUE(account_id, EMF_ERROR_INVALID_PARAM);
317 EM_IF_NULL_RETURN_VALUE(account, EMF_ERROR_INVALID_PARAM);
319 if (pulloption == GET_FULL_DATA)
320 pulloption = EMF_ACC_GET_OPT_FULL_DATA;
322 if (pulloption & EMF_ACC_GET_OPT_PASSWORD) {
323 pulloption = pulloption & (~(EMF_ACC_GET_OPT_PASSWORD)); /* disable password -Can't obtain password by MAPI */
324 EM_DEBUG_LOG("change pulloption : disable password");
327 if (!em_storage_get_account_by_id(account_id, pulloption, &account_tbl, true, &err)) {
328 EM_DEBUG_EXCEPTION("em_storage_get_account_by_id failed - %d", err);
329 err = em_storage_get_emf_error_from_em_storage_error(err);
333 *account = em_core_malloc(sizeof(emf_account_t));
335 EM_DEBUG_EXCEPTION("allocation failed [%d]", err);
338 memset((void*)*account, 0, sizeof(emf_account_t));
339 em_convert_account_tbl_to_account(account_tbl, *account);
341 err = em_storage_get_emf_error_from_em_storage_error(err);
346 em_storage_free_account(&account_tbl, 1, NULL);
352 EXPORT_API int email_get_account_list(emf_account_t** account_list, int* count)
354 EM_DEBUG_FUNC_BEGIN();
356 int err = EMF_ERROR_NONE, i = 0;
357 emf_mail_account_tbl_t *temp_account_tbl = NULL;
359 EM_IF_NULL_RETURN_VALUE(account_list, EMF_ERROR_INVALID_PARAM);
360 EM_IF_NULL_RETURN_VALUE(count, EMF_ERROR_INVALID_PARAM);
362 if (!em_storage_get_account_list(count, &temp_account_tbl , true, false, &err)) {
363 EM_DEBUG_EXCEPTION("em_storage_get_account_list failed [%d]", err);
368 if(temp_account_tbl && (*count) > 0) {
369 *account_list = em_core_malloc(sizeof(emf_account_t) * (*count));
371 EM_DEBUG_EXCEPTION("allocation failed [%d]", err);
374 memset((void*)*account_list, 0, sizeof(emf_account_t) * (*count));
375 for(i = 0; i < (*count); i++)
376 em_convert_account_tbl_to_account(temp_account_tbl + i, (*account_list) + i);
380 err = em_storage_get_emf_error_from_em_storage_error(err);
383 em_storage_free_account(&temp_account_tbl, (*count), NULL);
384 EM_DEBUG_FUNC_END("err[%d]", err);
389 EXPORT_API int email_validate_account(int account_id, unsigned* handle)
391 EM_DEBUG_FUNC_BEGIN("account_id[%d], handle[%p]", account_id, handle);
394 int err = EMF_ERROR_NONE;
395 if (account_id <= 0) {
396 EM_DEBUG_EXCEPTION("account_id[%d]", account_id);
397 err = EMF_ERROR_INVALID_PARAM;
401 HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_VALIDATE_ACCOUNT);
403 EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
406 if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int)))
407 EM_DEBUG_EXCEPTION(" ipcEmailAPI_AddParameter account_id failed ");
409 if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
410 EM_DEBUG_EXCEPTION(" ipcEmailProxy_ExecuteAPI failed ");
411 EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
414 ret = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0); /* return */
415 err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1); /* error code */
418 *handle = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 2);
420 ipcEmailAPI_Destroy(hAPI);
423 EM_DEBUG_FUNC_END("err[%d]", err);
429 EXPORT_API int email_add_account_with_validation(emf_account_t* account, unsigned* handle)
431 EM_DEBUG_FUNC_BEGIN("account[%p]", account);
432 char* local_account_stream = NULL;
436 int err = EMF_ERROR_NONE;
438 EM_IF_NULL_RETURN_VALUE(account, false);
440 if(em_storage_check_duplicated_account(account, true, &err) == false) {
441 EM_DEBUG_EXCEPTION("em_storage_check_duplicated_account failed (%d) ", err);
442 err = em_storage_get_emf_error_from_em_storage_error(err);
446 HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_ADD_ACCOUNT_WITH_VALIDATION);
448 EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
450 EM_DEBUG_LOG("Before em_convert_account_to_byte_stream");
451 local_account_stream = em_convert_account_to_byte_stream(account, &size);
453 EM_PROXY_IF_NULL_RETURN_VALUE(local_account_stream, hAPI, EMF_ERROR_NULL_VALUE);
455 if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, local_account_stream, size))
456 EM_DEBUG_EXCEPTION(" ipcEmailAPI_AddParameter failed ");
458 if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
459 EM_DEBUG_EXCEPTION(" ipcEmailProxy_ExecuteAPI failed ");
460 EM_SAFE_FREE(local_account_stream);
461 EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
464 ret = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
466 handle_inst = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
468 *handle = handle_inst;
469 } else { /* get error code */
470 err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
473 ipcEmailAPI_Destroy(hAPI);
476 EM_SAFE_FREE(local_account_stream);
477 EM_DEBUG_FUNC_END("err[%d]", err);
482 EXPORT_API int email_backup_accounts_into_secure_storage(const char *file_name)
484 EM_DEBUG_FUNC_BEGIN("file_name[%s]", file_name);
486 int err = EMF_ERROR_NONE;
489 EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
490 err = EMF_ERROR_INVALID_PARAM;
494 HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_BACKUP_ACCOUNTS);
496 EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
499 if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)file_name, strlen(file_name)))
500 EM_DEBUG_EXCEPTION(" ipcEmailAPI_AddParameter account_id failed ");
502 if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
503 EM_DEBUG_EXCEPTION(" ipcEmailProxy_ExecuteAPI failed ");
504 EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
507 ret = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
509 if(0 == ret) { /* get error code */
510 err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
513 ipcEmailAPI_Destroy(hAPI);
516 EM_DEBUG_FUNC_END("err[%d]", err);
520 EXPORT_API int email_restore_accounts_from_secure_storage(const char * file_name)
522 EM_DEBUG_FUNC_BEGIN("file_name[%s]", file_name);
524 int err = EMF_ERROR_NONE;
527 EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
528 err = EMF_ERROR_INVALID_PARAM;
532 HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_RESTORE_ACCOUNTS);
534 EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
537 if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)file_name, strlen(file_name)))
538 EM_DEBUG_EXCEPTION(" ipcEmailAPI_AddParameter account_id failed ");
540 if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
541 EM_DEBUG_EXCEPTION(" ipcEmailProxy_ExecuteAPI failed ");
542 EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
545 ret = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0);
547 if(0==ret) { /* get error code */
548 err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1);
551 ipcEmailAPI_Destroy(hAPI);
554 EM_DEBUG_FUNC_END("err[%d]", err);
558 EXPORT_API int email_get_password_length_of_account(const int account_id, int *password_length)
560 EM_DEBUG_FUNC_BEGIN("account_id[%d], password_length[%p]", account_id, password_length);
562 int err = EMF_ERROR_NONE;
564 if (account_id <= 0 || password_length == NULL) {
565 EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
566 err = EMF_ERROR_INVALID_PARAM;
570 HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_GET_PASSWORD_LENGTH_OF_ACCOUNT);
572 EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
575 if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int)))
576 EM_DEBUG_EXCEPTION(" ipcEmailAPI_AddParameter account_id failed ");
578 if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
579 EM_DEBUG_EXCEPTION(" ipcEmailProxy_ExecuteAPI failed ");
580 EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
583 ret = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0); /* return */
584 err = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 1); /* error code */
586 *password_length = *(int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 2);
588 ipcEmailAPI_Destroy(hAPI);
591 EM_DEBUG_FUNC_END("*password_length[%d]", *password_length);
595 EXPORT_API int email_update_notification_bar(int account_id)
597 EM_DEBUG_FUNC_BEGIN("account_id [%d]", account_id);
598 int err = EMF_ERROR_NONE, *return_value = NULL;
600 if (account_id == 0) {
601 EM_DEBUG_EXCEPTION("EMF_ERROR_INVALID_PARAM");
602 err = EMF_ERROR_INVALID_PARAM;
606 HIPC_API hAPI = ipcEmailAPI_Create(_EMAIL_API_UPDATE_NOTIFICATION_BAR_FOR_UNREAD_MAIL);
608 EM_IF_NULL_RETURN_VALUE(hAPI, EMF_ERROR_NULL_VALUE);
611 if(!ipcEmailAPI_AddParameter(hAPI, ePARAMETER_IN, (char*)&account_id, sizeof(int)))
612 EM_DEBUG_EXCEPTION(" ipcEmailAPI_AddParameter account_id failed");
614 if(!ipcEmailProxy_ExecuteAPI(hAPI)) {
615 EM_DEBUG_EXCEPTION(" ipcEmailProxy_ExecuteAPI failed ");
616 EM_PROXY_IF_NULL_RETURN_VALUE(0, hAPI, EMF_ERROR_IPC_SOCKET_FAILURE);
619 return_value = (int*)ipcEmailAPI_GetParameter(hAPI, ePARAMETER_OUT, 0); /* error code */;
623 ipcEmailAPI_Destroy(hAPI);
626 EM_DEBUG_FUNC_END("ret[%d]", err);
631 EXPORT_API int email_clear_all_notification_bar()
633 EM_DEBUG_FUNC_BEGIN();
635 int err = EMF_ERROR_NONE;
637 ret = em_core_clear_all_notifications();
639 EM_DEBUG_FUNC_END("ret[%d]", ret);
643 EXPORT_API int email_save_default_account_id(int input_account_id)
645 EM_DEBUG_FUNC_BEGIN("input_account_id [%d]", input_account_id);
647 int err = EMF_ERROR_NONE;
649 ret = em_core_save_default_account_id(input_account_id);
651 EM_DEBUG_FUNC_END("ret[%d]", ret);
655 EXPORT_API int email_load_default_account_id(int *output_account_id)
657 EM_DEBUG_FUNC_BEGIN("output_account_id [%p]", output_account_id);
659 int err = EMF_ERROR_NONE;
661 ret = em_core_load_default_account_id(output_account_id);
663 EM_DEBUG_FUNC_END("ret[%d]", ret);