sms: user-created SMS objects will have either 'text' or 'data'

This commit is contained in:
Aleksander Morgado
2012-09-06 17:33:45 +02:00
parent 39e819788d
commit b03985a019
2 changed files with 12 additions and 5 deletions

View File

@@ -55,7 +55,8 @@
The '<link linkend="gdbus-property-org-freedesktop-ModemManager1-Sms.Number">Number</link>'
and
'<link linkend="gdbus-property-org-freedesktop-ModemManager1-Sms.Text">Text</link>'
either '<link linkend="gdbus-property-org-freedesktop-ModemManager1-Sms.Text">Text</link>' or
'<link linkend="gdbus-property-org-freedesktop-ModemManager1-Sms.Data">Data</link>'
properties are mandatory, others are optional.
If the SMSC is not specified and one is required, the default SMSC is

View File

@@ -982,14 +982,17 @@ assemble_sms (MMSms *self,
return FALSE;
}
/* When the user creates the SMS, it will have either 'text' or 'data',
* not both */
parttext = mm_sms_part_get_text (sorted_parts[idx]);
partdata = mm_sms_part_get_data (sorted_parts[idx]);
if (!parttext || !partdata) {
if (!parttext && !partdata) {
g_set_error (error,
MM_CORE_ERROR,
MM_CORE_ERROR_FAILED,
"Cannot assemble SMS, part at index (%u) has no text or data",
"Cannot assemble SMS, part at index (%u) has neither text nor data",
idx);
g_string_free (fulltext, TRUE);
g_byte_array_free (fulldata, TRUE);
@@ -997,7 +1000,9 @@ assemble_sms (MMSms *self,
return FALSE;
}
if (parttext)
g_string_append (fulltext, parttext);
if (partdata)
g_byte_array_append (fulldata, partdata->data, partdata->len);
}
@@ -1207,6 +1212,7 @@ mm_sms_new_from_properties (MMBaseModem *modem,
part = mm_sms_part_new (SMS_PART_INVALID_INDEX);
mm_sms_part_set_text (part, mm_sms_properties_get_text (properties));
mm_sms_part_take_data (part, mm_sms_properties_get_data_bytearray (properties));
mm_sms_part_set_number (part, mm_sms_properties_get_number (properties));
mm_sms_part_set_smsc (part, mm_sms_properties_get_smsc (properties));
mm_sms_part_set_validity (part, mm_sms_properties_get_validity (properties));