dom/mobilemessage/src/MobileMessageService.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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 "SmsSegmentInfo.h"
    11 namespace mozilla {
    12 namespace dom {
    13 namespace mobilemessage {
    15 NS_IMPL_ISUPPORTS(MobileMessageService, nsIMobileMessageService)
    17 /* static */ StaticRefPtr<MobileMessageService> MobileMessageService::sSingleton;
    19 /* static */ already_AddRefed<MobileMessageService>
    20 MobileMessageService::GetInstance()
    21 {
    22   if (!sSingleton) {
    23     sSingleton = new MobileMessageService();
    24     ClearOnShutdown(&sSingleton);
    25   }
    27   nsRefPtr<MobileMessageService> service = sSingleton.get();
    28   return service.forget();
    29 }
    31 NS_IMETHODIMP
    32 MobileMessageService::CreateSmsMessage(int32_t aId,
    33                                        uint64_t aThreadId,
    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,
    41                                        uint64_t aTimestamp,
    42                                        uint64_t aSentTimestamp,
    43                                        uint64_t aDeliveryTimestamp,
    44                                        bool aRead,
    45                                        JSContext* aCx,
    46                                        nsIDOMMozSmsMessage** aMessage)
    47 {
    48   return SmsMessage::Create(aId,
    49                             aThreadId,
    50                             aIccId,
    51                             aDelivery,
    52                             aDeliveryStatus,
    53                             aSender,
    54                             aReceiver,
    55                             aBody,
    56                             aMessageClass,
    57                             aTimestamp,
    58                             aSentTimestamp,
    59                             aDeliveryTimestamp,
    60                             aRead,
    61                             aCx,
    62                             aMessage);
    63 }
    65 NS_IMETHODIMP
    66 MobileMessageService::CreateMmsMessage(int32_t aId,
    67                                        uint64_t aThreadId,
    68                                        const nsAString& aIccId,
    69                                        const nsAString& aDelivery,
    70                                        JS::Handle<JS::Value> aDeliveryInfo,
    71                                        const nsAString& aSender,
    72                                        JS::Handle<JS::Value> aReceivers,
    73                                        uint64_t aTimestamp,
    74                                        uint64_t aSentTimestamp,
    75                                        bool aRead,
    76                                        const nsAString& aSubject,
    77                                        const nsAString& aSmil,
    78                                        JS::Handle<JS::Value> aAttachments,
    79                                        uint64_t aExpiryDate,
    80                                        bool aReadReportRequested,
    81                                        JSContext* aCx,
    82                                        nsIDOMMozMmsMessage** aMessage)
    83 {
    84   return MmsMessage::Create(aId,
    85                             aThreadId,
    86                             aIccId,
    87                             aDelivery,
    88                             aDeliveryInfo,
    89                             aSender,
    90                             aReceivers,
    91                             aTimestamp,
    92                             aSentTimestamp,
    93                             aRead,
    94                             aSubject,
    95                             aSmil,
    96                             aAttachments,
    97                             aExpiryDate,
    98                             aReadReportRequested,
    99                             aCx,
   100                             aMessage);
   101 }
   103 NS_IMETHODIMP
   104 MobileMessageService::CreateSmsSegmentInfo(int32_t aSegments,
   105                                            int32_t aCharsPerSegment,
   106                                            int32_t aCharsAvailableInLastSegment,
   107                                            nsIDOMMozSmsSegmentInfo** aSegmentInfo)
   108 {
   109   nsCOMPtr<nsIDOMMozSmsSegmentInfo> info =
   110       new SmsSegmentInfo(aSegments, aCharsPerSegment, aCharsAvailableInLastSegment);
   111   info.forget(aSegmentInfo);
   112   return NS_OK;
   113 }
   115 NS_IMETHODIMP
   116 MobileMessageService::CreateThread(uint64_t aId,
   117                                    JS::Handle<JS::Value> aParticipants,
   118                                    uint64_t aTimestamp,
   119                                    const nsAString& aLastMessageSubject,
   120                                    const nsAString& aBody,
   121                                    uint64_t aUnreadCount,
   122                                    const nsAString& aLastMessageType,
   123                                    JSContext* aCx,
   124                                    nsIDOMMozMobileMessageThread** aThread)
   125 {
   126   return MobileMessageThread::Create(aId,
   127                                      aParticipants,
   128                                      aTimestamp,
   129                                      aLastMessageSubject,
   130                                      aBody,
   131                                      aUnreadCount,
   132                                      aLastMessageType,
   133                                      aCx,
   134                                      aThread);
   135 }
   137 } // namespace mobilemessage
   138 } // namespace dom
   139 } // namespace mozilla

mercurial