diff options
author | irungentoo <irungentoo@gmail.com> | 2013-08-20 12:08:55 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-08-20 12:08:55 -0400 |
commit | a1c40d753ee8faf15aa0dd314bd4249aa3750b2e (patch) | |
tree | fb52c5cffcb897afa709e2d4a9882e89e9c90b5d /testing/toxic | |
parent | 9f0efe920170472a4f757f7d8dc84f41e794f945 (diff) |
More refactoring done.
Diffstat (limited to 'testing/toxic')
-rw-r--r-- | testing/toxic/dhtstatus.c | 2 | ||||
-rw-r--r-- | testing/toxic/main.c | 14 | ||||
-rw-r--r-- | testing/toxic/prompt.c | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/testing/toxic/dhtstatus.c b/testing/toxic/dhtstatus.c index a11dc616..c7a57c7d 100644 --- a/testing/toxic/dhtstatus.c +++ b/testing/toxic/dhtstatus.c | |||
@@ -36,7 +36,7 @@ static void dhtstatus_onKey(ToxWindow *self, Messenger *m, int key) | |||
36 | 36 | ||
37 | static void dhtstatus_onDraw(ToxWindow *self) | 37 | static void dhtstatus_onDraw(ToxWindow *self) |
38 | { | 38 | { |
39 | Client_data *close_clientlist = DHT_get_close_list(); | 39 | Client_data *close_clientlist = DHT_get_close_list(temp_DHT); |
40 | curs_set(0); | 40 | curs_set(0); |
41 | werase(self->window); | 41 | werase(self->window); |
42 | 42 | ||
diff --git a/testing/toxic/main.c b/testing/toxic/main.c index 9abe8de4..6f6c9db4 100644 --- a/testing/toxic/main.c +++ b/testing/toxic/main.c | |||
@@ -90,11 +90,11 @@ static Messenger *init_tox() | |||
90 | #define MAXSERVERS 50 | 90 | #define MAXSERVERS 50 |
91 | 91 | ||
92 | /* Connects to a random DHT server listed in the DHTservers file */ | 92 | /* Connects to a random DHT server listed in the DHTservers file */ |
93 | int init_connection(void) | 93 | int init_connection(Messenger *m) |
94 | { | 94 | { |
95 | FILE *fp = NULL; | 95 | FILE *fp = NULL; |
96 | 96 | ||
97 | if (DHT_isconnected()) | 97 | if (DHT_isconnected(m->dht)) |
98 | return 0; | 98 | return 0; |
99 | 99 | ||
100 | fp = fopen(SRVLIST_FILE, "r"); | 100 | fp = fopen(SRVLIST_FILE, "r"); |
@@ -135,7 +135,7 @@ int init_connection(void) | |||
135 | 135 | ||
136 | dht.ip.i = resolved_address; | 136 | dht.ip.i = resolved_address; |
137 | unsigned char *binary_string = hex_string_to_bin(key); | 137 | unsigned char *binary_string = hex_string_to_bin(key); |
138 | DHT_bootstrap(dht, binary_string); | 138 | DHT_bootstrap(m->dht, dht, binary_string); |
139 | free(binary_string); | 139 | free(binary_string); |
140 | return 0; | 140 | return 0; |
141 | } | 141 | } |
@@ -146,18 +146,18 @@ static void do_tox(Messenger *m, ToxWindow *prompt) | |||
146 | static int conn_err = 0; | 146 | static int conn_err = 0; |
147 | static bool dht_on = false; | 147 | static bool dht_on = false; |
148 | 148 | ||
149 | if (!dht_on && !DHT_isconnected() && !(conn_try++ % 100)) { | 149 | if (!dht_on && !DHT_isconnected(m->dht) && !(conn_try++ % 100)) { |
150 | if (!conn_err) { | 150 | if (!conn_err) { |
151 | conn_err = init_connection(); | 151 | conn_err = init_connection(m); |
152 | wprintw(prompt->window, "\nEstablishing connection...\n"); | 152 | wprintw(prompt->window, "\nEstablishing connection...\n"); |
153 | 153 | ||
154 | if (conn_err) | 154 | if (conn_err) |
155 | wprintw(prompt->window, "\nAuto-connect failed with error code %d\n", conn_err); | 155 | wprintw(prompt->window, "\nAuto-connect failed with error code %d\n", conn_err); |
156 | } | 156 | } |
157 | } else if (!dht_on && DHT_isconnected()) { | 157 | } else if (!dht_on && DHT_isconnected(m->dht)) { |
158 | dht_on = true; | 158 | dht_on = true; |
159 | wprintw(prompt->window, "\nDHT connected.\n"); | 159 | wprintw(prompt->window, "\nDHT connected.\n"); |
160 | } else if (dht_on && !DHT_isconnected()) { | 160 | } else if (dht_on && !DHT_isconnected(m->dht)) { |
161 | dht_on = false; | 161 | dht_on = false; |
162 | wprintw(prompt->window, "\nDHT disconnected. Attempting to reconnect.\n"); | 162 | wprintw(prompt->window, "\nDHT disconnected. Attempting to reconnect.\n"); |
163 | } | 163 | } |
diff --git a/testing/toxic/prompt.c b/testing/toxic/prompt.c index 81f00bce..204cd7e6 100644 --- a/testing/toxic/prompt.c +++ b/testing/toxic/prompt.c | |||
@@ -204,7 +204,7 @@ void cmd_connect(ToxWindow *self, Messenger *m, char **args) | |||
204 | 204 | ||
205 | dht.ip.i = resolved_address; | 205 | dht.ip.i = resolved_address; |
206 | unsigned char *binary_string = hex_string_to_bin(key); | 206 | unsigned char *binary_string = hex_string_to_bin(key); |
207 | DHT_bootstrap(dht, binary_string); | 207 | DHT_bootstrap(m->dht, dht, binary_string); |
208 | free(binary_string); | 208 | free(binary_string); |
209 | } | 209 | } |
210 | 210 | ||