int topiclist_load(char const * topicfile) { std::FILE * fp; char channel_name[MAX_CHANNELNAME_LEN]; char topic[MAX_TOPIC_LEN]; // make sure to unload previous topiclist before loading again if (topiclist_head) topiclist_unload(); if ((fp = std::fopen(topicfile, "r")) == NULL) { eventlog(eventlog_level_error, __FUNCTION__, "can't open topic file"); return -1; } topiclist_head = list_create(); eventlog(eventlog_level_trace, __FUNCTION__, "start reading topic file"); while (std::fscanf(fp, "\"%[^\"]\",\"%[^\"]\"\n", channel_name, topic) == 2) { topiclist_add_topic(channel_name, topic, DO_SAVE_TOPIC); eventlog(eventlog_level_trace, __FUNCTION__, "channel: %s topic: \"%s\"", channel_name, topic); } eventlog(eventlog_level_trace, __FUNCTION__, "finished reading topic file"); std::fclose(fp); return 0; }
void post_server_shutdown(int status) { switch (status) { case 0: topiclist_unload(); realmlist_destroy(); teamlist_unload(); clanlist_unload(); tournament_destroy(); anongame_infos_unload(); trans_unload(); aliasfile_unload(); command_groups_unload(); tracker_set_servers(NULL); characterlist_destroy(); ladder_destroyxptable(); case STATUS_WAR3XPTABLES_FAILURE: case STATUS_LADDERLIST_FAILURE: ladder_update_all_accounts(); ladders_destroy(); output_dispose_filename(); accountlist_destroy(); attrlayer_cleanup(); watchlist_destroy(); news_unload(); versioncheck_unload(); autoupdate_unload(); adbannerlist_destroy(); ipbanlist_save(prefs_get_ipbanfile()); ipbanlist_destroy(); helpfile_unload(); channellist_destroy(); server_clear_hostname(); timerlist_destroy(); gamelist_destroy(); connlist_destroy(); fdwatch_close(); case STATUS_FDWATCH_FAILURE: anongame_matchlists_destroy(); case STATUS_MATCHLISTS_FAILURE: anongame_maplists_destroy(); case STATUS_MAPLISTS_FAILURE: case STATUS_SUPPORT_FAILURE: if (psock_deinit()) eventlog(eventlog_level_error, __FUNCTION__, "got error from psock_deinit()"); case STATUS_PSOCK_FAILURE: storage_close(); case STATUS_STORAGE_FAILURE: oom_free(); case STATUS_OOM_FAILURE: case -1: break; default: eventlog(eventlog_level_error,__FUNCTION__,"got bad status \"%d\" during shutdown",status); } return; }