Bug 957084 - Allow the sending of empty SMS messages (Gecko side). r=gene

This patch allows to send empty messages. The fragmentText function did not
contemplate the empty message case. So, I changed and added some behaviours
that removed the conflict.
This commit is contained in:
Nicolas Del Piano 2014-01-15 10:14:10 -03:00
Родитель 8e550a01b7
Коммит 2654ba5735
1 изменённых файлов: 18 добавлений и 0 удалений

Просмотреть файл

@ -3318,6 +3318,15 @@ RadioInterface.prototype = {
_fragmentText7Bit: function(text, langTable, langShiftTable, segmentSeptets, strict7BitEncoding) { _fragmentText7Bit: function(text, langTable, langShiftTable, segmentSeptets, strict7BitEncoding) {
let ret = []; let ret = [];
let body = "", len = 0; let body = "", len = 0;
// If the message is empty, we only push the empty message to ret.
if (text.length == 0) {
ret.push({
body: text,
encodedBodyLength: text.length,
});
return ret;
}
for (let i = 0, inc = 0; i < text.length; i++) { for (let i = 0, inc = 0; i < text.length; i++) {
let c = text.charAt(i); let c = text.charAt(i);
if (strict7BitEncoding) { if (strict7BitEncoding) {
@ -3387,6 +3396,15 @@ RadioInterface.prototype = {
*/ */
_fragmentTextUCS2: function(text, segmentChars) { _fragmentTextUCS2: function(text, segmentChars) {
let ret = []; let ret = [];
// If the message is empty, we only push the empty message to ret.
if (text.length == 0) {
ret.push({
body: text,
encodedBodyLength: text.length,
});
return ret;
}
for (let offset = 0; offset < text.length; offset += segmentChars) { for (let offset = 0; offset < text.length; offset += segmentChars) {
let str = text.substr(offset, segmentChars); let str = text.substr(offset, segmentChars);
ret.push({ ret.push({