diff options
Diffstat (limited to 'testing/toxic/main.c')
-rw-r--r-- | testing/toxic/main.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/testing/toxic/main.c b/testing/toxic/main.c index 2da87bc6..9abe8de4 100644 --- a/testing/toxic/main.c +++ b/testing/toxic/main.c | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | /* Export for use in Callbacks */ | 28 | /* Export for use in Callbacks */ |
29 | char *DATA_FILE = NULL; | 29 | char *DATA_FILE = NULL; |
30 | char *SRVLIST_FILE = NULL; | ||
30 | 31 | ||
31 | void on_window_resize(int sig) | 32 | void on_window_resize(int sig) |
32 | { | 33 | { |
@@ -74,10 +75,12 @@ static Messenger *init_tox() | |||
74 | m_callback_action(m, on_action, NULL); | 75 | m_callback_action(m, on_action, NULL); |
75 | #ifdef __linux__ | 76 | #ifdef __linux__ |
76 | setname(m, (uint8_t *) "Cool guy", sizeof("Cool guy")); | 77 | setname(m, (uint8_t *) "Cool guy", sizeof("Cool guy")); |
77 | #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) | 78 | #elif defined(WIN32) |
78 | setname(m, (uint8_t *) "I should install GNU/Linux", sizeof("I should install GNU/Linux")); | 79 | setname(m, (uint8_t *) "I should install GNU/Linux", sizeof("I should install GNU/Linux")); |
80 | #elif defined(__APPLE__) | ||
81 | setname(m, (uint8_t *) "Hipster", sizeof("Hipster")); //This used to users of other Unixes are hipsters | ||
79 | #else | 82 | #else |
80 | setname(m, (uint8_t *) "Hipster", sizeof("Hipster")); | 83 | setname(m, (uint8_t *) "Registered Minix user #4", sizeof("Registered Minix user #4")); |
81 | #endif | 84 | #endif |
82 | return m; | 85 | return m; |
83 | } | 86 | } |
@@ -89,14 +92,12 @@ static Messenger *init_tox() | |||
89 | /* Connects to a random DHT server listed in the DHTservers file */ | 92 | /* Connects to a random DHT server listed in the DHTservers file */ |
90 | int init_connection(void) | 93 | int init_connection(void) |
91 | { | 94 | { |
95 | FILE *fp = NULL; | ||
96 | |||
92 | if (DHT_isconnected()) | 97 | if (DHT_isconnected()) |
93 | return 0; | 98 | return 0; |
94 | 99 | ||
95 | #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) | 100 | fp = fopen(SRVLIST_FILE, "r"); |
96 | FILE *fp = fopen("DHTservers", "r"); | ||
97 | #else | ||
98 | FILE *fp = fopen("~/.tox/DHTservers", "r"); | ||
99 | #endif | ||
100 | 101 | ||
101 | if (!fp) | 102 | if (!fp) |
102 | return 1; | 103 | return 1; |
@@ -290,11 +291,17 @@ int main(int argc, char *argv[]) | |||
290 | 291 | ||
291 | if (config_err) { | 292 | if (config_err) { |
292 | DATA_FILE = strdup("data"); | 293 | DATA_FILE = strdup("data"); |
294 | SRVLIST_FILE = strdup("../../other/DHTservers"); | ||
293 | } else { | 295 | } else { |
294 | DATA_FILE = malloc(strlen(user_config_dir) + strlen(CONFIGDIR) + strlen("data") + 1); | 296 | DATA_FILE = malloc(strlen(user_config_dir) + strlen(CONFIGDIR) + strlen("data") + 1); |
295 | strcpy(DATA_FILE, user_config_dir); | 297 | strcpy(DATA_FILE, user_config_dir); |
296 | strcat(DATA_FILE, CONFIGDIR); | 298 | strcat(DATA_FILE, CONFIGDIR); |
297 | strcat(DATA_FILE, "data"); | 299 | strcat(DATA_FILE, "data"); |
300 | |||
301 | SRVLIST_FILE = malloc(strlen(user_config_dir) + strlen(CONFIGDIR) + strlen("DHTservers") + 1); | ||
302 | strcpy(SRVLIST_FILE, user_config_dir); | ||
303 | strcat(SRVLIST_FILE, CONFIGDIR); | ||
304 | strcat(SRVLIST_FILE, "DHTservers"); | ||
298 | } | 305 | } |
299 | } | 306 | } |
300 | 307 | ||
@@ -303,7 +310,6 @@ int main(int argc, char *argv[]) | |||
303 | init_term(); | 310 | init_term(); |
304 | Messenger *m = init_tox(); | 311 | Messenger *m = init_tox(); |
305 | ToxWindow *prompt = init_windows(m); | 312 | ToxWindow *prompt = init_windows(m); |
306 | init_window_status(); | ||
307 | 313 | ||
308 | if (f_loadfromfile) | 314 | if (f_loadfromfile) |
309 | load_data(m, DATA_FILE); | 315 | load_data(m, DATA_FILE); |
@@ -332,5 +338,6 @@ int main(int argc, char *argv[]) | |||
332 | 338 | ||
333 | cleanupMessenger(m); | 339 | cleanupMessenger(m); |
334 | free(DATA_FILE); | 340 | free(DATA_FILE); |
341 | free(SRVLIST_FILE); | ||
335 | return 0; | 342 | return 0; |
336 | } | 343 | } |