Add pretty print function for SMS addresses

This commit is contained in:
Denis Kenzior 2009-06-12 21:15:24 -05:00
parent f0954911a8
commit 2bfc1c0784
2 changed files with 17 additions and 0 deletions

View File

@ -1677,3 +1677,18 @@ time_t sms_scts_to_time(const struct sms_scts *scts, struct tm *remote)
return ret;
}
const char *sms_address_to_string(const struct sms_address *addr)
{
static char buffer[64];
if (addr->number_type == SMS_NUMBER_TYPE_INTERNATIONAL &&
(strlen(addr->address) > 0) &&
addr->address[0] != '+') {
buffer[0] = '+';
strcpy(buffer + 1, addr->address);
} else
strcpy(buffer, addr->address);
return buffer;
}

View File

@ -330,6 +330,8 @@ gboolean sms_encode(const struct sms *in, int *len, int *tpdu_len,
int sms_udl_in_bytes(guint8 ud_len, guint8 dcs);
time_t sms_scts_to_time(const struct sms_scts *scts, struct tm *remote);
const char *sms_address_to_string(const struct sms_address *addr);
const guint8 *sms_extract_common(const struct sms *sms, gboolean *out_udhi,
guint8 *out_dcs, guint8 *out_udl,
guint8 *out_max);