aboutsummaryrefslogtreecommitdiff
path: root/src/gnunet_chat_group.c
diff options
context:
space:
mode:
authorTheJackiMonster <thejackimonster@gmail.com>2021-12-18 22:32:59 +0100
committerTheJackiMonster <thejackimonster@gmail.com>2021-12-18 22:32:59 +0100
commit6bbc30ef71cf23267937a73e34e185410ed73a10 (patch)
treefc562e55a9a46f5de081be70a6a78e6c2aabb482 /src/gnunet_chat_group.c
parentea39819757f6888ed983d0c327286e6a7bac8523 (diff)
downloadlibgnunetchat-6bbc30ef71cf23267937a73e34e185410ed73a10.tar.gz
libgnunetchat-6bbc30ef71cf23267937a73e34e185410ed73a10.zip
Fixed problems loading configurations but still inconsistencies
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Diffstat (limited to 'src/gnunet_chat_group.c')
-rw-r--r--src/gnunet_chat_group.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gnunet_chat_group.c b/src/gnunet_chat_group.c
index 6091203..979af18 100644
--- a/src/gnunet_chat_group.c
+++ b/src/gnunet_chat_group.c
@@ -109,19 +109,19 @@ group_load_config (struct GNUNET_CHAT_Group *group)
109 if ((!directory) || (!(group->context))) 109 if ((!directory) || (!(group->context)))
110 return; 110 return;
111 111
112 const struct GNUNET_HashCode *hash = GNUNET_MESSENGER_room_get_key( 112 const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key(
113 group->context->room 113 group->context->room
114 ); 114 );
115 115
116 char* filename; 116 char* filename;
117 util_get_filename(directory, "groups", hash, &filename); 117 util_get_filename(directory, "groups", key, &filename);
118 118
119 if (GNUNET_YES != GNUNET_DISK_file_test(filename)) 119 if (GNUNET_YES != GNUNET_DISK_file_test(filename))
120 goto free_filename; 120 goto free_filename;
121 121
122 struct GNUNET_CONFIGURATION_Handle *config = GNUNET_CONFIGURATION_create(); 122 struct GNUNET_CONFIGURATION_Handle *config = GNUNET_CONFIGURATION_create();
123 123
124 if (GNUNET_OK != GNUNET_CONFIGURATION_load(config, directory)) 124 if (GNUNET_OK != GNUNET_CONFIGURATION_load(config, filename))
125 goto destroy_config; 125 goto destroy_config;
126 126
127 char* name = NULL; 127 char* name = NULL;
@@ -150,7 +150,7 @@ group_save_config (const struct GNUNET_CHAT_Group *group)
150 if ((!directory) || (!(group->context))) 150 if ((!directory) || (!(group->context)))
151 return; 151 return;
152 152
153 const struct GNUNET_HashCode *hash = GNUNET_MESSENGER_room_get_key( 153 const struct GNUNET_HashCode *key = GNUNET_MESSENGER_room_get_key(
154 group->context->room 154 group->context->room
155 ); 155 );
156 156
@@ -161,14 +161,14 @@ group_save_config (const struct GNUNET_CHAT_Group *group)
161 struct GNUNET_HashCode topic_hash; 161 struct GNUNET_HashCode topic_hash;
162 GNUNET_CRYPTO_hash(group->topic, strlen(group->topic), &topic_hash); 162 GNUNET_CRYPTO_hash(group->topic, strlen(group->topic), &topic_hash);
163 163
164 if (0 == GNUNET_memcmp(hash, &topic_hash)) 164 if (0 == GNUNET_memcmp(key, &topic_hash))
165 GNUNET_CONFIGURATION_set_value_string( 165 GNUNET_CONFIGURATION_set_value_string(
166 config, "group", "topic", group->topic 166 config, "group", "topic", group->topic
167 ); 167 );
168 } 168 }
169 169
170 char* filename; 170 char* filename;
171 util_get_filename(directory, "groups", hash, &filename); 171 util_get_filename(directory, "groups", key, &filename);
172 172
173 if (GNUNET_OK == GNUNET_DISK_directory_create_for_file(filename)) 173 if (GNUNET_OK == GNUNET_DISK_directory_create_for_file(filename))
174 GNUNET_CONFIGURATION_write(config, filename); 174 GNUNET_CONFIGURATION_write(config, filename);