1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "SmsMessage.h"
6 #include "MmsMessage.h"
7 #include "MobileMessageThread.h"
8 #include "MobileMessageService.h"
9 #include "DeletedMessageInfo.h"
13 namespace mobilemessage
{
15 NS_IMPL_ISUPPORTS(MobileMessageService
, nsIMobileMessageService
)
17 /* static */ StaticRefPtr
<MobileMessageService
> MobileMessageService::sSingleton
;
19 /* static */ already_AddRefed
<MobileMessageService
>
20 MobileMessageService::GetInstance()
23 sSingleton
= new MobileMessageService();
24 ClearOnShutdown(&sSingleton
);
27 nsRefPtr
<MobileMessageService
> service
= sSingleton
.get();
28 return service
.forget();
32 MobileMessageService::CreateSmsMessage(int32_t aId
,
34 const nsAString
& aIccId
,
35 const nsAString
& aDelivery
,
36 const nsAString
& aDeliveryStatus
,
37 const nsAString
& aSender
,
38 const nsAString
& aReceiver
,
39 const nsAString
& aBody
,
40 const nsAString
& aMessageClass
,
42 uint64_t aSentTimestamp
,
43 uint64_t aDeliveryTimestamp
,
46 nsIDOMMozSmsMessage
** aMessage
)
48 return SmsMessage::Create(aId
,
66 MobileMessageService::CreateMmsMessage(int32_t aId
,
68 const nsAString
& aIccId
,
69 const nsAString
& aDelivery
,
70 JS::Handle
<JS::Value
> aDeliveryInfo
,
71 const nsAString
& aSender
,
72 JS::Handle
<JS::Value
> aReceivers
,
74 uint64_t aSentTimestamp
,
76 const nsAString
& aSubject
,
77 const nsAString
& aSmil
,
78 JS::Handle
<JS::Value
> aAttachments
,
80 bool aReadReportRequested
,
82 nsIDOMMozMmsMessage
** aMessage
)
84 return MmsMessage::Create(aId
,
104 MobileMessageService::CreateThread(uint64_t aId
,
105 JS::Handle
<JS::Value
> aParticipants
,
107 const nsAString
& aLastMessageSubject
,
108 const nsAString
& aBody
,
109 uint64_t aUnreadCount
,
110 const nsAString
& aLastMessageType
,
112 nsIDOMMozMobileMessageThread
** aThread
)
114 return MobileMessageThread::Create(aId
,
126 MobileMessageService::CreateDeletedMessageInfo(int32_t* aMessageIds
,
128 uint64_t* aThreadIds
,
129 uint32_t aThreadCount
,
130 nsIDeletedMessageInfo
** aDeletedInfo
)
132 return DeletedMessageInfo::Create(aMessageIds
,
139 } // namespace mobilemessage
141 } // namespace mozilla