Changes in storage_xml.c [098a75b:5ebff60]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
storage_xml.c
r098a75b r5ebff60 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 }109 105 local = protocol_account_islocal(protocol); 110 106 } … … 128 124 } 129 125 } else { 130 g_free(pass_cr);131 g_free(password);132 126 return XT_ABORT; 133 127 } … … 203 197 fn = g_strconcat(global.conf->configdir, xd->given_nick, ".xml", NULL); 204 198 if ((fd = open(fn, O_RDONLY)) < 0) { 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 } 199 ret = STORAGE_NO_SUCH_USER; 210 200 goto error; 211 201 } … … 269 259 270 260 261 static gboolean xml_generate_nick(gpointer key, gpointer value, gpointer data); 271 262 static void xml_generate_settings(struct xt_node *cur, set_t **head); 272 263 … … 301 292 302 293 for (acc = irc->b->accounts; acc; acc = acc->next) { 303 GHashTableIter iter;304 gpointer key, value;305 294 unsigned char *pass_cr; 306 295 char *pass_b64; … … 323 312 g_free(pass_b64); 324 313 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 } 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); 332 322 333 323 xml_generate_settings(cur, &acc->set); … … 353 343 354 344 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; 355 356 } 356 357 … … 387 388 strcat(path, ".XXXXXX"); 388 389 if ((fd = mkstemp(path)) < 0) { 389 goto error; 390 irc_rootmsg(irc, "Error while opening configuration file."); 391 return STORAGE_OTHER_ERROR; 390 392 } 391 393 … … 409 411 410 412 error: 411 irc_rootmsg(irc, "Write error : %s", g_strerror(errno));413 irc_rootmsg(irc, "Write error. Disk full?"); 412 414 ret = STORAGE_OTHER_ERROR; 413 415
Note: See TracChangeset
for help on using the changeset viewer.