gecko-dev/dom/mobilemessage/interfaces/nsIGonkMobileMessageDatabas...

154 строки
6.8 KiB
Plaintext

/* 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 "domstubs.idl"
#include "nsISupports.idl"
#include "nsIMobileMessageDatabaseService.idl"
[scriptable, function, uuid(2ae081ac-8038-11e4-a472-1ba11eb89d79)]
interface nsIGonkMobileMessageDatabaseCallback : nsISupports
{
/**
* |aDomMessage|: the nsIDOMMoz{Mms,Sms}Message
*/
void notify(in nsresult aRv, in nsISupports aDomMessage);
};
[scriptable, function, uuid(2f7a6fde-8038-11e4-9d93-5b9ffba492fb)]
interface nsIGonkMobileMessageDatabaseRecordCallback : nsISupports
{
/**
* |aMessageRecord| Object: the mobile-message database record
* |aDomMessage|: the nsIDOMMoz{Mms,Sms}Message. Noted, this value might be null.
*/
void notify(in nsresult aRv, in jsval aMessageRecord, in nsISupports aDomMessage);
};
[scriptable, function, uuid(36f9732c-8038-11e4-b634-3f7e3df5232a)]
interface nsIGonkMobileMessageDatabaseConcatenationCallback : nsISupports
{
/**
* |aCompleteMessage|: jsval: the completely concatenated message. Noted, this value might be null.
*/
void notify(in nsresult aRv, in jsval aCompleteMessage);
};
%{C++
#define GONK_MOBILE_MESSAGE_DATABASE_SERVICE_CID \
{ 0x7db05024, 0x8038, 0x11e4, { 0xb7, 0xfa, 0xa3, 0xed, 0xb6, 0xf1, 0xbf, 0x0c } }
#define GONK_MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID \
"@mozilla.org/mobilemessage/gonkmobilemessagedatabaseservice;1"
%}
[scriptable, uuid(48a3c28a-8038-11e4-b7b9-0f2df5b53100)]
interface nsIGonkMobileMessageDatabaseService : nsIMobileMessageDatabaseService
{
/**
* |aMessage| Object: should contain the following properties for internal use:
* - |type| DOMString: "sms" or "mms"
* - |timestamp| Number: the timestamp of received message
* - |iccId| DOMString: [optional] the ICC ID of the SIM for receiving
* message if available.
*
* - If |type| == "sms", we also need:
* - |messageClass| DOMString: the message class of received message
* - |receiver| DOMString: the phone number of receiver
* - |pid| Number: the TP-PID field of the SMS TPDU, default 0.
* - |sender| DOMString: the phone number of sender
*
* - If |type| == "mms", we also need:
* - |delivery| DOMString: the delivery state of received message
* - |deliveryStatus| DOMString: the delivery status of received message
* - |receivers| DOMString Array: the phone numbers of receivers
* - |phoneNumber| DOMString: [optional] my own phone number.
*/
void saveReceivedMessage(in jsval aMessage,
[optional] in nsIGonkMobileMessageDatabaseCallback aCallback);
/**
* |aMessage| Object: should contain the following properties for internal use:
* - |type| DOMString: "sms" or "mms"
* - |sender| DOMString: the phone number of sender
* - |timestamp| Number: the timestamp of sending message
* - |deliveryStatusRequested| Bool: true when the delivery report is requested.
* - |iccId| DOMString: the ICC ID of the SIM for sending message
*
* - If |type| == "sms", we also need:
* - |receiver| DOMString: the phone number of receiver
*
* - If |type| == "mms", we also need:
* - |receivers| DOMString Array: the phone numbers of receivers
*/
void saveSendingMessage(in jsval aMessage,
[optional] in nsIGonkMobileMessageDatabaseCallback aCallback);
/**
* |aMessageId| Number: the message's DB record ID.
* |aReceiver| DOMString: the phone number of receiver (for MMS; can be null).
* |aDelivery| DOMString: the new delivery value to update (can be null).
* |aDeliveryStatus| DOMString: the new delivery status to update (can be null).
* |aEnvelopeId| DOMString: the "message-id" specified in the MMS PDU headers.
* |aCallback| nsIGonkMobileMessageDatabaseCallback: an optional callback.
*/
void setMessageDeliveryByMessageId(in long aMessageId,
in DOMString aReceiver,
in DOMString aDelivery,
in DOMString aDeliveryStatus,
in DOMString aEnvelopeId,
[optional] in nsIGonkMobileMessageDatabaseCallback aCallback);
/**
* |aEnvelopeId| DOMString: the "message-id" specified in the MMS PDU headers.
* |aReceiver| DOMString: the phone number of receiver (for MMS; can be null).
* |aDeliveryStatus| DOMString: the new delivery status to be updated (can be null).
* |aCallback| nsIGonkMobileMessageDatabaseCallback: an optional callback.
*/
void setMessageDeliveryStatusByEnvelopeId(in DOMString aEnvelopeId,
in DOMString aReceiver,
in DOMString aDeliveryStatus,
[optional] in nsIGonkMobileMessageDatabaseCallback aCallback);
/**
* |aEnvelopeId| DOMString: the "message-id" specified in the MMS PDU headers.
* |aReceiver| DOMString: the phone number of receiver (for MMS; can be null).
* |aReadStatus| DOMString: the new read status to be updated.
* |aCallback| nsIGonkMobileMessageDatabaseCallback: an optional callback.
*/
void setMessageReadStatusByEnvelopeId(in DOMString aEnvelopeId,
in DOMString aReceiver,
in DOMString aReadStatus,
[optional] in nsIGonkMobileMessageDatabaseCallback aCallback);
/**
* |aMessageId| Number: the message's DB record ID.
* |aCallback| nsIGonkMobileMessageDatabaseRecordCallback: a callback which
* takes result flag, message record and domMessage as parameters.
*/
void getMessageRecordById(in long aMessageId,
in nsIGonkMobileMessageDatabaseRecordCallback aCallback);
/**
* |aTransactionId| DOMString: the transaction ID of MMS PDU.
* |aCallback| nsIGonkMobileMessageDatabaseRecordCallback: a callback which
* takes result flag and message record as parameters.
*/
void getMessageRecordByTransactionId(in DOMString aTransactionId,
in nsIGonkMobileMessageDatabaseRecordCallback aCallback);
/**
* |aCrError| nsresult: the NS_ERROR defined in Components.results.
*
* @returns the error code defined in nsIMobileMessageCallback
*/
jsval translateCrErrorToMessageCallbackError(in nsresult aCrError);
/**
* |aSmsSegment| jsval: Decoded Single SMS PDU.
* |aCallback| nsIGonkMobileMessageDatabaseConcatenationCallback: a callback which
* takes result flag, and complete mesage as parameters.
*/
void saveSmsSegment(in jsval aSmsSegment,
in nsIGonkMobileMessageDatabaseConcatenationCallback aCallback);
};