Add address from string utility for SMS

This commit is contained in:
Denis Kenzior 2009-06-19 12:26:04 -05:00
parent a8dc75392c
commit 61a4b0fee9
2 changed files with 14 additions and 0 deletions

View File

@ -1681,6 +1681,18 @@ time_t sms_scts_to_time(const struct sms_scts *scts, struct tm *remote)
return ret;
}
void sms_address_from_string(struct sms_address *addr, const char *str)
{
addr->numbering_plan = SMS_NUMBERING_PLAN_ISDN;
if (str[0] == '+') {
addr->number_type = SMS_NUMBER_TYPE_INTERNATIONAL;
strcpy(addr->address, str+1);
} else {
addr->number_type = SMS_NUMBER_TYPE_UNKNOWN;
strcpy(addr->address, str);
}
}
const char *sms_address_to_string(const struct sms_address *addr)
{
static char buffer[64];

View File

@ -356,7 +356,9 @@ 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);
void sms_address_from_string(struct sms_address *addr, const char *str);
const guint8 *sms_extract_common(const struct sms *sms, gboolean *out_udhi,
guint8 *out_dcs, guint8 *out_udl,