All pastes #1509510 Raw Edit

Anonymous

public text v1 · immutable
#1509510 ·published 2009-07-28 00:46 UTC
rendered paste body
diff --git a/drivers/atmodem/phonebook.c b/drivers/atmodem/phonebook.c
index 71b8921..b736d0c 100644
--- a/drivers/atmodem/phonebook.c
+++ b/drivers/atmodem/phonebook.c
@@ -43,7 +43,8 @@
 
 #define CHARSET_UTF8 1
 #define CHARSET_UCS2 2
-#define CHARSET_SUPPORT (CHARSET_UTF8 | CHARSET_UCS2)
+#define CHARSET_IRA  4
+#define CHARSET_SUPPORT (CHARSET_IRA | CHARSET_UTF8 | CHARSET_UCS2)
 
 static const char *none_prefix[] = { NULL };
 static const char *cpbr_prefix[] = { "+CPBR:", NULL };
@@ -85,6 +86,9 @@ static const char *best_charset(int supported)
 {
 	const char *charset = "Invalid";
 
+	if (supported & CHARSET_IRA)
+		charset = "IRA";
+
 	if (supported & CHARSET_UCS2)
 		charset = "UCS2";
 
@@ -104,6 +108,9 @@ static void at_cpbr_notify(GAtResult *result, gpointer user_data)
 
 	dump_response("at_cbpr_notify", 1, result);
 
+	if (at->pb->supported & CHARSET_IRA)
+		current = CHARSET_IRA;
+
 	if (at->pb->supported & CHARSET_UCS2)
 		current = CHARSET_UCS2;
 
@@ -180,6 +187,9 @@ static void at_cpbr_notify(GAtResult *result, gpointer user_data)
 			g_free(sip_uri_utf8);
 			g_free(tel_uri_utf8);
 		} else {
+			/* In the case of IRA charset, assume these are Latin1
+			 * characters, same as in UTF8
+			 */
 			ofono_phonebook_entry(cbd->modem, index, number, type,
 				text, hidden, group, adnumber,
 				adtype, secondtext, email,
@@ -472,6 +482,8 @@ static void at_list_charsets_cb(gboolean ok, GAtResult *result,
 			at->pb->supported |= CHARSET_UTF8;
 		else if (!strcmp(charset, "UCS2"))
 			at->pb->supported |= CHARSET_UCS2;
+		else if (!strcmp(charset, "IRA"))
+			at->pb->supported |= CHARSET_IRA;
 	}
 
 	if (in_list && !g_at_result_iter_close_list(&iter))