diff options
author | Sean Godinez <sgodinez@multitech.com> | 2015-05-07 10:19:34 -0500 |
---|---|---|
committer | Sean Godinez <sgodinez@multitech.com> | 2015-05-07 10:19:34 -0500 |
commit | ab80a82e2e0f5ea7cdef0394f80e69b377fab779 (patch) | |
tree | 50f2206a38b5a2723dbbc957f195fcf7e069f54d /src | |
parent | 70d54c9b06a7c5fc832b3ec7a408102051c7b28a (diff) | |
download | sms-utils-ab80a82e2e0f5ea7cdef0394f80e69b377fab779.tar.gz sms-utils-ab80a82e2e0f5ea7cdef0394f80e69b377fab779.tar.bz2 sms-utils-ab80a82e2e0f5ea7cdef0394f80e69b377fab779.zip |
Keep UDH for concatenated SMS0.0.7
Diffstat (limited to 'src')
-rw-r--r-- | src/pdu_decode.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/pdu_decode.c b/src/pdu_decode.c index 643fa15..cbc2009 100644 --- a/src/pdu_decode.c +++ b/src/pdu_decode.c @@ -204,7 +204,21 @@ int pdu_decode_user_data(const char *pdu_str, struct pdu_info *pdu) } if (pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT) { - for (i = 0; i < pdu->user_data_len; i++) { + // Keep UDH for concatenated SMS. + // Otherwise it is impossible to process correctly concatenated SMS. + i = 0; + if (pdu->type.user_data_header) { + for (i = 0; i <= octets[0]; ++i) { + pdu->user_data[i] = octets[i]; + } + i = octets[0] + 1; // Set message text start after UDH. + // Process octets padding for 7-bit encoding. + if (0 != (i * 8) % 7) { + pdu->user_data[i] = 0; // set padding data to 0; + i++; + } + } + for (; i < pdu->user_data_len; i++) { pdu->user_data[i] = decode_septet(octets, i); } pdu->user_data[i] = '\0'; |