Changes in storage_xml.c [5ebff60:098a75b]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
storage_xml.c
r5ebff60 r098a75b 103 103 if (protocol) { 104 104 prpl = find_protocol(protocol); 105 if (!prpl) { 106 irc_rootmsg(xd->irc, "Error loading user config: Protocol not found: `%s'", protocol); 107 return XT_ABORT; 108 } 105 109 local = protocol_account_islocal(protocol); 106 110 } … … 124 128 } 125 129 } else { 130 g_free(pass_cr); 131 g_free(password); 126 132 return XT_ABORT; 127 133 } … … 197 203 fn = g_strconcat(global.conf->configdir, xd->given_nick, ".xml", NULL); 198 204 if ((fd = open(fn, O_RDONLY)) < 0) { 199 ret = STORAGE_NO_SUCH_USER; 205 if (errno == ENOENT) { 206 ret = STORAGE_NO_SUCH_USER; 207 } else { 208 irc_rootmsg(irc, "Error loading user config: %s", g_strerror(errno)); 209 } 200 210 goto error; 201 211 } … … 259 269 260 270 261 static gboolean xml_generate_nick(gpointer key, gpointer value, gpointer data);262 271 static void xml_generate_settings(struct xt_node *cur, set_t **head); 263 272 … … 292 301 293 302 for (acc = irc->b->accounts; acc; acc = acc->next) { 303 GHashTableIter iter; 304 gpointer key, value; 294 305 unsigned char *pass_cr; 295 306 char *pass_b64; … … 312 323 g_free(pass_b64); 313 324 314 /* This probably looks pretty strange. g_hash_table_foreach 315 is quite a PITA already (but it can't get much better in 316 C without using #define, I'm afraid), and it 317 doesn't seem to be possible to abort the foreach on write 318 errors, so instead let's use the _find function and 319 return TRUE on write errors. Which means, if we found 320 something, there was an error. :-) */ 321 g_hash_table_find(acc->nicks, xml_generate_nick, cur); 325 g_hash_table_iter_init(&iter, acc->nicks); 326 while (g_hash_table_iter_next(&iter, &key, &value)) { 327 struct xt_node *node = xt_new_node("buddy", NULL, NULL); 328 xt_add_attr(node, "handle", key); 329 xt_add_attr(node, "nick", value); 330 xt_add_child(cur, node); 331 } 322 332 323 333 xml_generate_settings(cur, &acc->set); … … 343 353 344 354 return root; 345 }346 347 static gboolean xml_generate_nick(gpointer key, gpointer value, gpointer data)348 {349 struct xt_node *node = xt_new_node("buddy", NULL, NULL);350 351 xt_add_attr(node, "handle", key);352 xt_add_attr(node, "nick", value);353 xt_add_child((struct xt_node *) data, node);354 355 return FALSE;356 355 } 357 356 … … 388 387 strcat(path, ".XXXXXX"); 389 388 if ((fd = mkstemp(path)) < 0) { 390 irc_rootmsg(irc, "Error while opening configuration file."); 391 return STORAGE_OTHER_ERROR; 389 goto error; 392 390 } 393 391 … … 411 409 412 410 error: 413 irc_rootmsg(irc, "Write error . Disk full?");411 irc_rootmsg(irc, "Write error: %s", g_strerror(errno)); 414 412 ret = STORAGE_OTHER_ERROR; 415 413
Note: See TracChangeset
for help on using the changeset viewer.