aboutsummaryrefslogtreecommitdiff
path: root/src/mm-sms-utils.c
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2012-01-18 15:26:12 -0600
committerDan Williams <dcbw@redhat.com>2012-01-18 15:26:12 -0600
commit5c561995aacdab2b29f8eabf38ad8703eec75cab (patch)
tree0fc65e9f005883587c5896d129616ca7254b0b36 /src/mm-sms-utils.c
parentd51ff9ac07973701ee790f57c82a99cc25d92ab1 (diff)
gsm: fix CMGS PDU mode length calculation
The first byte of the PDU is the SMSC length, but it's not the padded SMSC length. So we need to subtract the actual byte index of the start of the message from length of the PDU, and since the PDU creation function knows all about where the SMSC address stops and the message begins, just have it return that length instead of making the callers calculate it.
Diffstat (limited to 'src/mm-sms-utils.c')
-rw-r--r--src/mm-sms-utils.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mm-sms-utils.c b/src/mm-sms-utils.c
index fc493dc4..025a19dc 100644
--- a/src/mm-sms-utils.c
+++ b/src/mm-sms-utils.c
@@ -600,6 +600,8 @@ validity_to_relative (guint validity)
* suitable default
* @class: unused
* @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)
* @error: on error, filled with the error that occurred
*
* Constructs a single-part SMS message with the given details, preferring to
@@ -615,6 +617,7 @@ sms_create_submit_pdu (const char *number,
guint validity,
guint class,
guint *out_pdulen,
+ guint *out_msgstart,
GError **error)
{
guint8 *pdu;
@@ -668,6 +671,9 @@ sms_create_submit_pdu (const char *number,
pdu[offset++] = 0x00;
}
+ if (out_msgstart)
+ *out_msgstart = offset;
+
if (validity > 0)
pdu[offset] = 1 << 4; /* TP-VP present; format RELATIVE */
else