summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorzugz (tox) <mbays+tox@sdf.org>2018-09-09 23:21:20 +0200
committerzugz (tox) <mbays+tox@sdf.org>2018-10-20 11:03:10 +0200
commit744dc2f5da2c54ad1e4d7d6ce229bc1756d81263 (patch)
tree35f6590fe3150118bc6b1336fbb0a7db06543668 /testing
parentaa5c7828802b3fcaedfd8d6fe9a08ca714b9aa2b (diff)
Make saving and loading the responsibility of Tox rather than Messenger
Diffstat (limited to 'testing')
-rw-r--r--testing/Messenger_test.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/testing/Messenger_test.c b/testing/Messenger_test.c
index 5abb3998..a61d0dcf 100644
--- a/testing/Messenger_test.c
+++ b/testing/Messenger_test.c
@@ -100,10 +100,8 @@ int main(int argc, char *argv[])
100 } 100 }
101 101
102 /* with optional --ipvx, now it can be 1-4 arguments... */ 102 /* with optional --ipvx, now it can be 1-4 arguments... */
103 if ((argc != argvoffset + 2) && (argc != argvoffset + 4)) { 103 if (argc != argvoffset + 4) {
104 printf("Usage: %s [--ipv4|--ipv6] ip port public_key (of the DHT bootstrap node)\n", argv[0]); 104 printf("Usage: %s [--ipv4|--ipv6] ip port public_key (of the DHT bootstrap node)\n", argv[0]);
105 printf("or\n");
106 printf(" %s [--ipv4|--ipv6] Save.bak (to read Save.bak as state file)\n", argv[0]);
107 exit(0); 105 exit(0);
108 } 106 }
109 107
@@ -134,19 +132,6 @@ int main(int argc, char *argv[])
134 printf("Failed to convert \"%s\" into an IP address. Exiting...\n", argv[argvoffset + 1]); 132 printf("Failed to convert \"%s\" into an IP address. Exiting...\n", argv[argvoffset + 1]);
135 exit(1); 133 exit(1);
136 } 134 }
137 } else {
138 FILE *file = fopen(argv[argvoffset + 1], "rb");
139
140 if (file == nullptr) {
141 printf("Failed to open \"%s\" - does it exist?\n", argv[argvoffset + 1]);
142 return 1;
143 }
144
145 int read;
146 uint8_t buffer[128000];
147 read = fread(buffer, 1, 128000, file);
148 printf("Messenger loaded: %i\n", messenger_load(m, buffer, read));
149 fclose(file);
150 } 135 }
151 136
152 m_callback_friendrequest(m, print_request); 137 m_callback_friendrequest(m, print_request);