2 * Copyright (c) 2011 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.
18 * @file ReqReceiverMessage.cpp
19 * @author Pawel Misiak (p.misiak@samsung.com)
24 #include <Commons/Exception.h>
25 #include "ReqReceiverMessage.h"
26 #include "IMessaging.h"
29 #include "MessageFilterValidatorFactory.h"
30 #include "ConversationFilterValidatorFactory.h"
31 #include "FolderFilterValidatorFactory.h"
34 #include <email-types.h>
35 #include <email-api.h>
36 #include <dpl/singleton_safe_impl.h>
38 IMPLEMENT_SAFE_SINGLETON(TizenApis::Api::Messaging::ReqReceiverMessage)
41 using namespace TizenApis::Api::Tizen;
42 using namespace TizenApis::Platform::Messaging;
43 using namespace WrtDeviceApis::Commons;
50 ReqReceiverMessage::ReqReceiverMessage() :
51 EventAddDraftMessageReqReceiver(ThreadEnum::MESSAGING_THREAD),
52 // EventSendMessageReqReceiver(ThreadEnum::MESSAGING_THREAD),
53 EventUpdateMessageReqReceiver(ThreadEnum::MESSAGING_THREAD),
54 // EventDeleteMessageReqReceiver(ThreadEnum::MESSAGING_THREAD),
55 EventDeleteMessagesReqReceiver(ThreadEnum::MESSAGING_THREAD),
56 EventUpdateMessagesReqReceiver(ThreadEnum::MESSAGING_THREAD),
57 EventQueryMessagesReqReceiver(ThreadEnum::MESSAGING_THREAD),
58 EventGetConversationIdReqReceiver(ThreadEnum::MESSAGING_THREAD),
59 EventQueryConversationsReqReceiver(ThreadEnum::MESSAGING_THREAD),
60 EventDeleteConversationsReqReceiver(ThreadEnum::MESSAGING_THREAD),
61 EventQueryFoldersReqReceiver(ThreadEnum::MESSAGING_THREAD),
62 EventMessagingServiceReqReceiver(ThreadEnum::MESSAGING_THREAD)
64 LogDebug("create receiver for messaging");
67 ReqReceiverMessage::~ReqReceiverMessage()
71 void ReqReceiverMessage::addDraftMessage(const EventAddDraftMessagePtr& event)
74 EventAddDraftMessageReqReceiver::PostRequest(event);
77 void ReqReceiverMessage::sendMessage(const EventSendMessagePtr& event)
80 EventSendMessageReqReceiver::PostRequest(event);
83 void ReqReceiverMessage::sendMessage(const EventMessagingServicePtr& event)
86 EventMessagingServiceReqReceiver::PostRequest(event);
89 void ReqReceiverMessage::updateMessage(const EventUpdateMessagePtr& event)
92 EventUpdateMessageReqReceiver::PostRequest(event);
96 void ReqReceiverMessage::deleteMessage(const EventDeleteMessagePtr& event)
99 EventDeleteMessageReqReceiver::PostRequest(event);
103 void ReqReceiverMessage::deleteMessages(const EventDeleteMessagesPtr& event)
106 EventDeleteMessagesReqReceiver::PostRequest(event);
109 void ReqReceiverMessage::updateMessages(const EventUpdateMessagesPtr& event)
112 EventUpdateMessagesReqReceiver::PostRequest(event);
115 void ReqReceiverMessage::queryMessages(const EventQueryMessagesPtr& event)
118 EventQueryMessagesReqReceiver::PostRequest(event);
122 void ReqReceiverMessage::getConversationId(const EventGetConversationIdPtr& event)
125 EventGetConversationIdReqReceiver::PostRequest(event);
128 void ReqReceiverMessage::queryConversations(const EventQueryConversationsPtr& event)
131 EventQueryConversationsReqReceiver::PostRequest(event);
134 void ReqReceiverMessage::deleteConversations(const EventDeleteConversationsPtr& event)
137 EventDeleteConversationsReqReceiver::PostRequest(event);
140 void ReqReceiverMessage::queryFolders(const EventQueryFoldersPtr& event)
143 EventQueryFoldersReqReceiver::PostRequest(event);
146 void ReqReceiverMessage::loadMessageBody(const EventMessagingServicePtr& event)
149 EventMessagingServiceReqReceiver::PostRequest(event);
152 void ReqReceiverMessage::loadMessageAttachment(const EventMessagingServicePtr& event)
155 EventMessagingServiceReqReceiver::PostRequest(event);
158 void ReqReceiverMessage::sync(const EventMessagingServicePtr& event)
161 EventMessagingServiceReqReceiver::PostRequest(event);
164 void ReqReceiverMessage::syncFolder(const EventMessagingServicePtr& event)
168 if (event && event->m_messagingService && event->m_messagingService->getAccountID() > 0)
171 email_account_t* accounts = NULL;
172 if (email_get_account( event->m_messagingService->getAccountID(), GET_FULL_DATA, &accounts))
174 LogDebug("accounts[0].incoming_server_type = " << accounts[0].incoming_server_type);
175 LogDebug("m_folder_name = " << event->m_folder_name);
176 if ( accounts[0].incoming_server_type == EMAIL_SERVER_TYPE_POP3 && event->m_folder_name != "INBOX" )
178 LogDebug("Can't Sync Folder because POP3 spec.");
179 ThrowMsg(WrtDeviceApis::Commons::UnsupportedException, "Operation Type is mismatched");
182 if (accounts != NULL)
184 email_free_account(&accounts, 1);
189 EventMessagingServiceReqReceiver::PostRequest(event);
193 bool ReqReceiverMessage::validateFilter(const Tizen::FilterPtr& filter){
196 bool retBool = false;
199 MessageFilterValidatorPtr validator =
200 MessageFilterValidatorFactory::getMessageFilterValidator();
202 FilterValidatorPtr filterValidator = DPL::StaticPointerCast<FilterValidator>(validator);
203 retBool = filter->validate(filterValidator);
204 LogDebug("retBool:" << retBool);
205 if(retBool == false){
206 MsgLogError(">>> Validate FAIL InvalidArgumentException");
207 Throw(WrtDeviceApis::Commons::InvalidArgumentException);
210 LogDebug("filter is NULL");
214 LogDebug(">>> retBool:" << retBool);
219 void ReqReceiverMessage::OnRequestReceived(const EventAddDraftMessagePtr& event)
224 IMessagePtr msg = event->msg;
225 if (!event->checkCancelled()) {
226 event->setCancelAllowed(false);
227 email_account_t* accounts = NULL;
229 if (msg->getMessageType() == Api::Messaging::EMAIL )
231 Api::Messaging::IEmailPtr email = Api::Messaging::MessageFactory::convertToEmail(msg);
234 if (email_get_account_list(&accounts, &count)) {
237 int index = (int)event->getIndex();
238 Api::Messaging::EmailAccountInfo account(accounts[index-1].account_id,
239 accounts[index-1].incoming_server_user_name,
240 accounts[index-1].user_email_address );
241 email->setEmailAccount(account);
243 if (accounts != NULL) {
244 email_free_account(&accounts, count);
249 Catch(WrtDeviceApis::Commons::PlatformException) {
250 if (accounts != NULL) {
251 email_free_account(&accounts, count);
253 MsgLogError("platform exception");
254 Throw(WrtDeviceApis::Commons::PlatformException);
260 msg->addMessageToDraft();
262 event->setCancelAllowed(true);
265 Catch(WrtDeviceApis::Commons::PlatformException) {
266 MsgLogError("platform exception");
267 event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException);
272 void ReqReceiverMessage::OnRequestReceived(const EventSendMessagePtr& event)
277 IMessagePtr msg = event->msg;
278 //this prevents calling BONDI, Tizen callback immidiately after leaving this function
279 //callback will be called after receving platform callback.
280 msg->setRequestReceiver(this);
281 msg->setSendMessageEvent(event);
282 if (!event->checkCancelled()) {
283 event->setCancelAllowed(false);
284 event->switchToManualAnswer();
285 if (msg->getMessageStatus() == Api::Messaging::MESSAGE_STATUS_CREATED ) //create message.
288 if (msg->getMessageType() == Api::Messaging::EMAIL )
290 Api::Messaging::IEmailPtr email = Api::Messaging::MessageFactory::convertToEmail(msg);
291 email->setEmailAccount(event->m_messagingService->getCurrentEmailAccount());
294 msg->addMessageToDraft(); //save
296 LogDebug("Message Status = " << msg->getMessageStatus());
297 LogDebug("Message ID = " << msg->getId());
300 int handle = msg->send();
301 LogDebug("handle : " << handle);
302 if (event->opId && event->m_messagingService)
304 event->m_messagingService->setHandleToOpId(event->opId, handle);
307 event->setCancelAllowed(true);
310 Catch(WrtDeviceApis::Commons::PlatformException) {
311 event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException);
312 WrtDeviceApis::Commons::EventRequestReceiver<EventSendMessage>::ManualAnswer(event);
316 void ReqReceiverMessage::OnRequestReceived(const EventUpdateMessagePtr& event)
321 IMessagePtr msg = event->msg;
322 if (!event->checkCancelled()) {
323 event->setCancelAllowed(false);
326 event->setCancelAllowed(true);
329 Catch(WrtDeviceApis::Commons::PlatformException) {
330 MsgLogError("platform exception");
331 event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException);
335 void ReqReceiverMessage::OnRequestReceived(const EventDeleteMessagePtr& event)
340 IMessagePtr msg = event->msg;
343 Catch(WrtDeviceApis::Commons::PlatformException) {
344 MsgLogError("platform exception");
345 event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException);
351 void ReqReceiverMessage::OnRequestReceived(const EventDeleteMessagesPtr& event)
357 Tizen::FilterPtr filter = event->getFilter();
359 bool isValidFilter = validateFilter(filter);
360 if(isValidFilter == false){
361 Throw(WrtDeviceApis::Commons::InvalidArgumentException);
364 event->msgArray = IMessaging::getInstance().findMessages(event->getFilter());
367 std::vector<Api::Messaging::IMessagePtr> msg = event->msgArray;
368 LogDebug("msg.size()" << msg.size());
370 int vecSize = msg.size();
371 for(int i=0; i < vecSize; i++){
372 int type = msg[i]->getMessageType();
373 std::string id = msg[i]->getId();
374 MsgLogError("type :"<<type);
375 MsgLogError("id :"<<id);
376 MsgLogError("body" << msg[i]->getBody());
379 }Catch(WrtDeviceApis::Commons::PlatformException) {
380 MsgLogError("platform exception");
381 event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException);
385 void ReqReceiverMessage::OnRequestReceived(const EventUpdateMessagesPtr& event)
390 std::vector<Api::Messaging::IMessagePtr> msg = event->msgArray;
391 LogDebug("msg.size()" << msg.size());
392 int vecSize = msg.size();
393 for(int i=0; i < vecSize; i++)
395 // int type = msg[i]->getMessageType();
396 std::string id = msg[i]->getId();
397 msg[i]->updateMessage();
398 // msg[i]->updateIsRead();
401 Catch(WrtDeviceApis::Commons::PlatformException) {
402 MsgLogError("platform exception");
403 event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException);
407 void ReqReceiverMessage::OnRequestReceived(const EventQueryMessagesPtr& event)
413 vector<IMessagePtr> msgs;
414 vector<IMessagePtr> tmp;
416 //check filter validation
417 Tizen::FilterPtr filter = event->getFilter();
418 bool isValidFilter = validateFilter(filter);
419 if(isValidFilter == false){
420 MsgLogError("[ERROR]this filter is invalid");
421 Throw(WrtDeviceApis::Commons::InvalidArgumentException);
425 LogDebug("event->getType() = " << event->getType());
426 if(event->getType() > Api::Messaging::UNKNOWN)
428 tmp = IMessaging::getInstance().findMessages(event->getFilter(), event->getSortMode(), event->getLimit(), event->getOffset(), event->getType());
432 // LogDebug("enter");
433 // tmp = IMessaging::getInstance().findMessages(event->getFilter(), event->getSortMode(), event->getLimit(), event->getOffset());
434 Throw(WrtDeviceApis::Commons::InvalidArgumentException);
437 msgs.insert(msgs.end(), tmp.begin(), tmp.end());
440 }Catch(WrtDeviceApis::Commons::PlatformException) {
441 MsgLogError("platform exception");
442 event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException);
443 }Catch(WrtDeviceApis::Commons::InvalidArgumentException){
444 MsgLogError("InvalidArgumentException");
445 event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException);
449 void ReqReceiverMessage::OnRequestReceived(const EventGetConversationIdPtr& event)
454 Api::Messaging::IMessagePtr msg = event->getConversationMsgPtr();
455 Api::Messaging::MessageType msgType = msg->getMessageType();
456 unsigned int msgId = 0;
458 if (msgType == EMAIL)
460 Api::Messaging::IEmailPtr email = Api::Messaging::MessageFactory::convertToEmail(msg);
461 msgId = email->getUID();
466 msgId = msg->convertId(msg->getId());
469 int conversationId = IMessaging::getInstance().getConversationId(msgId, msgType);
470 LogDebug("Cond Id:" << conversationId);
471 event->setConversationId(conversationId);
473 Catch(WrtDeviceApis::Commons::PlatformException) {
474 MsgLogError("platform exception");
475 event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException);
479 void ReqReceiverMessage::OnRequestReceived(const EventQueryConversationsPtr& event)
485 //check filter validation
486 Tizen::FilterPtr filter = event->getFilter();
487 vector<IConversationPtr> tmp;
489 ConversationFilterValidatorPtr validator =
490 ConversationFilterValidatorFactory::getConversationFilterValidator();
492 FilterValidatorPtr filterValidator = DPL::StaticPointerCast<FilterValidator>(validator);
493 bool isValidFilter = filter->validate(filterValidator);
494 if(isValidFilter == false){
495 MsgLogError("[ERROR]Filter is Invalid");
496 Throw(WrtDeviceApis::Commons::InvalidArgumentException);
499 LogDebug("event->getType() = "<<event->getType());
500 if(event->getType() > Api::Messaging::UNKNOWN)
502 tmp = IMessaging::getInstance().queryConversations(event->getFilter(), event->getSortMode(), event->getType(), event->getLimit(), event->getOffset());
506 // LogDebug("enter");
507 // tmp = IMessaging::getInstance().queryConversations(event->getSortMode(), event->getFilter(), event->getLimit(), event->getOffset());
508 Throw(WrtDeviceApis::Commons::InvalidArgumentException);
511 event->addConversations(tmp);
514 Catch(WrtDeviceApis::Commons::PlatformException)
516 MsgLogError("platform exception");
517 event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException);
519 Catch(WrtDeviceApis::Commons::InvalidArgumentException)
521 MsgLogError("InvalidArgumentException");
522 event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException);
526 void ReqReceiverMessage::OnRequestReceived(const EventMessagingServicePtr& event)
528 LogDebug("enter : EventMessagingServicePtr");
531 LogDebug("event type :" << event->getEventType() );
532 int MessagingServiceEventType = event->getEventType();
534 if (MessagingServiceEventType == MESSAGING_SERVICE_EVENT_TYPE_LOAD_MESSAGE_BODY)
536 if (!event->checkCancelled()) {
537 IMessagePtr msg = event->m_message;
541 msg->setRequestReceiver(this);
542 msg->setMessagingServiceEvent(event);
544 int type = msg->getMessageType();
545 LogDebug("message type :" << type);
546 if ( msg->getMessageType() == Api::Messaging::EMAIL )
548 IEmailPtr email = MessageFactory::convertToEmail(msg);
549 event->switchToManualAnswer(); //switch to manual answer;
550 int handle = email->downloadBody();
551 LogDebug("Load Message Body handle : " << handle);
552 if (event->opId && event->m_messagingService)
554 event->m_messagingService->setHandleToOpId(event->opId, handle);
558 event->setHandle(handle); //set handle
563 LogDebug(" invaild message. ");
564 event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException);
570 LogDebug(" Cancel ");
571 event->setCancelAllowed(true);
575 else if (MessagingServiceEventType == MESSAGING_SERVICE_EVENT_TYPE_LOAD_MESSAGE_ATTACHMENT)
577 if (!event->checkCancelled()) {
578 IMessagePtr msg = event->m_message;
581 msg->setRequestReceiver(this);
582 msg->setMessagingServiceEvent(event);
584 int type = msg->getMessageType();
585 LogDebug("message type :" << type);
586 if ( msg->getMessageType() == Api::Messaging::EMAIL )
588 IEmailPtr email = MessageFactory::convertToEmail(msg);
589 event->switchToManualAnswer(); //switch to manual answer;
590 int handle = email->downloadAttachment(event->m_attachment);
591 LogDebug("Load Message Attachment handle : " << handle);
592 if (event->opId && event->m_messagingService)
594 event->m_messagingService->setHandleToOpId(event->opId, handle);
598 event->setHandle(handle); //set handle
603 LogDebug(" invaild message. ");
604 event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException);
610 LogDebug(" cancel. ");
611 event->setCancelAllowed(true);
616 else if (MessagingServiceEventType == MESSAGING_SERVICE_EVENT_TYPE_SYNC)
618 if (event->m_messagingService)
620 if (!event->checkCancelled()) {
621 int type = event->m_messagingService->getType();
622 LogDebug("messaging service type :" << type);
624 event->m_messagingService->setRequestReceiver(this);
625 event->m_messagingService->setMessagingServiceEvent(event); //
627 if (type == Api::Messaging::EMAIL)
629 event->switchToManualAnswer(); //switch to manual answer;
630 LogDebug("privateData->getAccountId() :" << event->m_messagingService->getAccountID());
632 if ( event->m_messagingService->getAccountID() > 0)
634 int handle = event->m_messagingService->sync( event->m_messagingService, event->m_sync_limit );
635 LogDebug("Sync handle : " << handle);
636 if (event->opId && event->m_messagingService)
638 event->m_messagingService->setHandleToOpId(event->opId, handle);
642 event->setHandle(handle); //set handle
647 event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException);
651 event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException);
656 LogDebug(" cancel. ");
657 event->setCancelAllowed(true);
662 else if (MessagingServiceEventType == MESSAGING_SERVICE_EVENT_TYPE_SYNC_FOLDER)
664 if (event->m_messagingService)
666 if (!event->checkCancelled()) {
667 int type = event->m_messagingService->getType();
668 LogDebug("messaging service type :" << type);
670 event->m_messagingService->setRequestReceiver(this);
671 event->m_messagingService->setMessagingServiceEvent(event);
672 if (type == Api::Messaging::EMAIL)
674 event->switchToManualAnswer(); //switch to manual answer;
675 LogDebug("privateData->getAccountId() :" << event->m_messagingService->getAccountID());
677 if ( event->m_messagingService->getAccountID() > 0)
679 int handle = event->m_messagingService->syncFolder( event->m_messagingService, event->m_sync_folder_id, event->m_sync_limit);
680 LogDebug("Sync Folder handle : " << handle);
681 if (event->opId && event->m_messagingService)
683 event->m_messagingService->setHandleToOpId(event->opId, handle);
687 event->setHandle(handle); //set handle
691 event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException);
695 event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException);
700 LogDebug(" cancel. ");
701 event->setCancelAllowed(true);
705 else if (MessagingServiceEventType == MESSAGING_SERVICE_EVENT_TYPE_SEND_MESSAGE)
707 IMessagePtr msg = event->m_message;
708 msg->setRequestReceiver(this);
709 msg->setMessagingServiceEvent(event);
710 if (!event->checkCancelled())
712 event->switchToManualAnswer();
713 if (msg->getMessageStatus() == Api::Messaging::MESSAGE_STATUS_CREATED ) //create message.
716 if (msg->getMessageType() == Api::Messaging::EMAIL )
718 Api::Messaging::IEmailPtr email = Api::Messaging::MessageFactory::convertToEmail(msg);
719 email->setEmailAccount(event->m_messagingService->getCurrentEmailAccount());
722 // msg->addMessageToDraft(); //save
723 msg->createSendMessage();
724 LogDebug("Message Status = " << msg->getMessageStatus());
725 LogDebug("Message ID = " << msg->getId());
728 int handle = msg->send();
729 LogDebug("handle : " << handle);
730 if (event->opId && event->m_messagingService)
732 event->m_messagingService->setHandleToOpId(event->opId, handle);
737 event->setHandle(handle); //set handle
745 LogDebug(" Cancel ");
746 event->setCancelAllowed(true);
750 Catch (WrtDeviceApis::Commons::PlatformException) {
751 MsgLogError("platform exception");
752 event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException);
754 Catch (WrtDeviceApis::Commons::ConversionException) {
755 MsgLogError("conversion exception");
756 event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::ConversionException);
761 void ReqReceiverMessage::OnRequestReceived(const EventDeleteConversationsPtr& event)
767 if (event->isFilterUsing())
769 LogDebug("filter use");
771 //check filter validation
772 FilterPtr filter = event->getFilter();
775 ConversationFilterValidatorPtr validator =
776 ConversationFilterValidatorFactory::getConversationFilterValidator();
779 FilterValidatorPtr filterValidator = DPL::StaticPointerCast<FilterValidator>(validator);
780 bool isValidFilter = filter->validate(filterValidator);
782 if(isValidFilter == false)
784 Throw(WrtDeviceApis::Commons::InvalidArgumentException);
788 if (IMessaging::getInstance().deleteConversations(event->getSortMode(), event->getFilter()) == false)
790 Throw(WrtDeviceApis::Commons::PlatformException);
792 //.queryConversations(event->getSortMode(), event->getFilter());
796 LogDebug("no filter");
798 if (IMessaging::getInstance().deleteConversations(event->getConversations()) == false)
800 Throw(WrtDeviceApis::Commons::PlatformException);
804 Catch(WrtDeviceApis::Commons::PlatformException)
806 MsgLogError("platform exception");
807 event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException);
809 Catch(WrtDeviceApis::Commons::InvalidArgumentException)
811 MsgLogError("InvalidArgumentException");
812 event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException);
816 void ReqReceiverMessage::OnRequestReceived(const EventQueryFoldersPtr& event)
823 //check filter validation
824 Tizen::FilterPtr filter = event->getFilter();
826 FolderFilterValidatorPtr validator =
827 FolderFilterValidatorFactory::getFolderFilterValidator();
829 FilterValidatorPtr filterValidator = DPL::StaticPointerCast<FilterValidator>(validator);
831 bool isValidFilter = filter->validate(filterValidator);
832 if(isValidFilter == false){
833 MsgLogError("[ERROR]Filter is Invalid");
834 Throw(WrtDeviceApis::Commons::InvalidArgumentException);
839 vector<IMessageFolderPtr> tmp = IMessaging::getInstance().queryFolders(event->getFilter());
840 event->addFolders(tmp);
842 Catch(WrtDeviceApis::Commons::PlatformException)
844 MsgLogError("platform exception");
845 event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException);
847 Catch(WrtDeviceApis::Commons::InvalidArgumentException)
849 MsgLogError("InvalidArgumentException");
850 event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException);