Commit 150bb956 authored by Kyle Evans's avatar Kyle Evans
Browse files

Parse the WAP Push notification and send a system message

The MMS SMS notification message is a WAP Push notification.
ModemManager does not have an API to deal with Push notifications
like ofono does. For now, notify the user of the notification type
and show the link for further processing. Push messages are left
on the SIM card.
parent c3e5858b
Pipeline #59394 passed with stages
in 4 minutes and 25 seconds
......@@ -483,20 +483,45 @@ pur_mm_send_sms_to_purple_serv (PurSmsProps *sms_props)
if (pur_mm_get_modem_state ()) {
pc = purple_account_get_connection (mm_sms->account);
if (sms_props->message &&
sms_props->number &&
(sms_props->message[0] != '\0') &&
if (sms_props->number &&
(sms_props->number [0] != '\0')) {
serv_got_im (pc,
sms_props->number,
sms_props->message,
PURPLE_MESSAGE_RECV,
time (NULL));
if (mm_sms->sms_delete_received) {
pur_mm_delete_sms (sms_props);
}
if (sms_props->message) {
serv_got_im (pc,
sms_props->number,
sms_props->message,
PURPLE_MESSAGE_RECV,
time (NULL));
if (mm_sms->sms_delete_received) {
pur_mm_delete_sms (sms_props);
}
} else
if (sms_props->data) {
/* print a system message indicating the push type */
gchar *p = (gchar *)&sms_props->data[5];
gchar note[sms_props->data_len];
p += sprintf(note, "%s\n", p);
/* search for an http link through the rest of the notification */
do {
p = (gchar *)memchr (p, (int)'h',
sms_props->data_len - ((gsize)p - (gsize)sms_props->data));
} while ( p && !(p[1] == 't' && p[2] == 't' && p[3] == 'p'));
strcat(note, p);
serv_got_im (pc,
sms_props->number,
note,
PURPLE_MESSAGE_SYSTEM,
time (NULL));
/* send sms_props->data to mmsd?:
* mms_service_push_notify(modem->service, data, data_len);
* This is not a good option because then purple-mm-sms is
* handling push notifications that might not be chat related
* */
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment