1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-12 23:53:01 +01:00

old server list wasn't being installed; t in DHTnodes in /usr/local/share/toxic

This commit is contained in:
Jfreegman 2014-03-04 03:10:07 -05:00
parent 6c9dbfe3bc
commit 87bd0f9b34
3 changed files with 9 additions and 34 deletions

View File

@ -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;
}

View File

@ -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)
return res;
}
if (!linecnt)
return 2;
if (linecnt < 1)
return res;
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);
@ -536,7 +522,7 @@ int main(int argc, char *argv[])
if (DATA_FILE != NULL) {
strcpy(DATA_FILE, user_config_dir);
strcat(DATA_FILE, CONFIGDIR);
strcat(DATA_FILE, "data");
strcat(DATA_FILE, "data");
} else {
endwin();
fprintf(stderr, "malloc() failed. Aborting...\n");
@ -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();

View File

@ -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 */
};