[Telepathy-commits] [telepathy-glib/master] All test and example CMs: have RequestHandles raise NotAvailable for invalid contact/room IDs
Simon McVittie
simon.mcvittie at collabora.co.uk
Mon Oct 13 05:48:51 PDT 2008
The Telepathy spec says "NotAvailable: The given name is not a valid
entity of the given type" and "InvalidArgument: The handle type is
invalid", so we were wrong to raise InvalidArgument for malformed IDs.
---
examples/cm/channelspecific/conn.c | 16 ++++++++--------
examples/cm/echo/conn.c | 2 +-
examples/cm/extended/conn.c | 2 +-
tests/lib/simple-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 a79dd0f..b65a706 100644
--- a/examples/cm/channelspecific/conn.c
+++ b/examples/cm/channelspecific/conn.c
@@ -116,7 +116,7 @@ example_csh_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_NOT_AVAILABLE,
"ID must not be empty");
return NULL;
}
@@ -125,28 +125,28 @@ example_csh_normalize_contact (TpHandleRepoIface *repo,
if (at == NULL || at == id || at[1] == '\0')
{
- g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+ g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
"ID must look like aaa at bbb");
return NULL;
}
if (strchr (at + 1, '@') != NULL)
{
- g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+ g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
"ID cannot contain more than one '@'");
return NULL;
}
if (at[1] == '#' && at[2] == '\0')
{
- g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+ g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
"chatroom name cannot be empty");
return NULL;
}
if (strchr (at + 2, '#') != NULL)
{
- g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+ g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
"realm/chatroom cannot contain '#' except at the beginning");
return NULL;
}
@@ -164,20 +164,20 @@ example_csh_normalize_room (TpHandleRepoIface *repo,
if (id[0] != '#')
{
- g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+ g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
"Chatroom names in this protocol start with #");
}
if (id[1] == '\0')
{
- g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+ g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
"Chatroom name cannot be empty");
return NULL;
}
if (strchr (id, '@') != NULL)
{
- g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+ g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
"Chatroom names in this protocol cannot contain '@'");
return NULL;
}
diff --git a/examples/cm/echo/conn.c b/examples/cm/echo/conn.c
index b086a76..7d6474d 100644
--- a/examples/cm/echo/conn.c
+++ b/examples/cm/echo/conn.c
@@ -104,7 +104,7 @@ example_echo_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_NOT_AVAILABLE,
"ID must not be empty");
return NULL;
}
diff --git a/examples/cm/extended/conn.c b/examples/cm/extended/conn.c
index 63eb469..70c8629 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_INVALID_ARGUMENT,
+ g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
"ID must not be empty");
return NULL;
}
diff --git a/tests/lib/simple-conn.c b/tests/lib/simple-conn.c
index 9e29759..dbf1ec0 100644
--- a/tests/lib/simple-conn.c
+++ b/tests/lib/simple-conn.c
@@ -105,7 +105,7 @@ simple_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_NOT_AVAILABLE,
"ID must not be empty");
return NULL;
}
--
1.5.6.5
More information about the Telepathy-commits
mailing list