зеркало из https://github.com/mozilla/gecko-dev.git
Bug 712809 - B2G SMS Database: Hook it up to RadioInterfaceLayer. r=philikon DONTBUILD because NPOTB
This commit is contained in:
Родитель
8114d37308
Коммит
ea87281786
|
@ -69,6 +69,10 @@ XPCOMUtils.defineLazyServiceGetter(this, "gSmsRequestManager",
|
|||
"@mozilla.org/sms/smsrequestmanager;1",
|
||||
"nsISmsRequestManager");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "gSmsDatabaseService",
|
||||
"@mozilla.org/sms/rilsmsdatabaseservice;1",
|
||||
"nsISmsDatabaseService");
|
||||
|
||||
function convertRILCallState(state) {
|
||||
switch (state) {
|
||||
case RIL.CALL_STATE_ACTIVE:
|
||||
|
@ -308,8 +312,11 @@ RadioInterfaceLayer.prototype = {
|
|||
},
|
||||
|
||||
handleSmsReceived: function handleSmsReceived(message) {
|
||||
//TODO: put the sms into a database, assign it a proper id, yada yada
|
||||
let sms = gSmsService.createSmsMessage(-1,
|
||||
debug("handleSmsReceived: " + JSON.stringify(message));
|
||||
let id = gSmsDatabaseService.saveReceivedMessage(message.sender || null,
|
||||
message.body || null,
|
||||
message.timestamp);
|
||||
let sms = gSmsService.createSmsMessage(id,
|
||||
DOM_SMS_DELIVERY_RECEIVED,
|
||||
message.sender || null,
|
||||
message.receiver || null,
|
||||
|
@ -319,13 +326,15 @@ RadioInterfaceLayer.prototype = {
|
|||
},
|
||||
|
||||
handleSmsSent: function handleSmsSent(message) {
|
||||
let sms = gSmsService.createSmsMessage(-1,
|
||||
debug("handleSmsSent: " + JSON.stringify(message));
|
||||
let timestamp = Date.now();
|
||||
let id = gSmsDatabaseService.saveSentMessage(message.number, message.body, timestamp);
|
||||
let sms = gSmsService.createSmsMessage(id,
|
||||
DOM_SMS_DELIVERY_SENT,
|
||||
null,
|
||||
message.number,
|
||||
message.body,
|
||||
Date.now());
|
||||
//TODO At this point we should save the sms into the DB (bug 712809)
|
||||
timestamp);
|
||||
//TODO handle errors (bug 727319)
|
||||
gSmsRequestManager.notifySmsSent(message.requestId, sms);
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче