aboutsummaryrefslogtreecommitdiff
path: root/src/mm-sms-part.c
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2013-04-30 12:07:16 -0500
committerDan Williams <dcbw@redhat.com>2013-05-06 10:45:55 -0500
commit9bbcd9d6a5d0b01e16bdd4f94f707f0341f73e24 (patch)
tree0bf82eb0494145860c0434583fc27ac791819415 /src/mm-sms-part.c
parentab4198f576cb4308fecef3897675fe49cbcbe48a (diff)
sms: add support for message class
We need to redefine the message class property to int since class 0 is a valid message class. Thus -1 now means "unspecified class".
Diffstat (limited to 'src/mm-sms-part.c')
-rw-r--r--src/mm-sms-part.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/mm-sms-part.c b/src/mm-sms-part.c
index a5e8b33c..77fa3b82 100644
--- a/src/mm-sms-part.c
+++ b/src/mm-sms-part.c
@@ -325,7 +325,7 @@ struct _MMSmsPart {
gchar *text;
MMSmsEncoding encoding;
GByteArray *data;
- guint class;
+ gint class;
guint validity_relative;
gboolean delivery_report_request;
guint message_reference;
@@ -403,8 +403,8 @@ PART_GET_FUNC (const gchar *, text)
PART_SET_TAKE_STR_FUNC (text)
PART_GET_FUNC (MMSmsEncoding, encoding)
PART_SET_FUNC (MMSmsEncoding, encoding)
-PART_GET_FUNC (guint, class)
-PART_SET_FUNC (guint, class)
+PART_GET_FUNC (gint, class)
+PART_SET_FUNC (gint, class)
PART_GET_FUNC (guint, validity_relative)
PART_SET_FUNC (guint, validity_relative)
PART_GET_FUNC (gboolean, delivery_report_request)
@@ -461,6 +461,7 @@ mm_sms_part_new (guint index,
sms_part->pdu_type = pdu_type;
sms_part->encoding = MM_SMS_ENCODING_UNKNOWN;
sms_part->delivery_state = MM_SMS_DELIVERY_STATE_UNKNOWN;
+ sms_part->class = -1;
return sms_part;
}
@@ -917,12 +918,7 @@ mm_sms_part_encode_address (const gchar *address,
/**
* mm_sms_part_get_submit_pdu:
*
- * @number: the subscriber number to send this message to
- * @text: the body of this SMS
- * @smsc: if given, the SMSC address
- * @validity: minutes until the SMS should expire in the SMSC, or 0 for a
- * suitable default
- * @class: unused
+ * @part: the SMS message part
* @out_pdulen: on success, the size of the returned PDU in bytes
* @out_msgstart: on success, the byte index in the returned PDU where the
* message starts (ie, skipping the SMSC length byte and address, if present)
@@ -1023,6 +1019,12 @@ mm_sms_part_get_submit_pdu (MMSmsPart *part,
/* ----------- TP-DCS (1 byte) ----------- */
pdu[offset] = 0x00;
+ if (part->class >= 0 && part->class <= 3) {
+ mm_dbg (" using class %d...", part->class);
+ pdu[offset] |= SMS_DCS_CLASS_VALID;
+ pdu[offset] |= part->class;
+ }
+
if (part->encoding == MM_SMS_ENCODING_UCS2) {
mm_dbg (" using UCS2 encoding...");
pdu[offset] |= SMS_DCS_CODING_UCS2;