summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2009-10-29 15:58:32 -0500
committerDenis Kenzior <denkenz@gmail.com>2009-10-29 15:58:32 -0500
commit22dc4e229feca085011a1f59af8349700f4a6125 (patch)
treeb5a8116eb5b39d825cf6e23888dfb270063d68b6
parent40adc851740b493b5c97aa0b075c20e859b5a081 (diff)
downloadofono-22dc4e229feca085011a1f59af8349700f4a6125.tar.bz2
Add utility to compress plmns that vary by tech
-rw-r--r--src/network.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/network.c b/src/network.c
index c1a4b114..0db2d052 100644
--- a/src/network.c
+++ b/src/network.c
@@ -980,6 +980,36 @@ void ofono_netreg_status_notify(struct ofono_netreg *netreg, int status,
notify_status_watches(netreg);
}
+static GSList *compress_operator_list(const struct ofono_network_operator *list,
+ int total)
+{
+ GSList *oplist = 0;
+ GSList *o;
+ int i;
+ struct network_operator_data *opd;
+
+ for (i = 0; i < total; i++) {
+ o = NULL;
+
+ if (oplist)
+ o = g_slist_find_custom(oplist, &list[i],
+ network_operator_compare);
+
+ if (!o) {
+ opd = network_operator_create(&list[i]);
+ oplist = g_slist_prepend(oplist, opd);
+ } else if (o && list[i].tech != -1) {
+ opd = o->data;
+ opd->techs |= 1 << list[i].tech;
+ }
+ }
+
+ if (oplist)
+ oplist = g_slist_reverse(oplist);
+
+ return oplist;
+}
+
static void operator_list_callback(const struct ofono_error *error, int total,
const struct ofono_network_operator *list,
void *data)