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