Tizen 2.0 Release
[platform/core/messaging/email-service.git] / email-core / email-core-api.c
1 /*
2 *  email-service
3 *
4 * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
5 *
6 * Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>
7
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
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
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.
19 *
20 */
21
22
23 /******************************************************************************
24  * File :  email-core-api.h
25  * Desc :  Mail Engine API
26  *
27  * Auth : 
28  *
29  * History : 
30  *    2006.08.16  :  created
31  *****************************************************************************/
32 #include <stdio.h>
33 #include <string.h>
34 #include <stdlib.h>
35
36 #include "c-client.h"
37 #include "email-core-global.h"
38 #include "email-network.h"
39 #include "email-core-event.h"
40 #include "email-core-mailbox.h"
41 #include "email-core-utils.h"
42 #include "email-debug-log.h"
43
44 extern void *
45 pop3_parameters(long function, void *value);
46 extern void *
47 imap_parameters(long function, void *value);
48
49
50
51 /* initialize mail core */
52 INTERNAL_FUNC int emcore_init(int *err_code)
53 {
54         EM_DEBUG_FUNC_BEGIN();
55
56         if (err_code != NULL) {
57                 *err_code = EMAIL_ERROR_NONE;
58         }
59
60         mail_link(&imapdriver);  /*  link in the imap driver  */
61         mail_link(&pop3driver);  /*  link in the pop3 driver  */
62
63         mail_link(&unixdriver);  /*  link in the unix driver  */
64         mail_link(&dummydriver); /*  link in the dummy driver  */
65
66         ssl_onceonlyinit();
67
68         auth_link(&auth_md5);    /*  link in the md5 authenticator  */
69         auth_link(&auth_pla);    /*  link in the pla authenticator  */
70         auth_link(&auth_log);    /*  link in the log authenticator  */
71
72         /* Disabled to authenticate with plain text */
73         mail_parameters(NIL, SET_DISABLEPLAINTEXT, (void *) 2);
74
75         /* Set max trials for login */
76         imap_parameters(SET_MAXLOGINTRIALS, (void *)1);
77         pop3_parameters(SET_MAXLOGINTRIALS, (void *)1);
78         smtp_parameters(SET_MAXLOGINTRIALS, (void *)1);
79
80         mail_parameters(NIL, SET_SSLCERTIFICATEQUERY, (void *)emnetwork_callback_ssl_cert_query);
81         mail_parameters(NIL, SET_SSLCAPATH, (void *)SSL_CERT_DIRECTORY);
82
83         /* Set time out in second */
84         mail_parameters(NIL, SET_OPENTIMEOUT  , (void *)50);
85         mail_parameters(NIL, SET_READTIMEOUT  , (void *)180);
86         mail_parameters(NIL, SET_WRITETIMEOUT , (void *)180);
87         mail_parameters(NIL, SET_CLOSETIMEOUT , (void *)30);
88
89         if (err_code)
90                 *err_code = EMAIL_ERROR_NONE;
91
92     return true;
93 }
94