Prechádzať zdrojové kódy

Renamed timeline_here() to object_here().

default 3 rokov pred
rodič
commit
3e2891b100
3 zmenil súbory, kde vykonal 11 pridanie a 11 odobranie
  1. 1 1
      activitypub.c
  2. 9 9
      data.c
  3. 1 1
      snac.h

+ 1 - 1
activitypub.c

@@ -85,7 +85,7 @@ int timeline_request(snac *snac, char *id, char *referrer)
 
 
     if (!xs_is_null(id)) {
     if (!xs_is_null(id)) {
         /* is the admired object already there? */
         /* is the admired object already there? */
-        if (!timeline_here(snac, id)) {
+        if (!object_here(id)) {
             xs *object = NULL;
             xs *object = NULL;
 
 
             /* no; download it */
             /* no; download it */

+ 9 - 9
data.c

@@ -411,6 +411,15 @@ d_char *_object_fn(const char *id)
 }
 }
 
 
 
 
+int object_here(char *id)
+/* checks if an object is already downloaded */
+{
+    xs *fn = _object_fn(id);
+
+    return mtime(fn) > 0.0;
+}
+
+
 int object_get_by_md5(const char *md5, d_char **obj, const char *type)
 int object_get_by_md5(const char *md5, d_char **obj, const char *type)
 /* returns a stored object, optionally of the requested type */
 /* returns a stored object, optionally of the requested type */
 {
 {
@@ -758,15 +767,6 @@ d_char *_timeline_find_fn(snac *snac, char *id)
 }
 }
 
 
 
 
-int timeline_here(snac *snac, char *id)
-/* checks if an object is already downloaded */
-{
-    xs *fn = _timeline_find_fn(snac, id);
-
-    return fn != NULL;
-}
-
-
 d_char *timeline_find(snac *snac, char *id)
 d_char *timeline_find(snac *snac, char *id)
 /* gets a message from the timeline by id */
 /* gets a message from the timeline by id */
 {
 {

+ 1 - 1
snac.h

@@ -60,6 +60,7 @@ int index_first(const char *fn, char *buf, int size);
 d_char *index_list(const char *fn, int max);
 d_char *index_list(const char *fn, int max);
 d_char *index_list_desc(const char *fn, int max);
 d_char *index_list_desc(const char *fn, int max);
 
 
+int object_here(char *id);
 int object_get_by_md5(const char *md5, d_char **obj, const char *type);
 int object_get_by_md5(const char *md5, d_char **obj, const char *type);
 int object_get(const char *id, d_char **obj, const char *type);
 int object_get(const char *id, d_char **obj, const char *type);
 int object_del(const char *id);
 int object_del(const char *id);
@@ -75,7 +76,6 @@ int follower_check(snac *snac, const char *actor);
 d_char *follower_list(snac *snac);
 d_char *follower_list(snac *snac);
 
 
 double timeline_mtime(snac *snac);
 double timeline_mtime(snac *snac);
-int timeline_here(snac *snac, char *id);
 d_char *_timeline_find_fn(snac *snac, char *id);
 d_char *_timeline_find_fn(snac *snac, char *id);
 d_char *timeline_find(snac *snac, char *id);
 d_char *timeline_find(snac *snac, char *id);
 int timeline_del(snac *snac, char *id);
 int timeline_del(snac *snac, char *id);