2 * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef MSG_UTIL_FUNCTION_H
18 #define MSG_UTIL_FUNCTION_H
20 #define MSG_UTIL_CH_EMAIL_AT '@'
22 /*==================================================================================================
24 ==================================================================================================*/
25 #include "MsgStorageTypes.h"
26 #include "MsgSettingTypes.h"
27 #include "MsgFilterTypes.h"
28 #include "MsgInternalTypes.h"
29 #include "MsgCmdTypes.h"
33 /*==================================================================================================
35 ==================================================================================================*/
37 #define MSG_TYPE_CHECK(a, b) \
39 if(a != (b & 0xff00)) {\
40 return MSG_ERR_INVALID_PARAMETER; \
44 /*==================================================================================================
46 ==================================================================================================*/
48 bool MsgCheckFeatureSupport(const char *feature_name);
50 int MsgContactGetMinMatchDigit();
53 int MsgEncodeCountInfo(MSG_COUNT_INFO_S *pCountInfo, char **ppDest);
55 int MsgEncodeCountByMsgType(int MsgCount, char **ppDest);
57 int MsgEncodeRecipientList(MSG_RECIPIENTS_LIST_S *pRecipientList, char **ppDest);
59 int MsgEncodeMsgId(msg_message_id_t *pMsgId, char **ppDest);
61 int MsgEncodeMsgInfo(const MSG_MESSAGE_INFO_S *pMsgInfo, char **ppDest);
63 int MsgEncodeMsgInfo(MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S* pSendOptInfo, char **ppDest);
65 int MsgEncodeFolderViewList(msg_struct_list_s *pFolderViewList, char **ppDest);
67 int MsgEncodeFolderList(msg_struct_list_s *pFolderList, char **ppDest);
69 int MsgEncodeSetting(MSG_SETTING_S *pSetting, char **ppDest);
71 int MsgEncodeFilterList(msg_struct_list_s *pFilterList, char **ppDest);
73 int MsgEncodeFilterFlag(bool *pSetFlag, char **ppDest);
75 int MsgEncodeThreadViewList(msg_struct_list_s *pThreadViewList, char **ppDest);
77 int MsgEncodeConversationViewList(msg_struct_list_s *pConvViewList, char **ppDest);
79 int MsgEncodeMsgGetContactCount(MSG_THREAD_COUNT_INFO_S *threadCountInfo, char **ppDest);
81 int MsgEncodeMemSize(unsigned int *memsize, char **ppDest);
83 int MsgEncodeSyncMLOperationData(int msgId, int extId, char **ppDest);
85 int MsgEncodeStorageChangeData(const msg_storage_change_type_t storageChangeType, const msg_id_list_s *pMsgIdList, char **ppDest);
87 int MsgEncodeReportMsgData(const msg_report_type_t msgReportType, const MSG_MESSAGE_INFO_S *pMsgInfo, char **ppDest);
89 int MsgEncodeReportStatus(MSG_REPORT_STATUS_INFO_S* pReportStatus, int count, char **ppDest);
91 int MsgEncodeThreadId(msg_thread_id_t *pThreadId, char **ppDest);
93 int MsgEncodeThreadInfo(MSG_THREAD_VIEW_S *pThreadInfo, char **ppDest);
97 void MsgDecodeMsgId(char *pSrc, msg_message_id_t *pMsgId);
99 void MsgDecodeCountInfo(char *pSrc, MSG_COUNT_INFO_S *pCountInfo);
101 void MsgDecodeMsgInfo(char *pSrc, MSG_MESSAGE_INFO_S *pMsgInfo);
103 void MsgDecodeMsgInfo(char *pSrc, MSG_MESSAGE_INFO_S *pMsgInfo, MSG_SENDINGOPT_INFO_S* pSendOptInfo);
105 void MsgDecodeFolderViewList(char *pSrc, msg_struct_list_s *pFolderViewList);
107 void MsgDecodeRecipientList(char *pSrc, MSG_RECIPIENTS_LIST_S *pRecipientList);
109 void MsgDecodeFolderList(char *pSrc, msg_struct_list_s *pFolderList);
111 void MsgDecodeSetting(char *pSrc, MSG_SETTING_S *pSetting);
113 void MsgDecodeFilterList(char *pSrc, msg_struct_list_s *pFilterList);
115 void MsgDecodeFilterFlag(char *pSrc, bool *pSetFlag);
117 void MsgDecodeMsgType(char *pSrc, MSG_MESSAGE_TYPE_S* pMsgType);
119 void MsgDecodeContactCount(char *pSrc, MSG_THREAD_COUNT_INFO_S *pMsgThreadCountList);
121 void MsgDecodeMemSize(char *pSrc, unsigned int *memsize);
123 void MsgDecodeReportStatus(char *pSrc, msg_struct_list_s *report_list);
125 void MsgDecodeThreadId(char *pSrc, msg_thread_id_t *pThreadId);
127 void MsgDecodeThreadInfo(char *pSrc, MSG_THREAD_VIEW_S *pThreadInfo);
131 int MsgMakeEvent(const void *pData, int DataSize, MSG_EVENT_TYPE_T MsgEvent, msg_error_t MsgError, void **ppEvent);
135 int msg_verify_number(const char *raw, char *trimmed);
137 int msg_verify_email(const char *raw);
139 char* msg_clean_country_code(char *src);
141 char* msg_normalize_number(char *src);
143 char *getTranslateText(const char *pkg_name, const char *locale_dir, const char *text);
145 msg_error_t MsgMakeSortRule(const MSG_SORT_RULE_S *pSortRule, char *pSqlSort);
147 bool msg_is_valid_email(char *pAddress);
149 msg_error_t msg_write_text_to_msg_info(MSG_MESSAGE_INFO_S *pMsgInfo, char *text);
151 void msg_replace_available_file_name(char *fileName);
153 void msg_replace_space_char(char *pszText);
155 gchar * msg_replace_non_ascii_char(const gchar *pszText, gunichar replacementChar);
157 uid_t msg_get_login_user();
159 msg_error_t msg_launch_app(const char *app_id, bundle *bundle_data);
161 msg_error_t msg_aul_svc_set_operation(bundle *bundle_data, const char *operation);
163 msg_error_t msg_aul_svc_set_uri(bundle *bundle_data, char *uri);
167 void MsgDbusDeinit();
169 #endif /* MSG_UTIL_FUNCTION_H */