[telepathy-gabble/master] remove checks made redundant by gabble_decode_jid() changes

Dafydd Harries dafydd.harries at collabora.co.uk
Tue Aug 25 11:11:11 PDT 2009


In particular, callers no longer need to check whether returned node and
resource strings are empty.
---
 src/bytestream-factory.c |    4 ++--
 src/connection.c         |    5 ++---
 src/util.c               |    5 ++---
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/bytestream-factory.c b/src/bytestream-factory.c
index 255535e..a442230 100644
--- a/src/bytestream-factory.c
+++ b/src/bytestream-factory.c
@@ -974,7 +974,7 @@ bytestream_factory_iq_si_cb (LmMessageHandler *handler,
           goto out;
         }
 
-      if (!peer_resource || peer_resource[0] == '\0')
+      if (!peer_resource)
         {
           DEBUG ("Got an SI IQ response from a JID without a resource."
               "Ignoring.");
@@ -1885,7 +1885,7 @@ streaminit_reply_cb (GabbleConnection *conn,
           goto END;
         }
 
-      if (peer_resource == NULL || peer_resource[0] == '\0')
+      if (peer_resource == NULL)
         {
           DEBUG ("Got an SI request from a JID without a resource; ignoring");
           goto END;
diff --git a/src/connection.c b/src/connection.c
index fa5af4d..41e070f 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -970,8 +970,7 @@ _gabble_connection_set_properties_from_account (GabbleConnection *conn,
   result = TRUE;
 
   if (!gabble_decode_jid (account, &username, &server, &resource) ||
-      username == NULL || server == NULL ||
-      *username == '\0' || *server == '\0')
+      username == NULL)
     {
       g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
           "unable to get username and server from account");
@@ -3160,7 +3159,7 @@ room_jid_verify (RoomVerifyBatch *batch,
   room = service = NULL;
 
   if (!gabble_decode_jid (batch->contexts[i].jid, &room, &service, NULL) ||
-      room == NULL || *room == '\0' || service == NULL || *service == '\0')
+      room == NULL)
     {
       g_set_error (&error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
           "unable to get room name and service from JID %s",
diff --git a/src/util.c b/src/util.c
index 1a7d699..9985f0d 100644
--- a/src/util.c
+++ b/src/util.c
@@ -598,11 +598,10 @@ gabble_normalize_contact (TpHandleRepoIface *repo,
   gchar *username = NULL, *server = NULL, *resource = NULL;
   gchar *ret = NULL;
 
-  if (!gabble_decode_jid (jid, &username, &server, &resource) ||
-      !username || !server || !username[0] || !server[0])
+  if (!gabble_decode_jid (jid, &username, &server, &resource) || !username)
     {
       INVALID_HANDLE (error,
-          "jid %s has invalid username or server", jid);
+          "JID %s is invalid or has no node part", jid);
       goto OUT;
     }
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list