Fixed data loading/saving.

This commit is contained in:
Håvard Pettersson 2014-09-20 23:36:40 +02:00
parent 06e7747142
commit 9b39ef3953
4 changed files with 11 additions and 7 deletions

View File

@ -17,6 +17,11 @@
* along with Tox-WeeChat. If not, see <http://www.gnu.org/licenses/>.
*/
/////// TODO //////////
// get rid of data from deleted/nonexisting identities so it doesn't accumulate
///////////////////////
#include <weechat/weechat-plugin.h>
#include <tox/tox.h>
#include <jansson.h>

View File

@ -27,7 +27,6 @@
#include "tox-weechat.h"
#include "tox-weechat-identities.h"
#include "tox-weechat-utils.h"
#include "tox-weechat-json.h"
#include "tox-weechat-friend-requests.h"

View File

@ -262,8 +262,8 @@ tox_weechat_identity_connect(struct t_tox_weechat_identity *identity)
(uint8_t *)name, strlen(name));
}
// load JSON data
tox_weechat_json_identity_load(identity);
// load data
tox_weechat_data_identity_load(identity);
// bootstrap DHT
int max_bootstrap_nodes = 5;
@ -292,8 +292,8 @@ tox_weechat_identity_disconnect(struct t_tox_weechat_identity *identity)
if (!identity->tox)
return;
// save JSON data
tox_weechat_json_identity_save(identity);
// save data
tox_weechat_data_identity_save(identity);
// save and kill tox
int result = tox_weechat_save_identity_data_file(identity);

View File

@ -48,7 +48,7 @@ weechat_plugin_init(struct t_weechat_plugin *plugin, int argc, char *argv[])
tox_weechat_config_init();
tox_weechat_config_read();
tox_weechat_json_load();
tox_weechat_data_load();
tox_weechat_commands_init();
tox_weechat_gui_init();
tox_weechat_completion_init();
@ -62,7 +62,7 @@ int
weechat_plugin_end(struct t_weechat_plugin *plugin)
{
tox_weechat_config_write();
tox_weechat_json_save();
tox_weechat_data_save();
tox_weechat_identity_free_all();
return WEECHAT_RC_OK;