From d0b91bfbc8d7e3a7c75c51b14932e25551d2233c Mon Sep 17 00:00:00 2001 From: Andrzej Zaborowski Date: Wed, 5 Aug 2009 09:08:40 +0200 Subject: Attempt to update MBDN based on Enhanced VM IEI --- src/message-waiting.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/message-waiting.c') diff --git a/src/message-waiting.c b/src/message-waiting.c index ec1da395..f5f61b2a 100644 --- a/src/message-waiting.c +++ b/src/message-waiting.c @@ -618,6 +618,7 @@ static void handle_enhanced_voicemail_iei(struct ofono_modem *modem, { int profile, n; gboolean set; + struct sms_address mailbox_address; if (length < 3) return; @@ -633,9 +634,10 @@ static void handle_enhanced_voicemail_iei(struct ofono_modem *modem, if (discard) *discard = (iei[0] & (1 << 4)) ? FALSE : TRUE; - /* TODO: VM_MAILBOX_ACCESS_ADDRESS */ - n = 2 + (iei[1] + 1) / 2; - if (length < n + 11) + /* VM_MAILBOX_ACCESS_ADDRESS */ + n = 0; + if (!sms_decode_address_field(iei + 1, length - 1, &n, + FALSE, &mailbox_address)) return; /* TODO: VM_MESSAGE_PRIORITY_INDICATION */ @@ -655,9 +657,10 @@ static void handle_enhanced_voicemail_iei(struct ofono_modem *modem, if (discard) *discard = (iei[0] & (1 << 4)) ? FALSE : TRUE; - /* TODO: VM_MAILBOX_ACCESS_ADDRESS */ - n = 2 + (iei[1] + 1) / 2; - if (length < n + 11) + /* VM_MAILBOX_ACCESS_ADDRESS */ + n = 0; + if (!sms_decode_address_field(iei + 1, length - 1, &n, + FALSE, &mailbox_address)) return; /* Other parameters currently not supported */ @@ -666,6 +669,10 @@ static void handle_enhanced_voicemail_iei(struct ofono_modem *modem, mw_set_indicator(modem, profile, SMS_MWI_TYPE_VOICE, set, iei[n + 2]); } + + if (mailbox_address.address[0] != '\0') + set_mbdn(modem, SMS_MWI_TYPE_VOICE, + sms_address_to_string(&mailbox_address), NULL); } void ofono_handle_sms_mwi(struct ofono_modem *modem, -- cgit v1.2.3