gsm: fix listing SMS messages in text mode

Even though we don't parse them correctly yet, at least
send the right command for listing them.
This commit is contained in:
Dan Williams
2012-02-01 11:21:20 -06:00
parent d84214184c
commit 14a59c4384

View File

@@ -5145,22 +5145,23 @@ sms_list_done (MMAtSerialPort *port,
GPtrArray *results = NULL;
int rv, status, tpdu_len, offset;
char *rstr;
GHashTableIter iter;
GHashTable *properties = NULL;
/* If the modem has already been removed, return without
* scheduling callback */
if (mm_callback_info_check_modem_removed (info))
return;
if (error)
if (error) {
info->error = g_error_copy (error);
else {
GHashTableIter iter;
gpointer key, value;
mm_callback_info_schedule (info);
return;
}
results = g_ptr_array_new ();
rstr = response->str;
while (*rstr) {
GHashTable *properties;
GError *local;
int idx;
char pdu[SMS_MAX_PDU_LEN + 1];
@@ -5187,19 +5188,17 @@ sms_list_done (MMAtSerialPort *port,
}
/* Add all the complete messages to the results */
properties = NULL;
g_hash_table_iter_init (&iter, priv->sms_contents);
while (g_hash_table_iter_next (&iter, &key, &value)) {
GHashTable *properties = value;
while (g_hash_table_iter_next (&iter, NULL, (gpointer) &properties)) {
g_hash_table_ref (properties);
properties = sms_cache_lookup_full (info->modem, properties,
&info->error);
g_clear_error (&info->error);
properties = sms_cache_lookup_full (info->modem, properties, &info->error);
if (properties)
g_ptr_array_add (results, properties);
}
if (results)
mm_callback_info_set_data (info, "list-sms", results,
free_list_results);
}
mm_callback_info_set_data (info, "list-sms", results, free_list_results);
mm_callback_info_schedule (info);
}
@@ -5234,7 +5233,10 @@ sms_list (MMModemGsmSms *modem,
return;
}
if (MM_GENERIC_GSM_GET_PRIVATE (modem)->sms_pdu_mode)
command = g_strdup_printf ("+CMGL=4");
else
command = g_strdup_printf ("+CMGL=\"ALL\"");
mm_at_serial_port_queue_command (port, command, 10, sms_list_done, info);
}