|
|
|
@ -120,6 +120,8 @@ struct status* status_fetch_from_uri( const char* uri )
|
|
|
|
|
|
|
|
|
|
s->remote = true;
|
|
|
|
|
s->stub = true;
|
|
|
|
|
s->published = time(NULL);
|
|
|
|
|
s->url = strdup(uri);
|
|
|
|
|
status_save_new(s);
|
|
|
|
|
|
|
|
|
|
hash_index_set( "data/statuses/uri", uri, s->id );
|
|
|
|
@ -158,9 +160,6 @@ struct status* status_fetch_from_uri( const char* uri )
|
|
|
|
|
f = fopen(filename,"r");
|
|
|
|
|
if( !f ) { return NULL; }
|
|
|
|
|
|
|
|
|
|
s = malloc(sizeof(*s));
|
|
|
|
|
memset(s,0,sizeof(*s));
|
|
|
|
|
|
|
|
|
|
// Load the activity and sync status
|
|
|
|
|
act = ap_activity_from_FILE(f); f = NULL;
|
|
|
|
|
if( !act ) { goto failed; }
|
|
|
|
@ -171,6 +170,10 @@ cleanup:
|
|
|
|
|
ap_activity_free(act);
|
|
|
|
|
return s;
|
|
|
|
|
failed:
|
|
|
|
|
if( s ) {
|
|
|
|
|
status_flag_for_async_fetch(s);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
status_free(s);
|
|
|
|
|
s = NULL;
|
|
|
|
|
goto cleanup;
|
|
|
|
@ -284,6 +287,31 @@ void status_free( struct status* s )
|
|
|
|
|
|
|
|
|
|
free(s);
|
|
|
|
|
}
|
|
|
|
|
struct async_status_fetch
|
|
|
|
|
{
|
|
|
|
|
struct {
|
|
|
|
|
int* items;
|
|
|
|
|
int count;
|
|
|
|
|
} ids;
|
|
|
|
|
};
|
|
|
|
|
#define OBJ_TYPE struct async_status_fetch
|
|
|
|
|
static struct json_object_field async_fetch_layout[] = {
|
|
|
|
|
JSON_FIELD_ARRAY_OF_INTS( ids, true ),
|
|
|
|
|
JSON_FIELD_END
|
|
|
|
|
};
|
|
|
|
|
#undef OBJ_TYPE
|
|
|
|
|
void status_flag_for_async_fetch( struct status* s )
|
|
|
|
|
{
|
|
|
|
|
struct async_status_fetch fetch;
|
|
|
|
|
memset( &fetch, 0, sizeof(fetch) );
|
|
|
|
|
|
|
|
|
|
json_read_object_layout_from_file( "data/statuses/async_fetch.json", async_fetch_layout, &fetch );
|
|
|
|
|
|
|
|
|
|
array_append( &fetch.ids, sizeof(s->id), &s->id );
|
|
|
|
|
|
|
|
|
|
json_write_object_layout_to_file( "data/statuses/async_fetch.json", "\t", async_fetch_layout, &fetch );
|
|
|
|
|
free( fetch.ids.items );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void status_add_to_timeline( struct status* s, int timeline_id )
|
|
|
|
|
{
|
|
|
|
|