diff options
Diffstat (limited to 'testing/nTox.c')
-rw-r--r-- | testing/nTox.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/testing/nTox.c b/testing/nTox.c index 13e97671..960dfb27 100644 --- a/testing/nTox.c +++ b/testing/nTox.c | |||
@@ -36,8 +36,6 @@ | |||
36 | char lines[HISTORY][STRING_LENGTH]; | 36 | char lines[HISTORY][STRING_LENGTH]; |
37 | char line[STRING_LENGTH]; | 37 | char line[STRING_LENGTH]; |
38 | int x,y; | 38 | int x,y; |
39 | int nick_before; | ||
40 | |||
41 | 39 | ||
42 | uint8_t pending_requests[256][CLIENT_ID_SIZE]; | 40 | uint8_t pending_requests[256][CLIENT_ID_SIZE]; |
43 | uint8_t num_requests; | 41 | uint8_t num_requests; |
@@ -89,7 +87,7 @@ void line_eval(char lines[HISTORY][STRING_LENGTH], char *line) | |||
89 | } | 87 | } |
90 | int num = atoi(numstring); | 88 | int num = atoi(numstring); |
91 | if(m_sendmessage(num, (uint8_t*) message, sizeof(message)) != 1) { | 89 | if(m_sendmessage(num, (uint8_t*) message, sizeof(message)) != 1) { |
92 | new_lines("Error sending message."); | 90 | new_lines("[i] could not send message"); |
93 | } | 91 | } |
94 | } | 92 | } |
95 | else if (line[1] == 'n') { | 93 | else if (line[1] == 'n') { |
@@ -201,14 +199,12 @@ void do_refresh() | |||
201 | refresh(); | 199 | refresh(); |
202 | } | 200 | } |
203 | 201 | ||
204 | |||
205 | |||
206 | void print_request(uint8_t *public_key, uint8_t *data, uint16_t length) | 202 | void print_request(uint8_t *public_key, uint8_t *data, uint16_t length) |
207 | { | 203 | { |
208 | new_lines("[i] received friend request with message:"); | 204 | new_lines("[i] received friend request with message:"); |
209 | new_lines((char *)data); | 205 | new_lines((char *)data); |
210 | char numchar[100]; | 206 | char numchar[100]; |
211 | sprintf(numchar, "[i] To accept the request do: /a %u", num_requests); | 207 | sprintf(numchar, "[i] accept request with /a %u", num_requests); |
212 | new_lines(numchar); | 208 | new_lines(numchar); |
213 | memcpy(pending_requests[num_requests], public_key, CLIENT_ID_SIZE); | 209 | memcpy(pending_requests[num_requests], public_key, CLIENT_ID_SIZE); |
214 | ++num_requests; | 210 | ++num_requests; |
@@ -227,7 +223,7 @@ void print_message(int friendnumber, uint8_t * string, uint16_t length) | |||
227 | char* temp = asctime(timeinfo); | 223 | char* temp = asctime(timeinfo); |
228 | size_t len = strlen(temp); | 224 | size_t len = strlen(temp); |
229 | temp[len-1]='\0'; | 225 | temp[len-1]='\0'; |
230 | sprintf(msg, "[%d] %s <%s> %s", friendnumber, temp, name, string); // someone please fix this | 226 | sprintf(msg, "[%d] %s <%s> %s", friendnumber, temp, name, string); // timestamp |
231 | new_lines(msg); | 227 | new_lines(msg); |
232 | } | 228 | } |
233 | 229 | ||
@@ -256,7 +252,7 @@ void load_key(){ | |||
256 | fseek(data_file, 0, SEEK_SET); | 252 | fseek(data_file, 0, SEEK_SET); |
257 | uint8_t data[size]; | 253 | uint8_t data[size]; |
258 | if(fread(data, sizeof(uint8_t), size, data_file) != size){ | 254 | if(fread(data, sizeof(uint8_t), size, data_file) != size){ |
259 | printf("Error reading data file\nExiting.\n"); | 255 | printf("[i] could not read data file\n[i] exiting\n"); |
260 | exit(1); | 256 | exit(1); |
261 | } | 257 | } |
262 | Messenger_load(data, size); | 258 | Messenger_load(data, size); |
@@ -267,7 +263,7 @@ void load_key(){ | |||
267 | Messenger_save(data); | 263 | Messenger_save(data); |
268 | data_file = fopen("data","w"); | 264 | data_file = fopen("data","w"); |
269 | if(fwrite(data, sizeof(uint8_t), size, data_file) != size){ | 265 | if(fwrite(data, sizeof(uint8_t), size, data_file) != size){ |
270 | printf("Error writing data file\nExiting.\n"); | 266 | printf("[i] could not write data file\n[i] exiting\n"); |
271 | exit(1); | 267 | exit(1); |
272 | } | 268 | } |
273 | } | 269 | } |