mirror of
https://github.com/xorgy/mediafire-fuse
synced 2026-01-13 13:14:29 -08:00
Optimize device/get_changes updates
- don't use folder/get_content but rely on parent information - add many more debugging information and sanity checks - ignore trash - correctly update local device revision using device_response - remove "visited" member and change housekeeping function to check for consistency of parents and children (and retrieve fix from remote if necessary) - print key and parent key in the debugging function - check for remote updates on every fs function - introduce global defines for key and filename length - add parent member, getters and setters to file.h
This commit is contained in:
@@ -69,9 +69,8 @@ static int _decode_file_get_info(mfhttp * conn, void *data)
|
||||
json_error_t error;
|
||||
json_t *root;
|
||||
json_t *node;
|
||||
json_t *obj;
|
||||
json_t *quickkey;
|
||||
json_t *file_hash;
|
||||
json_t *file_name;
|
||||
int retval = 0;
|
||||
mffile *file;
|
||||
|
||||
@@ -88,15 +87,23 @@ static int _decode_file_get_info(mfhttp * conn, void *data)
|
||||
if (quickkey != NULL)
|
||||
file_set_key(file, json_string_value(quickkey));
|
||||
|
||||
file_name = json_object_get(node, "filename");
|
||||
if (file_name != NULL)
|
||||
file_set_name(file, json_string_value(file_name));
|
||||
obj = json_object_get(node, "filename");
|
||||
if (obj != NULL)
|
||||
file_set_name(file, json_string_value(obj));
|
||||
|
||||
file_hash = json_object_get(node, "hash");
|
||||
if (file_hash != NULL) {
|
||||
file_set_hash(file, json_string_value(file_hash));
|
||||
obj = json_object_get(node, "hash");
|
||||
if (obj != NULL) {
|
||||
file_set_hash(file, json_string_value(obj));
|
||||
}
|
||||
|
||||
obj = json_object_get(node, "parent_folderkey");
|
||||
if (obj != NULL) {
|
||||
file_set_parent(file, json_string_value(obj));
|
||||
}
|
||||
// infer that the parent folder must be root
|
||||
if (obj == NULL && quickkey != NULL)
|
||||
file_set_parent(file, NULL);
|
||||
|
||||
if (quickkey == NULL)
|
||||
retval = -1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user