mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-27 02:13:28 +01:00
old server list wasn't being installed; default to DHTnodes in /usr/local/share/toxic
This commit is contained in:
parent
6c9dbfe3bc
commit
41292c1ded
@ -100,10 +100,10 @@ void write_to_log(uint8_t *msg, uint8_t *name, struct chatlog *log, bool event)
|
||||
|
||||
uint64_t curtime = (uint64_t) time(NULL);
|
||||
|
||||
if (timed_out(log->lastflush, curtime, LOG_FLUSH_LIMIT))
|
||||
if (timed_out(log->lastwrite, curtime, LOG_FLUSH_LIMIT))
|
||||
fflush(log->file);
|
||||
|
||||
log->lastflush = curtime;
|
||||
log->lastwrite = curtime;
|
||||
|
||||
}
|
||||
|
||||
|
33
src/main.c
33
src/main.c
@ -64,8 +64,6 @@
|
||||
|
||||
/* Export for use in Callbacks */
|
||||
char *DATA_FILE = NULL;
|
||||
char *SRVLIST_FILE = NULL;
|
||||
|
||||
ToxWindow *prompt = NULL;
|
||||
|
||||
static int f_loadfromfile; /* 1 if we want to load from/save the data file, 0 otherwise */
|
||||
@ -167,14 +165,12 @@ static char nodes[MAXNODES][NODELEN];
|
||||
static uint16_t ports[MAXNODES];
|
||||
static uint8_t keys[MAXNODES][TOX_CLIENT_ID_SIZE];
|
||||
|
||||
static int nodelist_load(const char *filename)
|
||||
static int nodelist_load(char *filename)
|
||||
{
|
||||
FILE *fp = NULL;
|
||||
|
||||
if (!filename)
|
||||
return 1;
|
||||
|
||||
fp = fopen(filename, "r");
|
||||
FILE *fp = fopen(filename, "r");
|
||||
|
||||
if (fp == NULL)
|
||||
return 1;
|
||||
@ -239,19 +235,10 @@ int init_connection(Tox *m)
|
||||
*/
|
||||
if (!srvlist_loaded) {
|
||||
srvlist_loaded = true;
|
||||
int res = nodelist_load(SRVLIST_FILE);
|
||||
int res = nodelist_load(PACKAGE_DATADIR "/DHTnodes");
|
||||
|
||||
if (res) {
|
||||
/* Fallback on the provided DHTServers in /usr/share or /usr/local/share,
|
||||
so new starts of toxic will connect to the DHT. */
|
||||
res = nodelist_load(PACKAGE_DATADIR "/DHTnodes");
|
||||
|
||||
if (res)
|
||||
if (linecnt < 1)
|
||||
return res;
|
||||
}
|
||||
|
||||
if (!linecnt)
|
||||
return 2;
|
||||
|
||||
res = 3;
|
||||
int i;
|
||||
@ -477,7 +464,6 @@ void exit_toxic(Tox *m)
|
||||
|
||||
kill_all_windows();
|
||||
free(DATA_FILE);
|
||||
free(SRVLIST_FILE);
|
||||
free(prompt->stb);
|
||||
log_disable(prompt->promptbuf->log);
|
||||
free(prompt->promptbuf->log);
|
||||
@ -545,17 +531,6 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
SRVLIST_FILE = malloc(strlen(user_config_dir) + strlen(CONFIGDIR) + strlen("DHTnodes") + 1);
|
||||
if (SRVLIST_FILE != NULL) {
|
||||
strcpy(SRVLIST_FILE, user_config_dir);
|
||||
strcat(SRVLIST_FILE, CONFIGDIR);
|
||||
strcat(SRVLIST_FILE, "DHTnodes");
|
||||
} else {
|
||||
endwin();
|
||||
fprintf(stderr, "malloc() failed. Aborting...\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
free(user_config_dir);
|
||||
|
||||
init_term();
|
||||
|
@ -142,7 +142,7 @@ struct StatusBar {
|
||||
|
||||
struct chatlog {
|
||||
FILE *file;
|
||||
uint64_t lastflush;
|
||||
uint64_t lastwrite;
|
||||
int pos;
|
||||
bool log_on; /* specific to current chat window */
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user