[gnome-bluetooth] wizard: Make name match on substrings
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] wizard: Make name match on substrings
- Date: Thu, 13 Sep 2012 15:32:17 +0000 (UTC)
commit aabaada7ac0d24cf67590f7403156c68bc8f98d4
Author: Bastien Nocera <hadess hadess net>
Date: Fri Jul 27 10:25:23 2012 +0200
wizard: Make name match on substrings
wizard/pin-code-database.xml | 3 ++-
wizard/pin.c | 4 +++-
2 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/wizard/pin-code-database.xml b/wizard/pin-code-database.xml
index c117836..3f2a06d 100644
--- a/wizard/pin-code-database.xml
+++ b/wizard/pin-code-database.xml
@@ -21,7 +21,8 @@
<!--
The wizard will match devices, following the order of the XML file [1],
- on any combination of type, OUI, or name.
+ on any combination of type, OUI, or name. The name is matched through a
+ sub-string search (it should contain the name mentioned in this file if any).
The special NULL pin means that the devices will not be paired, but
connected to and marked as trusted. This is for devices such as mice
diff --git a/wizard/pin.c b/wizard/pin.c
index fafc748..b91b1fd 100644
--- a/wizard/pin.c
+++ b/wizard/pin.c
@@ -90,7 +90,9 @@ pin_db_parse_start_tag (GMarkupParseContext *ctx,
if (g_str_has_prefix (pdata->address, *attr_values) == FALSE)
return;
} else if (g_str_equal (*attr_names, "name")) {
- if (g_strcmp0 (*attr_values, pdata->name) != 0)
+ if (*attr_values == NULL)
+ return;
+ if (strstr (*attr_values, pdata->name) == NULL)
return;
} else if (g_str_equal (*attr_names, "pin")) {
if (g_str_has_prefix (*attr_values, MAX_DIGITS_PIN_PREFIX) != FALSE) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]