[Telepathy-commits] [telepathy-glib/master] SimpleConnection: forbid IDs containing spaces, to have a more interesting validation function for tests to run

Simon McVittie simon.mcvittie at collabora.co.uk
Mon Oct 20 10:20:01 PDT 2008


---
 tests/lib/simple-conn.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/tests/lib/simple-conn.c b/tests/lib/simple-conn.c
index dbf1ec0..8dba8a5 100644
--- a/tests/lib/simple-conn.c
+++ b/tests/lib/simple-conn.c
@@ -11,6 +11,8 @@
 
 #include "simple-conn.h"
 
+#include <string.h>
+
 #include <dbus/dbus-glib.h>
 
 #include <telepathy-glib/dbus.h>
@@ -110,6 +112,13 @@ simple_normalize_contact (TpHandleRepoIface *repo,
       return NULL;
     }
 
+  if (strchr (id, ' ') != NULL)
+    {
+      g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
+          "ID must not contain spaces");
+      return NULL;
+    }
+
   return g_utf8_strdown (id, -1);
 }
 
-- 
1.5.6.5




More information about the Telepathy-commits mailing list