diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ffa115..849187f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,7 @@ add_library(tox MODULE src/tox-weechat-gui.c src/tox-weechat-utils.c src/tox-weechat-config.c - src/tox-weechat-json.c + src/tox-weechat-data.c src/tox-weechat-completion.c ) diff --git a/src/tox-weechat-json.c b/src/tox-weechat-data.c similarity index 94% rename from src/tox-weechat-json.c rename to src/tox-weechat-data.c index deab25e..67fbd09 100644 --- a/src/tox-weechat-json.c +++ b/src/tox-weechat-data.c @@ -26,7 +26,7 @@ #include "tox-weechat-friend-requests.h" #include "tox-weechat-utils.h" -#include "tox-weechat-json.h" +#include "tox-weechat-data.h" #define TOX_WEECHAT_JSON_CONFIG_PATH "%h/tox/data.json" @@ -65,7 +65,7 @@ tox_weechat_json_get_identity_key(struct t_tox_weechat_identity *identity) * Save an identity's data. */ void -tox_weechat_json_identity_save(struct t_tox_weechat_identity *identity) +tox_weechat_data_identity_save(struct t_tox_weechat_identity *identity) { json_t *json_data = json_object(); json_t *friend_request_array = json_array(); @@ -114,7 +114,7 @@ tox_weechat_json_identity_save(struct t_tox_weechat_identity *identity) * Load an identity's data from a JSON object. */ void -tox_weechat_json_identity_load(struct t_tox_weechat_identity *identity) +tox_weechat_data_identity_load(struct t_tox_weechat_identity *identity) { char *identity_key = tox_weechat_json_get_identity_key(identity); json_t *identity_data = json_object_get(tox_weechat_json_data, identity_key); @@ -150,10 +150,10 @@ tox_weechat_json_identity_load(struct t_tox_weechat_identity *identity) } /** - * Load the JSON data on disk into memory. + * Load the data on disk into memory. */ void -tox_weechat_json_load() +tox_weechat_data_load() { char *full_path = tox_weechat_json_data_file_path(); @@ -173,11 +173,11 @@ tox_weechat_json_load() } /** - * Save all in-memory data to JSON data on disk. Return 0 on success, -1 on + * Save all in-memory data to data on disk. Return 0 on success, -1 on * error. */ int -tox_weechat_json_save() +tox_weechat_data_save() { char *full_path = tox_weechat_json_data_file_path(); int rc = json_dump_file(tox_weechat_json_data, @@ -192,7 +192,7 @@ tox_weechat_json_save() * Free in-memory JSON data. */ void -tox_weechat_json_free() +tox_weechat_data_free() { json_decref(tox_weechat_json_data); } diff --git a/src/tox-weechat-json.h b/src/tox-weechat-data.h similarity index 60% rename from src/tox-weechat-json.h rename to src/tox-weechat-data.h index b301277..b26b7ac 100644 --- a/src/tox-weechat-json.h +++ b/src/tox-weechat-data.h @@ -17,30 +17,28 @@ * along with Tox-WeeChat. If not, see . */ -#ifndef TOX_WEECHAT_JSON_H -#define TOX_WEECHAT_JSON_H +#ifndef TOX_WEECHAT_DATA_H +#define TOX_WEECHAT_DATA_H -#include "tox-weechat-identities.h" +struct t_tox_weechat_identity; -extern const char *tox_weechat_json_key_friend_requests; -extern const char *tox_weechat_json_friend_request_key_client_id; -extern const char *tox_weechat_json_friend_request_key_message; - -struct json_t; +extern const char *tox_weechat_data_key_friend_requests; +extern const char *tox_weechat_data_friend_request_key_client_id; +extern const char *tox_weechat_data_friend_request_key_message; void -tox_weechat_json_load(); +tox_weechat_data_load(); void -tox_weechat_json_identity_save(struct t_tox_weechat_identity *identity); +tox_weechat_data_identity_save(struct t_tox_weechat_identity *identity); void -tox_weechat_json_identity_load(struct t_tox_weechat_identity *identity); +tox_weechat_data_identity_load(struct t_tox_weechat_identity *identity); int -tox_weechat_json_save(); +tox_weechat_data_save(); void -tox_weechat_json_free(); +tox_weechat_data_free(); -#endif // TOX_WEECHAT_JSON_H +#endif // TOX_WEECHAT_DATA_H diff --git a/src/tox-weechat-identities.c b/src/tox-weechat-identities.c index 510b654..9c9d982 100644 --- a/src/tox-weechat-identities.c +++ b/src/tox-weechat-identities.c @@ -34,7 +34,7 @@ #include "tox-weechat-chats.h" #include "tox-weechat-tox-callbacks.h" #include "tox-weechat-utils.h" -#include "tox-weechat-json.h" +#include "tox-weechat-data.h" #include "tox-weechat-identities.h" diff --git a/src/tox-weechat.c b/src/tox-weechat.c index 37d2dde..7e30e1f 100644 --- a/src/tox-weechat.c +++ b/src/tox-weechat.c @@ -26,7 +26,7 @@ #include "tox-weechat-gui.h" #include "tox-weechat-friend-requests.h" #include "tox-weechat-config.h" -#include "tox-weechat-json.h" +#include "tox-weechat-data.h" #include "tox-weechat-completion.h" #include "tox-weechat.h"