Mercurial > hg > nnchat
comparison main.c @ 565:de1af9652fef
Update to conform to changes in th-libs ioctx API.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 15 Nov 2012 20:28:07 +0200 |
parents | 6e5789cbb4d4 |
children | 3ae357fd34bb |
comparison
equal
deleted
inserted
replaced
564:6e5789cbb4d4 | 565:de1af9652fef |
---|---|
395 (void) conn; | 395 (void) conn; |
396 printMsgConst(NULL, LOG_STAMP | LOG_WINDOW | LOG_FILE, msg); | 396 printMsgConst(NULL, LOG_STAMP | LOG_WINDOW | LOG_FILE, msg); |
397 } | 397 } |
398 | 398 |
399 | 399 |
400 void nn_ioctx_errfunc(th_ioctx_t *ctx, int err, const char *msg) | |
401 { | |
402 (void) err; | |
403 errorMsg("['%s' @ #%d]: %s", | |
404 ctx->filename, ctx->line, msg); | |
405 } | |
406 | |
407 | |
408 void nn_ioctx_msgfunc(th_ioctx_t *ctx, const char *msg) | |
409 { | |
410 (void) ctx; | |
411 printMsgConst(NULL, LOG_STAMP | LOG_WINDOW | LOG_FILE, msg); | |
412 } | |
413 | |
414 | |
400 BOOL checkNameList(qlist_t *list, const char *name) | 415 BOOL checkNameList(qlist_t *list, const char *name) |
401 { | 416 { |
402 qlist_t *node; | 417 qlist_t *node; |
403 | 418 |
404 for (node = list; node != NULL; node = node->next) | 419 for (node = list; node != NULL; node = node->next) |
1009 th_ioctx_t ctx; | 1024 th_ioctx_t ctx; |
1010 #ifndef __WIN32 | 1025 #ifndef __WIN32 |
1011 int cfgfd = -1; | 1026 int cfgfd = -1; |
1012 #endif | 1027 #endif |
1013 | 1028 |
1014 if (!th_ioctx_init(&ctx, setConfigFile)) | 1029 if (!th_ioctx_init(&ctx, setConfigFile, nn_ioctx_errfunc, nn_ioctx_msgfunc)) |
1015 { | 1030 { |
1016 printMsgQ(currWin, "Could not initialize I/O context for configuration file writing!\n"); | 1031 printMsgQ(currWin, "Could not initialize I/O context for configuration file writing!\n"); |
1017 goto error; | 1032 goto error; |
1018 } | 1033 } |
1019 | 1034 |
1850 th_ioctx_t ctx; | 1865 th_ioctx_t ctx; |
1851 setConfigFile = th_strdup_printf("%s%c%s", setHomeDir, SET_DIR_SEPARATOR, SET_CONFIG_FILE); | 1866 setConfigFile = th_strdup_printf("%s%c%s", setHomeDir, SET_DIR_SEPARATOR, SET_CONFIG_FILE); |
1852 | 1867 |
1853 THMSG(0, "Reading configuration from '%s'.\n", setConfigFile); | 1868 THMSG(0, "Reading configuration from '%s'.\n", setConfigFile); |
1854 | 1869 |
1855 if (th_ioctx_open(&ctx, setConfigFile, "r")) | 1870 if (th_ioctx_open(&ctx, setConfigFile, "r", nn_ioctx_errfunc, nn_ioctx_msgfunc)) |
1856 { | 1871 { |
1857 th_cfg_read(&ctx, cfg); | 1872 th_cfg_read(&ctx, cfg); |
1858 th_ioctx_close(&ctx); | 1873 th_ioctx_close(&ctx); |
1859 } | 1874 } |
1860 } | 1875 } |