diff options
Diffstat (limited to 'src/plugin.c')
-rw-r--r-- | src/plugin.c | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/src/plugin.c b/src/plugin.c index 159014bb..68fe3188 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -72,18 +72,26 @@ static gboolean add_plugin(void *handle, struct ofono_plugin_desc *desc) } static gboolean check_plugin(struct ofono_plugin_desc *desc, - const char *pattern, const char *exclude) + char **patterns, char **excludes) { - if (exclude != NULL && - g_pattern_match_simple(exclude, desc->name) == TRUE) { - ofono_info("Excluding %s", desc->description); - return FALSE; + if (excludes) { + for (; *excludes; excludes++) + if (g_pattern_match_simple(*excludes, desc->name)) + break; + if (*excludes) { + ofono_info("Excluding %s", desc->description); + return FALSE; + } } - if (pattern != NULL && - g_pattern_match_simple(pattern, desc->name) == FALSE) { - ofono_info("Ignoring %s", desc->description); - return FALSE; + if (patterns) { + for (; *patterns; patterns++) + if (g_pattern_match_simple(*patterns, desc->name)) + break; + if (!*patterns) { + ofono_info("Ignoring %s", desc->description); + return FALSE; + } } return TRUE; @@ -93,6 +101,8 @@ static gboolean check_plugin(struct ofono_plugin_desc *desc, int __ofono_plugin_init(const char *pattern, const char *exclude) { + gchar **patterns = NULL; + gchar **excludes = NULL; GSList *list; GDir *dir; const gchar *file; @@ -101,9 +111,15 @@ int __ofono_plugin_init(const char *pattern, const char *exclude) DBG(""); + if (pattern) + patterns = g_strsplit_set(pattern, ", ", -1); + + if (exclude) + excludes = g_strsplit_set(exclude, ", ", -1); + for (i = 0; __ofono_builtin[i]; i++) { if (check_plugin(__ofono_builtin[i], - pattern, exclude) == FALSE) + patterns, excludes) == FALSE) continue; add_plugin(NULL, __ofono_builtin[i]); @@ -139,7 +155,7 @@ int __ofono_plugin_init(const char *pattern, const char *exclude) continue; } - if (check_plugin(desc, pattern, exclude) == FALSE) { + if (check_plugin(desc, patterns, excludes) == FALSE) { dlclose(handle); continue; } |