Renamed tox-weechat-json to -data.

This commit is contained in:
Håvard Pettersson 2014-09-20 23:30:44 +02:00
parent e02d2c9b0e
commit 06e7747142
5 changed files with 23 additions and 25 deletions

View File

@ -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
)

View File

@ -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);
}

View File

@ -17,30 +17,28 @@
* along with Tox-WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
#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

View File

@ -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"

View File

@ -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"