tizen 2.3.1 release
[framework/web/mobile/wrt-plugins-tizen.git] / src / Messaging / MessageMMS.cpp
1 //
2 // Tizen Web Device API
3 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file        MessageMMS.cpp
20  */
21
22 #include <PlatformException.h>
23 #include <Logger.h>
24 #include "MessageMMS.h"
25 #include <GlobalContextManager.h>
26
27 namespace DeviceAPI {
28 namespace Messaging {
29
30 MessageMMS::MessageMMS():
31     Message()
32 {
33     LOGD("MessageMMS constructor.");
34     this->m_type = MessageType(MessageType(MMS));
35 }
36
37 MessageMMS::~MessageMMS()
38 {
39     LOGD("MessageMMS destructor.");
40 }
41
42 // *** overrided methods
43 void MessageMMS::setCC(std::vector<std::string> &cc)
44 {
45     // CC recipient's format validation should be done by email service
46     m_cc = cc;
47
48     if(m_cc.empty()) {
49         LOGD("Recipient's list cleared");
50         return;
51     }
52 }
53
54 void MessageMMS::setBCC(std::vector<std::string> &bcc)
55 {
56     // BCC recipient's format validation should be done by email service
57     m_bcc = bcc;
58
59     if(m_bcc.empty()) {
60         LOGD("Recipient's list cleared");
61         return;
62     }
63 }
64
65 void MessageMMS::setSubject(std::string subject)
66 {
67     m_subject = subject;
68 }
69
70 void MessageMMS::setMessageAttachments(AttachmentPtrVector &attachments)
71 {
72     m_attachments = attachments;
73
74     m_has_attachment = true;
75     if(m_attachments.empty()) {
76         LOGD("Recipient's list cleared");
77         m_has_attachment = false;
78     }
79 }
80
81 bool MessageMMS::getHasAttachment() const
82 {
83     LOGD("MessageMMS::getHasAttachment()");
84     // TODO: Analyze relation between hasAttachment flag and inlineAttachments
85     return m_has_attachment;
86 }
87
88 } // Messaging
89 } // DeviceAPI