[Telepathy-commits] [telepathy-glib/master] Examples: consistently raise InvalidHandle for invalid identifiers

Simon McVittie simon.mcvittie at collabora.co.uk
Fri Jan 16 08:37:56 PST 2009


---
 examples/cm/channelspecific/conn.c    |   16 ++++++++--------
 examples/cm/echo-message-parts/conn.c |    2 +-
 examples/cm/echo/conn.c               |    2 +-
 examples/cm/extended/conn.c           |    2 +-
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/examples/cm/channelspecific/conn.c b/examples/cm/channelspecific/conn.c
index cb46433..aab088f 100644
--- a/examples/cm/channelspecific/conn.c
+++ b/examples/cm/channelspecific/conn.c
@@ -117,7 +117,7 @@ example_csh_normalize_contact (TpHandleRepoIface *repo,
 
   if (id[0] == '\0')
     {
-      g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
+      g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_HANDLE,
           "ID must not be empty");
       return NULL;
     }
@@ -126,28 +126,28 @@ example_csh_normalize_contact (TpHandleRepoIface *repo,
 
   if (at == NULL || at == id || at[1] == '\0')
     {
-      g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
+      g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_HANDLE,
           "ID must look like aaa at bbb");
       return NULL;
     }
 
   if (strchr (at + 1, '@') != NULL)
     {
-      g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
+      g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_HANDLE,
           "ID cannot contain more than one '@'");
       return NULL;
     }
 
   if (at[1] == '#' && at[2] == '\0')
     {
-      g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
+      g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_HANDLE,
           "chatroom name cannot be empty");
       return NULL;
     }
 
   if (strchr (at + 2, '#') != NULL)
     {
-      g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
+      g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_HANDLE,
           "realm/chatroom cannot contain '#' except at the beginning");
       return NULL;
     }
@@ -165,20 +165,20 @@ example_csh_normalize_room (TpHandleRepoIface *repo,
 
   if (id[0] != '#')
     {
-      g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
+      g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_HANDLE,
           "Chatroom names in this protocol start with #");
     }
 
   if (id[1] == '\0')
     {
-      g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
+      g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_HANDLE,
           "Chatroom name cannot be empty");
       return NULL;
     }
 
   if (strchr (id, '@') != NULL)
     {
-      g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
+      g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_HANDLE,
           "Chatroom names in this protocol cannot contain '@'");
       return NULL;
     }
diff --git a/examples/cm/echo-message-parts/conn.c b/examples/cm/echo-message-parts/conn.c
index 063dfe1..410cb40 100644
--- a/examples/cm/echo-message-parts/conn.c
+++ b/examples/cm/echo-message-parts/conn.c
@@ -104,7 +104,7 @@ example_normalize_contact (TpHandleRepoIface *repo,
 {
   if (id[0] == '\0')
     {
-      g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+      g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_HANDLE,
           "ID must not be empty");
       return NULL;
     }
diff --git a/examples/cm/echo/conn.c b/examples/cm/echo/conn.c
index 9531c31..cba3834 100644
--- a/examples/cm/echo/conn.c
+++ b/examples/cm/echo/conn.c
@@ -105,7 +105,7 @@ example_echo_normalize_contact (TpHandleRepoIface *repo,
 {
   if (id[0] == '\0')
     {
-      g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
+      g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_HANDLE,
           "ID must not be empty");
       return NULL;
     }
diff --git a/examples/cm/extended/conn.c b/examples/cm/extended/conn.c
index 7cc274c..f4d22e6 100644
--- a/examples/cm/extended/conn.c
+++ b/examples/cm/extended/conn.c
@@ -123,7 +123,7 @@ example_normalize_contact (TpHandleRepoIface *repo,
 {
   if (id[0] == '\0')
     {
-      g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
+      g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_HANDLE,
           "ID must not be empty");
       return NULL;
     }
-- 
1.5.6.5




More information about the Telepathy-commits mailing list