Tizen 2.0 Release
[platform/core/messaging/email-service.git] / email-common-use / include / email-utilities.h
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  * email-utilities.h
24  *
25  *  Created on: 2012. 3. 6.
26  *      Author: kyuho.jo@samsung.com
27  */
28
29 #ifndef __EMAIL_UTILITIES_H__
30 #define __EMAIL_UTILITIES_H__
31
32 #include "email-types.h"
33 #include "email-internal-types.h"
34 #include "email-debug-log.h"
35 #include "email-storage.h"
36
37 INTERNAL_FUNC void* em_malloc(int len);
38 INTERNAL_FUNC void* em_memdup(void* src, int len);
39 INTERNAL_FUNC char* em_trim_left(char *str);
40 INTERNAL_FUNC char* em_trim_right(char *str);
41 INTERNAL_FUNC char* em_upper_string(char *str);
42 INTERNAL_FUNC char* em_lower_string(char *str);
43 INTERNAL_FUNC int   em_upper_path(char *path);
44
45 INTERNAL_FUNC void  em_skip_whitespace(char *addr_str , char **pAddr);
46 INTERNAL_FUNC char* em_skip_whitespace_without_strdup(char *source_string);
47 INTERNAL_FUNC char* em_replace_all_string(char *source_string, char *old_string, char *new_string);
48 INTERNAL_FUNC char* em_replace_string(char *source_string, char *old_string, char *new_string);
49 INTERNAL_FUNC void  em_flush_memory();
50 INTERNAL_FUNC int   em_get_file_name_from_file_path(char *input_source_file_path, char **output_file_name);
51 INTERNAL_FUNC int   em_get_file_name_and_extension_from_file_path(char *input_source_file_path, char **output_file_name, char **output_extention);
52 INTERNAL_FUNC char* em_get_extension_from_file_path(char *source_file_path, int *err_code);
53 INTERNAL_FUNC int   em_get_encoding_type_from_file_path(const char *input_file_path, char **output_encoding_type);
54 INTERNAL_FUNC int   em_get_content_type_from_extension_string(const char *extension_string, int *err_code);
55
56 INTERNAL_FUNC int   em_verify_email_address(char *address, int without_bracket, int *err_code);
57 INTERNAL_FUNC int   em_verify_email_address_of_mail_data(email_mail_data_t *mail_data, int without_bracket, int *err_code);
58 INTERNAL_FUNC int   em_verify_email_address_of_mail_tbl(emstorage_mail_tbl_t *input_mail_tbl, int input_without_bracket);
59
60 INTERNAL_FUNC int   em_find_pos_stripped_subject_for_thread_view(char *subject, char *stripped_subject, int stripped_subject_buffer_size);
61 INTERNAL_FUNC int   em_find_tag_for_thread_view(char *subject, int *result);
62
63 INTERNAL_FUNC int   em_encode_base64(char *src, unsigned long src_len, char **enc, unsigned long* enc_len, int *err_code);
64 INTERNAL_FUNC int   em_decode_base64(unsigned char *enc_text, unsigned long enc_len, char **dec_text, unsigned long* dec_len, int *err_code);
65
66 extern        char* strcasestr(__const char *__haystack, __const char *__needle) __THROW __attribute_pure__ __nonnull ((1, 2));
67
68 INTERNAL_FUNC int   em_get_account_server_type_by_account_id(int account_id, email_account_server_t* account_server_type, int flag, int *error);
69
70 INTERNAL_FUNC int   em_get_handle_for_activesync(int *handle, int *error);
71 INTERNAL_FUNC int   em_send_notification_to_active_sync_engine(int subType, ASNotiData *data);
72
73 #endif /* __EMAIL_UTILITIES_H__ */