Bug 849739 1/4 - WebSMS: Replace GetThreadList() with DOMCursor based GetThreads(). Interface changes. sr=mounir, r=bent

This commit is contained in:
Vicamo Yang 2013-04-10 00:37:50 +08:00
parent 9b46a05253
commit f35f3fbcde
10 changed files with 63 additions and 30 deletions

View File

@ -20,7 +20,7 @@ dictionary MmsParameters
jsval attachments; // MmsAttachment[]
};
[scriptable, builtinclass, uuid(44346294-6c8f-4a06-a412-1f38f7d45f2e)]
[scriptable, builtinclass, uuid(370da692-b79a-45d3-a07a-f9284e8c392b)]
interface nsIDOMMozMobileMessageManager : nsIDOMEventTarget
{
nsIDOMMozSmsSegmentInfo getSegmentInfoForText(in DOMString text);
@ -39,11 +39,13 @@ interface nsIDOMMozMobileMessageManager : nsIDOMEventTarget
// The parameter can be either a message id or a nsIDOMMoz{Mms,Sms}Message.
nsIDOMDOMRequest delete(in jsval param);
// Iterates through nsIDOMMoz{Mms,Sms}Message.
nsIDOMDOMCursor getMessages(in nsIDOMMozSmsFilter filter, in boolean reverse);
nsIDOMDOMRequest markMessageRead(in long id, in boolean aValue);
nsIDOMMozSmsRequest getThreadList();
// Iterates through nsIDOMMozMobileMessageThread.
nsIDOMDOMCursor getThreads();
nsIDOMDOMRequest retrieveMMS(in long id);

View File

@ -0,0 +1,26 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
[scriptable, builtinclass, uuid(ebc1db1a-07f9-4d79-b487-150298900ccc)]
interface nsIDOMMozMobileMessageThread : nsISupports
{
// Unique identity of the thread.
readonly attribute unsigned long long id;
// Message body of the last message in the thread.
readonly attribute DOMString body;
// Total unread messages in the thread.
readonly attribute unsigned long long unreadCount;
// Participant addresses of the thread.
[implicit_jscontext]
readonly attribute jsval participants; // DOMString[]
// Timestamp of the last message in the thread.
[implicit_jscontext]
readonly attribute jsval timestamp; // jsval is for Date.
};

View File

@ -10,7 +10,7 @@ interface nsIDOMMozSmsRequest;
interface nsIDOMMozSmsFilter;
interface nsIDOMMozSmsSegmentInfo;
[scriptable, builtinclass, uuid(aa03b43e-82ec-4325-906e-a1ea018e1b01)]
[scriptable, builtinclass, uuid(7371acd3-136b-4081-b368-8f5c69a22103)]
interface nsIDOMMozSmsManager : nsIDOMEventTarget
{
nsIDOMMozSmsSegmentInfo getSegmentInfoForText(in DOMString text);
@ -27,11 +27,13 @@ interface nsIDOMMozSmsManager : nsIDOMEventTarget
// The parameter can be either a message id or a SmsMessage.
nsIDOMMozSmsRequest delete(in jsval param);
// Iterates through nsIDOMMozSmsMessage.
nsIDOMDOMCursor getMessages(in nsIDOMMozSmsFilter filter, in boolean reverse);
nsIDOMMozSmsRequest markMessageRead(in long id, in boolean aValue);
nsIDOMMozSmsRequest getThreadList();
// Iterates through nsIDOMMozMobileMessageThread.
nsIDOMDOMCursor getThreads();
[implicit_jscontext] attribute jsval onreceived;
[implicit_jscontext] attribute jsval onsending;

View File

@ -13,7 +13,7 @@ dictionary SmsThreadListItem
unsigned long long unreadCount;
};
[scriptable, builtinclass, uuid(47498737-972d-49c9-8d4e-80ae2da51778)]
[scriptable, builtinclass, uuid(5e993cfc-fb34-46a8-bb14-3df5c09ff748)]
interface nsIMobileMessageCallback : nsISupports
{
/**
@ -44,8 +44,4 @@ interface nsIMobileMessageCallback : nsISupports
void notifyMessageMarkedRead(in boolean read);
void notifyMarkMessageReadFailed(in long error);
[implicit_jscontext]
void notifyThreadList(in jsval threadList);
void notifyThreadListFailed(in long error);
};

View File

@ -16,7 +16,7 @@ interface nsIDOMMozSmsFilter;
interface nsIMobileMessageCallback;
interface nsIMobileMessageCursorCallback;
[scriptable, uuid(487d15e1-fd23-40cc-ba45-7c0115032e17)]
[scriptable, uuid(ec1ca45f-e621-4c67-9c50-74c16842e780)]
interface nsIMobileMessageDatabaseService : nsISupports
{
[binaryname(GetMessageMoz)]
@ -34,5 +34,5 @@ interface nsIMobileMessageDatabaseService : nsISupports
in boolean value,
in nsIMobileMessageCallback request);
void getThreadList(in nsIMobileMessageCallback request);
nsICursorContinueCallback createThreadCursor(in nsIMobileMessageCursorCallback callback);
};

View File

@ -6,6 +6,7 @@
interface nsIDOMMozSmsMessage;
interface nsIDOMMozMmsMessage;
interface nsIDOMMozMobileMessageThread;
interface nsIDOMMozSmsSegmentInfo;
%{C++
@ -13,7 +14,7 @@ interface nsIDOMMozSmsSegmentInfo;
#define MOBILE_MESSAGE_SERVICE_CONTRACTID "@mozilla.org/mobilemessage/mobilemessageservice;1"
%}
[scriptable, builtinclass, uuid(944297ed-0dc7-4dee-89a6-c962ea0218d3)]
[scriptable, builtinclass, uuid(18e4b86e-4e19-4ee5-90bf-a29328149677)]
interface nsIMobileMessageService : nsISupports
{
[implicit_jscontext]
@ -44,4 +45,11 @@ interface nsIMobileMessageService : nsISupports
nsIDOMMozSmsSegmentInfo createSmsSegmentInfo(in long segments,
in long charsPerSegment,
in long charsAvailableInLastSegment);
[implicit_jscontext]
nsIDOMMozMobileMessageThread createThread(in unsigned long long id,
in jsval participants,
in jsval timestamp,
in DOMString body,
in unsigned long long unreadCount);
};

View File

@ -18,7 +18,7 @@ protocol PMobileMessageCursor
manager PSms;
child:
NotifyResult(SmsMessageData aMessageData);
NotifyResult(MobileMessageCursorData aData);
/**
* Sent when the asynchronous cursor request has completed.

View File

@ -41,7 +41,7 @@ struct MarkMessageReadRequest
bool value;
};
struct GetThreadListRequest
struct CreateThreadCursorRequest
{
};
@ -51,7 +51,12 @@ union IPCSmsRequest
GetMessageRequest;
DeleteMessageRequest;
MarkMessageReadRequest;
GetThreadListRequest;
};
union IPCMobileMessageCursor
{
CreateMessageCursorRequest;
CreateThreadCursorRequest;
};
sync protocol PSms {
@ -86,7 +91,7 @@ parent:
/**
* Sent when the child makes an asynchronous cursor to the parent.
*/
PMobileMessageCursor(CreateMessageCursorRequest request);
PMobileMessageCursor(IPCMobileMessageCursor request);
sync HasSupport()
returns (bool aHasSupport);

View File

@ -65,16 +65,6 @@ struct ReplyMarkeMessageReadFail
int32_t error;
};
struct ReplyThreadList
{
ThreadListItem[] items;
};
struct ReplyThreadListFail
{
int32_t error;
};
union MessageReply
{
ReplyMessageSend;
@ -85,8 +75,6 @@ union MessageReply
ReplyMessageDeleteFail;
ReplyMarkeMessageRead;
ReplyMarkeMessageReadFail;
ReplyThreadList;
ReplyThreadListFail;
};
} // namespace mobilemessage

View File

@ -45,15 +45,21 @@ struct SmsFilterData
ReadState read;
};
struct ThreadListItem
struct ThreadData
{
uint64_t id;
nsString senderOrReceiver;
nsString[] participants;
uint64_t timestamp;
nsString body;
uint64_t unreadCount;
};
union MobileMessageCursorData
{
SmsMessageData;
ThreadData;
};
}
}
}