Added better checks that entry is never expired if it is joined
[silc.git] / apps / silcd / idlist.c
index 3862582cb9e3f3afec92d3079f3568b7cbcf7bf0..883319034af96adfdf022ebde913794e5ea572c1 100644 (file)
@@ -159,13 +159,13 @@ silc_idlist_find_server_by_id(SilcIDList id_list, SilcServerID *id,
 
   server = (SilcServerEntry)id_cache->context;
 
-  if (ret_entry)
-    *ret_entry = id_cache;
-
   if (server && registered && 
       !(server->data.status & SILC_IDLIST_STATUS_REGISTERED))
     return NULL;
 
+  if (ret_entry)
+    *ret_entry = id_cache;
+
   SILC_LOG_DEBUG(("Found"));
 
   return server;
@@ -187,13 +187,13 @@ silc_idlist_find_server_by_name(SilcIDList id_list, char *name,
 
   server = (SilcServerEntry)id_cache->context;
   
-  if (ret_entry)
-    *ret_entry = id_cache;
-
   if (server && registered &&
       !(server->data.status & SILC_IDLIST_STATUS_REGISTERED))
     return NULL;
 
+  if (ret_entry)
+    *ret_entry = id_cache;
+
   SILC_LOG_DEBUG(("Found"));
 
   return server;
@@ -239,13 +239,13 @@ silc_idlist_find_server_by_conn(SilcIDList id_list, char *hostname,
   
   silc_idcache_list_free(list);
 
-  if (ret_entry)
-    *ret_entry = id_cache;
-
   if (server && registered &&
       !(server->data.status & SILC_IDLIST_STATUS_REGISTERED))
     return NULL;
 
+  if (ret_entry)
+    *ret_entry = id_cache;
+
   SILC_LOG_DEBUG(("Found"));
 
   return server;
@@ -493,13 +493,13 @@ silc_idlist_find_client_by_id(SilcIDList id_list, SilcClientID *id,
 
   client = (SilcClientEntry)id_cache->context;
 
-  if (ret_entry)
-    *ret_entry = id_cache;
-
   if (client && registered &&
       !(client->data.status & SILC_IDLIST_STATUS_REGISTERED))
     return NULL;
 
+  if (ret_entry)
+    *ret_entry = id_cache;
+
   SILC_LOG_DEBUG(("Found"));
 
   return client;