Name: wrt-plugins-tizen
Summary: JavaScript plugins for WebRuntime
-Version: 0.4.68
+Version: 0.4.69
Release: 0
Group: Development/Libraries
License: Apache License, Version 2.0
%install
rm -rf %{buildroot}
%make_install
+mkdir -p %{buildroot}/usr/share/license
+cp LICENSE %{buildroot}/usr/share/license/%{name}
%post
%manifest wrt-plugins-tizen.manifest
%{_libdir}/wrt-plugins/*
/usr/etc/tizen-apis/*
+/usr/share/license/%{name}
%files devel
%{_includedir}/*
WebAPIError.cpp
PropertyBag.cpp
JSArray.cpp
+ SecurityAccessor.cpp
+ JSTizenSecurityObject.cpp
)
ADD_LIBRARY(${COMMON_TARGET_NAME} SHARED ${SRCS})
--- /dev/null
+//
+// Tizen Web Device API
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+
+#include "JSTizenSecurityObject.h"
+
+#include <string>
+
+#include "PlatformException.h"
+#include "JSStringRefWrapper.h"
+#include "Logger.h"
+
+#define CLASS_NAME "TizenSecurityObject"
+
+#define TIZEN_SECURITY_PROPERTY_NAME "__tizenobj"
+
+namespace DeviceAPI {
+namespace Common {
+
+JSClassDefinition JSTizenSecurityObject::m_classInfo = {
+ 0,
+ kJSClassAttributeNone,
+ CLASS_NAME,
+ 0,
+ NULL, // staticValues
+ NULL, // staticFunctions
+ initialize,
+ finalize,
+ NULL, // hasProperty,
+ NULL, // getProperty,
+ NULL, // setProperty,
+ NULL, // deleteProperty,
+ NULL, // getPropertyNames,
+ NULL, // callAsFunction,
+ NULL, // callAsConstructor,
+ NULL, // hasInstance,
+ NULL // convertToType
+};
+
+JSClassRef JSTizenSecurityObject::m_jsClassRef = JSClassCreate(JSTizenSecurityObject::getClassInfo());
+
+const JSClassRef JSTizenSecurityObject::getClassRef()
+{
+ if (!m_jsClassRef)
+ m_jsClassRef = JSClassCreate(&m_classInfo);
+
+ return m_jsClassRef;
+}
+
+const JSClassDefinition* JSTizenSecurityObject::getClassInfo()
+{
+ return &m_classInfo;
+}
+
+void JSTizenSecurityObject::initialize(JSContextRef context, JSObjectRef object)
+{
+ if(!JSObjectGetPrivate(object))
+ {
+ LoggerE("JSTizenSecurityObject has been created with no priv object.");
+ }
+}
+
+void JSTizenSecurityObject::finalize(JSObjectRef object)
+{
+}
+
+void JSObjectSetSecurityAccessor(JSContextRef context, JSObjectRef object, SecurityAccessor* securityAccessor)
+{
+ JSObjectRef jsSecurityObj = JSObjectMake(context, JSTizenSecurityObject::getClassRef(), static_cast<void*>(securityAccessor));
+
+ DeviceAPI::Common::JSStringRefWrapper securityObjName(TIZEN_SECURITY_PROPERTY_NAME);
+
+ JSValueRef exception = NULL;
+ JSObjectSetProperty(context, object, securityObjName.get(), jsSecurityObj,
+ kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete, &exception);
+
+ if(exception != NULL)
+ throw(InvalidValuesException("Failed to assign security module."));
+}
+
+SecurityAccessor* JSObjectGetSecurityAccessor(JSContextRef context, JSObjectRef object)
+{
+ DeviceAPI::Common::JSStringRefWrapper securityObjName(TIZEN_SECURITY_PROPERTY_NAME);
+
+ JSValueRef exception = NULL;
+ JSValueRef jsSecurityVal = JSObjectGetProperty(context, object, securityObjName.get(), &exception);
+ if(exception != NULL)
+ throw(InvalidValuesException("Failed to get security module. (no property)"));
+
+ JSObjectRef jsSecurityObj = JSValueToObject(context, jsSecurityVal, &exception);
+ if(exception != NULL)
+ throw(InvalidValuesException("Failed to get security module. (not a object)"));
+
+ SecurityAccessor *priv = static_cast<SecurityAccessor*>(JSObjectGetPrivate(jsSecurityObj));
+ if(priv == NULL)
+ throw(InvalidValuesException("Failed to get security module. (no priv)"));
+
+ return priv;
+}
+
+} // Common
+} // DeviceAPI
--- /dev/null
+//
+// Tizen Web Device API
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+
+#ifndef __TIZEN_COMMON_JS_TIZEN_SECURITY_OBJECT_H__
+#define __TIZEN_COMMON_JS_TIZEN_SECURITY_OBJECT_H__
+
+#include <JavaScriptCore/JavaScript.h>
+#include "SecurityAccessor.h"
+
+namespace DeviceAPI {
+namespace Common {
+
+class JSTizenSecurityObject
+{
+private:
+ static const JSClassDefinition* getClassInfo();
+
+ static const JSClassRef getClassRef();
+
+ static JSClassDefinition m_classInfo;
+
+ static JSClassRef m_jsClassRef;
+
+ static void initialize(JSContextRef context, JSObjectRef object);
+
+ static void finalize(JSObjectRef object);
+
+ friend void JSObjectSetSecurityAccessor(JSContextRef context, JSObjectRef object, SecurityAccessor* securityAccessor);
+
+ friend SecurityAccessor* JSObjectGetSecurityAccessor(JSContextRef context, JSObjectRef object);
+};
+
+void JSObjectSetSecurityAccessor(JSContextRef context, JSObjectRef object, SecurityAccessor* securityAccessor);
+
+SecurityAccessor* JSObjectGetSecurityAccessor(JSContextRef context, JSObjectRef object);
+
+} // Common
+} // DeviceAPI
+
+#endif // __TIZEN_COMMON_JS_TIZEN_SECURITY_OBJECT_H__
--- /dev/null
+//
+// Tizen Web Device API
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#ifndef __TIZEN_COMMON_SECURITY_H__
+#define __TIZEN_COMMON_SECURITY_H__
+
+#include <Commons/FunctionDeclaration.h>
+#include "SecurityAccessor.h"
+#include "JSTizenSecurityObject.h"
+#include "JSWebAPIErrorFactory.h"
+
+#define DEFINE_GLOBAL_SECURITY_ACCESSOR(Variable_Name) \
+ DeviceAPI::Common::SecurityAccessor* Variable_Name = NULL
+
+#define INITAILIZE_GLOBAL_SECURITY_ACCESSOR(Variable_Name, AceCheckAccessFunction_Name) \
+ do { \
+ Variable_Name = new DeviceAPI::Common::SecurityAccessor(&AceCheckAccessFunction_Name); \
+ } while(0)
+
+#define FINALIZE_GLOBAL_SECURITY_ACCESSOR(Variable_Name) \
+ do { \
+ if(Variable_Name) { \
+ delete Variable_Name; \
+ Variable_Name = NULL; \
+ } \
+ } while(0)
+
+#define DEFINE_JSOBJECT_SECURITY_ACCESSOR_SETTER(Function_Name, SecurityAccessor_Object) \
+ void Function_Name(java_script_context_t ctx, \
+ js_object_instance_t, \
+ js_object_instance_t obj) \
+ { \
+ DeviceAPI::Common::JSObjectSetSecurityAccessor(static_cast<JSContextRef>(ctx), \
+ static_cast<JSObjectRef>(obj), SecurityAccessor_Object); \
+ }
+
+#define DEFINE_SECURITY_ACCESSOR_SETTER(Function_Name, PrivObjectType, SecurityAccessor_Object) \
+ void Function_Name(java_script_context_t, \
+ js_object_instance_t, \
+ js_object_instance_t object) \
+ { \
+ PrivObjectType* priv = \
+ static_cast<PrivObjectType*>(JSObjectGetPrivate(static_cast<JSObjectRef>(object))); \
+ DeviceAPI::Common::SecurityAccessor* accessor = \
+ static_cast<DeviceAPI::Common::SecurityAccessor*>(priv); \
+ accessor->copyAceCheckAccessFunction(SecurityAccessor_Object); \
+ }
+
+
+#define TIZEN_CHECK_ACCESS(context, exception, privateObject, functionName) \
+ do { \
+ using namespace WrtDeviceApis::Commons; \
+ DeviceAPI::Common::SecurityAccessor* accessor = \
+ static_cast<DeviceAPI::Common::SecurityAccessor*>(privateObject); \
+ if(accessor->isInitialized() == false) { \
+ return JSWebAPIErrorFactory::postException(context, exception, \
+ JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal security error"); \
+ } \
+ AceSecurityStatus status = accessor->invokeAceCheckAccessFunction(functionName); \
+ switch (status) { \
+ case AceSecurityStatus::InternalError: \
+ return JSWebAPIErrorFactory::postException(context, exception, \
+ JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error"); \
+ break; \
+ case AceSecurityStatus::PrivacyDenied: \
+ return JSWebAPIErrorFactory::postException(context, exception, \
+ JSWebAPIErrorFactory::SECURITY_ERROR, "The user blocks an application from calling this method."); \
+ break; \
+ case AceSecurityStatus::AccessDenied: \
+ return JSWebAPIErrorFactory::postException(context, exception, \
+ JSWebAPIErrorFactory::SECURITY_ERROR, "The application does not have the privilege to call this method."); \
+ break; \
+ default: \
+ break; \
+ } \
+ } while(0)
+
+#define TIZEN_ASYNC_CBM_ACCESS(context, privateObject, cbm, functionName) \
+ do { \
+ using namespace WrtDeviceApis::Commons; \
+ DeviceAPI::Common::SecurityAccessor* accessor = \
+ static_cast<DeviceAPI::Common::SecurityAccessor*>(privateObject); \
+ if(accessor->isInitialized() == false) { \
+ cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, \
+ JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal security error")); \
+ return JSValueMakeNull(context); \
+ } \
+ AceSecurityStatus status = accessor->invokeAceCheckAccessFunction(functionName); \
+ switch (status) { \
+ case AceSecurityStatus::InternalError: \
+ cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, \
+ JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error")); \
+ return JSValueMakeNull(context); \
+ case AceSecurityStatus::PrivacyDenied: \
+ cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, \
+ JSWebAPIErrorFactory::SECURITY_ERROR, "The user blocks an application from calling this method.")); \
+ return JSValueMakeNull(context); \
+ case AceSecurityStatus::AccessDenied: \
+ cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, \
+ JSWebAPIErrorFactory::SECURITY_ERROR, "The application does not have the privilege to call this method.")); \
+ return JSValueMakeNull(context); \
+ default: \
+ break; \
+ } \
+ } while (0)
+
+#endif // __TIZEN_COMMON_SECURITY_H__
--- /dev/null
+//
+// Tizen Web Device API
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include "SecurityAccessor.h"
+
+namespace DeviceAPI {
+namespace Common {
+
+SecurityAccessor::SecurityAccessor() :
+ m_aceCheckAccessFunc(NULL),
+ m_aceCheckAccessFuncInited(false)
+{
+}
+
+SecurityAccessor::SecurityAccessor(const AceCheckAccessFunction aceCheckAccessFunc) :
+ m_aceCheckAccessFunc(aceCheckAccessFunc),
+ m_aceCheckAccessFuncInited(true)
+{
+}
+
+SecurityAccessor::SecurityAccessor(const SecurityAccessor &securityAccessor) :
+ m_aceCheckAccessFunc(securityAccessor.m_aceCheckAccessFunc),
+ m_aceCheckAccessFuncInited(true)
+{
+}
+
+SecurityAccessor::SecurityAccessor(const SecurityAccessor *securityAccessor) :
+ m_aceCheckAccessFunc(securityAccessor->m_aceCheckAccessFunc),
+ m_aceCheckAccessFuncInited(true)
+{
+}
+
+SecurityAccessor::~SecurityAccessor()
+{
+}
+
+void SecurityAccessor::copyAceCheckAccessFunction(const SecurityAccessor &securityAccessor)
+{
+ setAceCheckAccessFunction(securityAccessor.m_aceCheckAccessFunc);
+}
+
+void SecurityAccessor::copyAceCheckAccessFunction(const SecurityAccessor *securityAccessor)
+{
+ setAceCheckAccessFunction(securityAccessor->m_aceCheckAccessFunc);
+}
+
+bool SecurityAccessor::isInitialized() const
+{
+ return m_aceCheckAccessFuncInited;
+}
+
+WrtDeviceApis::Commons::AceSecurityStatus SecurityAccessor::invokeAceCheckAccessFunction(const char *functionName) const
+{
+ if(m_aceCheckAccessFuncInited)
+ return m_aceCheckAccessFunc(functionName);
+ else
+ return WrtDeviceApis::Commons::AceSecurityStatus::InternalError;
+}
+
+void SecurityAccessor::setAceCheckAccessFunction(const AceCheckAccessFunction aceCheckAccessFunc)
+{
+ if(!m_aceCheckAccessFuncInited)
+ {
+ m_aceCheckAccessFunc = aceCheckAccessFunc;
+ m_aceCheckAccessFuncInited = true;
+ }
+}
+
+} // Common
+} // DeviceAPI
--- /dev/null
+//
+// Tizen Web Device API
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#ifndef __TIZEN_COMMON_SECURITY_ACCESSOR_H__
+#define __TIZEN_COMMON_SECURITY_ACCESSOR_H__
+
+#include <Commons/FunctionDeclaration.h>
+#include "JSWebAPIErrorFactory.h"
+
+namespace DeviceAPI {
+namespace Common {
+
+typedef WrtDeviceApis::Commons::AceSecurityStatus (*AceCheckAccessFunction)(const char *);
+
+class SecurityAccessor
+{
+public:
+ SecurityAccessor();
+ SecurityAccessor(const AceCheckAccessFunction aceCheckAccessFunc);
+ SecurityAccessor(const SecurityAccessor &securityAccessor);
+ SecurityAccessor(const SecurityAccessor *securityAccessor);
+ virtual ~SecurityAccessor();
+
+ virtual void copyAceCheckAccessFunction(const SecurityAccessor &securityAccessor);
+ virtual void copyAceCheckAccessFunction(const SecurityAccessor *securityAccessor);
+
+ virtual bool isInitialized() const;
+
+ virtual WrtDeviceApis::Commons::AceSecurityStatus invokeAceCheckAccessFunction(const char *functionName) const;
+
+private:
+ AceCheckAccessFunction m_aceCheckAccessFunc;
+ bool m_aceCheckAccessFuncInited;
+
+ void setAceCheckAccessFunction(const AceCheckAccessFunction aceCheckAccessFunc);
+};
+
+} // Common
+} // DeviceAPI
+
+#endif // __TIZEN_COMMON_SECURITY_ACCESSOR_H__
}
IPathPtr DLL_EXPORT fromVirtualPath(JSContextRef context,
- const std::string& arg)
+ const std::string arg)
{
LoggerD("arg:[" << arg << "]");
return result;
}
-std::string DLL_EXPORT toVirtualPath(JSContextRef context, const std::string& arg) {
+std::string DLL_EXPORT toVirtualPath(JSContextRef context, const std::string arg) {
int widgetId = WrtAccessSingleton::Instance().getWidgetId();
WidgetDB::Api::IWidgetDBPtr widgetDB =
namespace Utils{
IPathPtr fromVirtualPath(JSContextRef context,
- const std::string& arg);
+ const std::string arg);
-std::string toVirtualPath(JSContextRef context, const std::string& arg);
+std::string toVirtualPath(JSContextRef context, const std::string arg);
bool isPathValid(const std::string& path);
bool isUriPath(const std::string& path);
if(msgType == EMPTY_MESSAGE_CONVERSATION)
{
m_type = SMS;
- m_Id = 0;
+ m_Id = threadIndex;
}
else
{
if (!JSValueIsUndefined(context, htmlBodyData))
{
std::string body = JSUtil::JSValueToString(context, htmlBodyData);
- LoggerD("html body : " << body);
email->setHtmlBody(body);
}
if (!JSValueIsUndefined(context, plainBodyData) )
{
std::string body = JSUtil::JSValueToString(context, plainBodyData);
- LoggerD("plain body : " << body);
msg->setBody(body);
}
}
}
else if (JSStringIsEqualToUTF8CString(propertyName, PLAINBODY)) {
std::string body = msg->getBody();
- LoggerD("getPlainBody plainBody" << body );
return JSUtil::toJSValueRef(context, body);
}
else if (JSStringIsEqualToUTF8CString(propertyName, HTMLBODY)) {
if (msg->getMessageType() == EMAIL) {
IEmailPtr email = MessageFactory::convertToEmail(msg);
emailHtmlBody = email->getHtmlBody();
- LoggerD("Html Body : " << emailHtmlBody );
}
return JSUtil::toJSValueRef(context, emailHtmlBody);
}
IMessagePtr msg = getMessage(context, object);
std::string body = JSUtil::JSValueToString(context, value);
msg->setBody(body);
- LoggerD("setPlainBody plainBody" << body );
return true;
}
else if (JSStringIsEqualToUTF8CString(propertyName, HTMLBODY)) {
{
IEmailPtr email = MessageFactory::convertToEmail(msg);
std::string body = JSUtil::JSValueToString(context, value);
- LoggerD("input String : " << body);
email->setHtmlBody(body);
return true;
}
if (msgType == EMAIL)
{
IEmailPtr email = MessageFactory::convertToEmail(event->m_message);
- if (email && email->isBodyDownloaded() > 0)
- {
- callbackManager->callOnSuccess(converter->toJSValueRef(msg));
- return JSValueMakeUndefined(context);
- }
- }
- else
- {
- callbackManager->callOnSuccess(converter->toJSValueRef(msg));
- return JSValueMakeUndefined(context);
}
-
privateData->setMessageJSValueRef(arguments[0]); //set Message JSValueRef.
}
LoggerI(" Checked Message Type " );
m_dbusConnection->open(DBUS_BUS_SYSTEM);
}
+ if(m_onConversationReceived.size() == 1)
+ {
+ makeMsgConvIdList();
+ }
+
}
void Messaging::addOnMessageReceived(
m_onMessageReceivedHandleMgr = MsgServiceHandleMgrPtr(NULL);
m_dbusConnection->close();
}
+ if(m_onConversationReceived.size() == 0)
+ {
+ removeMsgConvIdList();
+ }
}
void Messaging::removeOnMessageFolderReceived(EmitterFolderReceived::IdType id)
if(storageChangeType == MSG_STORAGE_CHANGE_DELETE)
{
- IMessagePtr message = MessageFactory::createMessage(EMPTY_MESSAGE, pMsgIdList->msgIdList[index]);
- IConversationPtr conversation(new Conversation());
+ int tempInt = pMsgIdList->msgIdList[index];
+ IMessagePtr message = MessageFactory::createMessage(EMPTY_MESSAGE, tempInt);
+ tempInt = this_->getMsgConvId(tempInt);
+ IConversationPtr conversation(new Conversation(tempInt, EMPTY_MESSAGE_CONVERSATION));
EventMessageReceivedPtr event(new EventMessageReceived());
event->setMessage(message);
event->setConversation(conversation);
if(this_->m_onMessageReceived.size() > 0){
this_->m_onMessageReceived.emit(event);
}
- if(this_->m_onConversationReceived.size() > 0){
+ if((this_->m_onConversationReceived.size() > 0)&& this_->isMsgConvIdNoMoreExist(tempInt)){
this_->m_onConversationReceived.emit(event);
}
}
LoggerD("msgType : " << msgType);
if((msgType > MSG_TYPE_INVALID) && ( msgType <= MSG_TYPE_SMS_REJECT))
{
- if(msgType != MSG_TYPE_MMS_NOTI)
+ if(msgType != MSG_TYPE_MMS_NOTI)
{
int msgId = 0;
msg_get_int_value(msg, MSG_MESSAGE_ID_INT, &msgId);
if(this_->m_onConversationReceived.size() > 0){
int emitCheck = 0;
LoggerD("Message Status = " << message->getMessageStatus());
+ if(storageChangeType == MSG_STORAGE_CHANGE_INSERT)
+ {
+ this_->addMsgConvIdList(msgId, conversation->getConvId());
+ }
if((conversation->getMessageCount() == 1) && (storageChangeType == MSG_STORAGE_CHANGE_INSERT))
{
emitCheck = 1;
if(this_->m_onConversationReceived.size() > 0){
int emitCheck = 0;
LoggerD("Message Status = " << message->getMessageStatus());
+ if(storageChangeType == MSG_STORAGE_CHANGE_INSERT)
+ {
+ this_->addMsgConvIdList(msgId, conversation->getConvId());
+ }
if((conversation->getMessageCount() == 1) && (storageChangeType == MSG_STORAGE_CHANGE_INSERT))
{
emitCheck = 1;
LoggerD("Enter");
if (conversations.size() == 0)
- return false;
+ return true;
if (conversations[0]->getType() == EMAIL)
{
}
+void Messaging::makeMsgConvIdList()
+{
+ msg_handle_t handle = MsgGetCommonHandle();
+ msg_struct_t listCond = NULL;
+ msg_struct_list_s msgList = {0,};
+ int msgCount, tempInt_1, tempInt_2;
+ msg_error_t err = MSG_SUCCESS;
+
+ err = msg_get_message_list(handle, 0, 0, 0, 0, &msgList);
+
+ msgCount = msgList.nCount;
+
+ for(int i=0; i<msgCount; i++)
+ {
+ msg_get_int_value(msgList.msg_struct_info[i], MSG_MESSAGE_ID_INT, &tempInt_1);
+ msg_get_int_value(msgList.msg_struct_info[i], MSG_MESSAGE_THREAD_ID_INT, &tempInt_2);
+ LoggerD("tempInt_1 : " << tempInt_1 << " tempInt_2 : " << tempInt_2);
+ m_msgConvIdList.insert(std::pair<int,int>(tempInt_1, tempInt_2));
+ }
+ msg_release_list_struct(&msgList);
+
+}
+
+void Messaging::addMsgConvIdList(int msgId, int convId)
+{
+ m_msgConvIdList.insert(std::pair<int,int>(msgId, convId));
+}
+
+int Messaging::getMsgConvId(int msgId)
+{
+ int ret = 0;
+ std::map<int,int>::iterator it = m_msgConvIdList.find(msgId); //find reqeuset
+
+ if (m_msgConvIdList.end() != it) {
+ ret = it->second;
+ m_msgConvIdList.erase(msgId);
+ }
+ return ret;
+}
+
+bool Messaging::isMsgConvIdNoMoreExist(int convId)
+{
+ if (convId > 0) {
+ std::map<int,int>::iterator it = m_msgConvIdList.begin();
+ for (; it != m_msgConvIdList.end(); it++)
+ {
+ if(convId == it->second)
+ {
+ return FALSE;
+ }
+ }
+ }
+ else
+ {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+void Messaging::removeMsgConvIdList()
+{
+ m_msgConvIdList.clear();
+}
+
}
}
public:
virtual ~Messaging();
-
-/*
- virtual void getNumberOfMessages(MessageType msgType,
- FolderType folder,
- int* readed,
- int* unReaded);
-
- virtual std::vector<IMessagePtr> findMessages(
- const std::vector<MessageType>& msgTypes,
- FolderType folder,
- const DeviceAPI::Tizen::FilterPtr& filter);
-
- virtual std::vector<IMessagePtr> findMessages(
- const std::vector<MessageType>& msgTypes,
- const std::string &folder,
- const DeviceAPI::Tizen::FilterPtr& filter);
-
- virtual std::vector<IMessagePtr> findMessages(const DeviceAPI::Tizen::FilterPtr& filter,
- const DeviceAPI::Tizen::SortModePtr& sortMode, const long limit, const long offset);
-*/
virtual std::vector<IMessagePtr> findMessages(const DeviceAPI::Tizen::FilterPtr& filter,
const DeviceAPI::Tizen::SortModePtr& sortMode, const long limit, const long offset, const int type);
-// virtual std::vector<IMessagePtr> findMessages(const DeviceAPI::Tizen::FilterPtr& filter);
-
-// virtual std::vector<std::string> getMessageIds(MessageType msgType,
-// FolderType folder);
virtual void createFolder(MessageType msgType,
const std::string& userFolder);
std::vector<IConversationPtr> queryConversations(const DeviceAPI::Tizen::FilterPtr& filter, const DeviceAPI::Tizen::SortModePtr& sortMode, int type, long limit=0, long offset=0);
-// bool deleteConversations(const DeviceAPI::Tizen::SortModePtr& sortMode, const DeviceAPI::Tizen::FilterPtr& filter);
-
bool deleteConversations(const std::vector<IConversationPtr>& conversations);
std::vector<IMessageFolderPtr> queryFolders(const DeviceAPI::Tizen::FilterPtr& filter);
// MSG_MSGID_LIST_S *pMsgIdList,
msg_id_list_s *pMsgIdList,
void* data);
-/*
- static void onSmsReceived(MSG_HANDLE_T handle,
- msg_message_t msg,
- void* data);
- static void onMmsReceived(MSG_HANDLE_T handle,
- msg_message_t msg,
- void* data);
-*/
- private:
-/*
- void getNumberOfEmails(FolderType folder,
- int* read,
- int* unread);
-
- void getNumberOfSms(FolderType folder,
- int* read,
- int* unread);
-
- void getNumberOfMms(FolderType folder,
- int* read,
- int* unread);
-
- void getNumberOfSmsMms(FolderType folder,
- int* read,
- int* unread,
- MessageType msgType);
-
- virtual std::vector<IMessagePtr> findSms(FolderType folder,
- const DeviceAPI::Tizen::FilterPtr& filter);
-
- virtual std::vector<IMessagePtr> findMms(FolderType folder,
- const DeviceAPI::Tizen::FilterPtr& filter);
-
- virtual std::vector<IMessagePtr> findEmail(FolderType folder,
- const DeviceAPI::Tizen::FilterPtr& filter);
-
- virtual std::vector<IMessagePtr> findEmail(const std::string &folder,
- const DeviceAPI::Tizen::FilterPtr& filter);
-
- std::vector<std::string> getSmsIds(FolderType folder);
-
- std::vector<std::string> getMmsIds(FolderType folder);
-
- std::vector<std::string> getEmailIds(FolderType folder);
-*/
void createMsgServiceFolder(const std::string& userFolder);
std::vector<std::string> getFolderNamesEmail();
+ void makeMsgConvIdList();
+
+ void addMsgConvIdList(int msgId, int convId);
+
+ int getMsgConvId(int msgId);
+
+ bool isMsgConvIdNoMoreExist(int convId);
+
+ void removeMsgConvIdList();
void printErrorMessage(int errorCode);
MsgServiceHandleMgrPtr m_onMessageReceivedHandleMgr;
DBus::ConnectionPtr m_dbusConnection;
DPL::Thread* m_dbusWorkerThread;
+
+ typedef std::map<int, int> convIdList;
+ convIdList m_msgConvIdList;
};
}
}
} else {
LoggerE("body is not set");
}
- LoggerD("message body: '" << getBody() << "'");
fclose(f);
}
else
} else {
LoggerE("body is not set");
}
- LoggerD("message body: '" << getBody() << "'");
fclose(f);
}
else
fclose(f);
- LoggerD("getBodyRef(): " << getBodyRef());
-
msg_set_int_value(mms_struct, MSG_MMS_ROOTLAYOUT_WIDTH_INT, ROOT_LAYOUT_WIDTH);
msg_set_int_value(mms_struct, MSG_MMS_ROOTLAYOUT_HEIGHT_INT, ROOT_LAYOUT_HEIGHT);
msg_set_int_value(mms_struct, MSG_MMS_ROOTLAYOUT_BGCOLOR_INT, WHITE_COLOR);
}
}
else {
- LoggerD(" invaild message. ");
+ LoggerD(" invaild message. ");
event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException);
- }
-
+ }
}
else
{
if(attrName.compare(StorageChangesConversationFilterValidatorFactory::ATTRIBUTE_PREVIEW)==0){
LoggerD("<<< value:[" << value << "]");
LoggerD("<<< value->toString():[" << value->toString() << "]");
- LoggerD("<<< m_body:[" << m_preview << "]");
-
+
valueString = m_preview;
if(getMatchFlagResult(value, valueString, matchFlag))
{
m_priority = msg->getPriority();
m_subject = msg->getSubject();
m_messageStatus = msg->getMessageStatus();
-
-
- LoggerD("m_type:" << m_type );
- LoggerD("m_folder:" << m_folder );
- LoggerD("m_dateTime year:" << m_dateTime.tm_year + 1900 );
- LoggerD("m_dateTime mon:" << m_dateTime.tm_mon );
- LoggerD("m_dateTime day:" << m_dateTime.tm_mday );
- LoggerD("m_dateTime hour:" << m_dateTime.tm_hour );
- LoggerD("m_dateTime min:" << m_dateTime.tm_min );
- LoggerD("m_dateTime sec:" << m_dateTime.tm_sec );
- LoggerD("m_from:" << m_from );
- LoggerD("m_body:" << m_body );
- LoggerD("m_isRead:" << m_isRead );
- LoggerD("m_priority:" << m_priority );
- LoggerD("m_subject:" << m_subject );
-
+
}
StorageChangesMessageGenerator::~StorageChangesMessageGenerator() {
if(attrName.compare(StorageChangesMessageFilterValidatorFactory::ATTRIBUTE_BODY)==0){
LoggerD("<<< value:[" << value << "]");
LoggerD("<<< value->toString():[" << value->toString() << "]");
- LoggerD("<<< m_body:[" << m_body << "]");
valueString = m_body;
if(getMatchFlagResult(value, valueString, matchFlag))
NFCAdapter::~NFCAdapter() {
LoggerD("Enter");
- unsetTagListener();
- unsetPeerListener();
+ try {
+ unsetTagListener();
+ unsetPeerListener();
+ } catch(...) {
+ LoggerE("ignore exception");
+ }
m_EventNFCChangedSetPoweredPtr.Reset();
}
}
double PowerManager::getScreenBrightness(){
- int brightness;
+ int brightness, maxBrightness, ret;
brightness = getPlatformBrightness();
LOGI("Brightness value: %d", brightness);
- return brightness/100.0;
+ ret = device_get_max_brightness(0, &maxBrightness);
+ if( ret != 0 ){
+ LoggerE("Platform error while getting brightness: %d", ret);
+ throw UnknownException("Platform error while getting max brightness");
+ }
+ return (double)brightness/(double)maxBrightness;
}
void PowerManager::setScreenBrightness(double brightness){
- int ret;
+ int ret, maxBrightness;
if( brightness > 1 || brightness < 0 )
throw InvalidValuesException("brightness should be 0 <= brightness <= 1");
- int maxBrightness;
ret = device_get_max_brightness(0, &maxBrightness);
if( ret != 0 ){
LoggerE("Platform error while setting restore brightness: %d", ret);
}
void PowerManager::setPlatformBrightness(int brightness){
-
-
if( mCurrentState.mState == PowerState::SCREENDIM ){
mCurrentBrightness = brightness;
LOGI("Current state is not normal state the value is saved in cache: %d", brightness);
}else
mShouldBeReadFromCache = false;
+ LoggerD("brightness : " << brightness);
+
int ret = device_set_brightness(0, brightness);
if( ret != 0){
LoggerE("Platform error while setting %d brightness: %d", brightness, ret);
}
return convert.toJSValueRef(deviceCapabilitiesInfo->inputKeyboard);
} else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_INPUTKEYBOARD_LAYOUT)) {
- char* inputKeyboardLayout = NULL;
- if(system_info_get_platform_string("tizen.org/feature/input.keyboard.layout", &inputKeyboardLayout) == SYSTEM_INFO_ERROR_NONE) {
- if (inputKeyboardLayout) {
- deviceCapabilitiesInfo->inputKeyboardLayout = true;
- free(inputKeyboardLayout);
+ bool inputKeyboard = false;
+ if(system_info_get_platform_bool("tizen.org/feature/input.keyboard", &inputKeyboard) == SYSTEM_INFO_ERROR_NONE) {
+ deviceCapabilitiesInfo->inputKeyboardLayout = inputKeyboard;
} else {
- deviceCapabilitiesInfo->inputKeyboardLayout = false;
- }
- } else {
LoggerE("get fail inputKeyboardLayout value");
return JSValueMakeUndefined(context);
}