diff options
Diffstat (limited to 'testing/toxic')
-rw-r--r-- | testing/toxic/chat.c | 6 | ||||
-rw-r--r-- | testing/toxic/friendlist.c | 2 | ||||
-rw-r--r-- | testing/toxic/main.c | 8 | ||||
-rw-r--r-- | testing/toxic/prompt.c | 8 |
4 files changed, 13 insertions, 11 deletions
diff --git a/testing/toxic/chat.c b/testing/toxic/chat.c index ff7a1667..da1f9f4a 100644 --- a/testing/toxic/chat.c +++ b/testing/toxic/chat.c | |||
@@ -32,7 +32,7 @@ void execute(ToxWindow* self, ChatContext* ctx, char* cmd); | |||
32 | static void chat_onMessage(ToxWindow* self, int num, uint8_t* msg, uint16_t len) { | 32 | static void chat_onMessage(ToxWindow* self, int num, uint8_t* msg, uint16_t len) { |
33 | ChatContext* ctx = (ChatContext*) self->x; | 33 | ChatContext* ctx = (ChatContext*) self->x; |
34 | uint8_t nick[MAX_NAME_LENGTH] = {0}; | 34 | uint8_t nick[MAX_NAME_LENGTH] = {0}; |
35 | 35 | ||
36 | time_t now; | 36 | time_t now; |
37 | time(&now); | 37 | time(&now); |
38 | struct tm * timeinfo; | 38 | struct tm * timeinfo; |
@@ -58,6 +58,8 @@ static void chat_onMessage(ToxWindow* self, int num, uint8_t* msg, uint16_t len) | |||
58 | wprintw(ctx->history, "%s\n", msg); | 58 | wprintw(ctx->history, "%s\n", msg); |
59 | 59 | ||
60 | self->blink = true; | 60 | self->blink = true; |
61 | beep(); | ||
62 | flash(); | ||
61 | } | 63 | } |
62 | 64 | ||
63 | static void chat_onNickChange(ToxWindow* self, int num, uint8_t* nick, uint16_t len) { | 65 | static void chat_onNickChange(ToxWindow* self, int num, uint8_t* nick, uint16_t len) { |
@@ -161,7 +163,7 @@ void execute(ToxWindow* self, ChatContext* ctx, char* cmd) | |||
161 | return; | 163 | return; |
162 | } | 164 | } |
163 | msg++; | 165 | msg++; |
164 | m_set_userstatus((uint8_t*) msg, strlen(msg)+1); | 166 | m_set_userstatus(USERSTATUS_KIND_RETAIN, (uint8_t*) msg, strlen(msg)+1); |
165 | wprintw(ctx->history, "Status set to: %s\n", msg); | 167 | wprintw(ctx->history, "Status set to: %s\n", msg); |
166 | } | 168 | } |
167 | else if (!strncmp(cmd, "/nick ", strlen("/nick "))) { | 169 | else if (!strncmp(cmd, "/nick ", strlen("/nick "))) { |
diff --git a/testing/toxic/friendlist.c b/testing/toxic/friendlist.c index b4b619a2..05651b0e 100644 --- a/testing/toxic/friendlist.c +++ b/testing/toxic/friendlist.c | |||
@@ -116,7 +116,7 @@ static void friendlist_onDraw(ToxWindow* self) { | |||
116 | curs_set(0); | 116 | curs_set(0); |
117 | size_t i; | 117 | size_t i; |
118 | 118 | ||
119 | wclear(self->window); | 119 | werase(self->window); |
120 | 120 | ||
121 | if(num_friends == 0) { | 121 | if(num_friends == 0) { |
122 | wprintw(self->window, "Empty. Add some friends! :-)\n"); | 122 | wprintw(self->window, "Empty. Add some friends! :-)\n"); |
diff --git a/testing/toxic/main.c b/testing/toxic/main.c index 45760b1c..ee5e9f2a 100644 --- a/testing/toxic/main.c +++ b/testing/toxic/main.c | |||
@@ -69,10 +69,10 @@ void on_nickchange(int friendnumber, uint8_t* string, uint16_t length) { | |||
69 | } | 69 | } |
70 | } | 70 | } |
71 | 71 | ||
72 | void on_statuschange(int friendnumber, uint8_t* string, uint16_t length) { | 72 | void on_statuschange(int friendnumber, USERSTATUS_KIND kind, uint8_t* string, uint16_t length) { |
73 | size_t i; | 73 | size_t i; |
74 | 74 | ||
75 | wprintw(prompt->window, "\n(statuschange) %d: %s!\n", friendnumber, string); | 75 | wprintw(prompt->window, "\n(statuschange) %d: %s\n", friendnumber, string); |
76 | 76 | ||
77 | for(i=0; i<w_num; i++) { | 77 | for(i=0; i<w_num; i++) { |
78 | if(windows[i].onStatusChange != NULL) | 78 | if(windows[i].onStatusChange != NULL) |
@@ -201,7 +201,7 @@ static void load_data(char *path) { | |||
201 | 201 | ||
202 | Messenger_load(buf, len); | 202 | Messenger_load(buf, len); |
203 | } | 203 | } |
204 | else { | 204 | else { |
205 | len = Messenger_size(); | 205 | len = Messenger_size(); |
206 | buf = malloc(len); | 206 | buf = malloc(len); |
207 | 207 | ||
@@ -289,7 +289,7 @@ int main(int argc, char* argv[]) { | |||
289 | 289 | ||
290 | for(i = 0; i < argc; i++) { | 290 | for(i = 0; i < argc; i++) { |
291 | if (argv[i] == NULL){ | 291 | if (argv[i] == NULL){ |
292 | break; | 292 | break; |
293 | } else if(argv[i][0] == '-') { | 293 | } else if(argv[i][0] == '-') { |
294 | if(argv[i][1] == 'f') { | 294 | if(argv[i][1] == 'f') { |
295 | if(argv[i + 1] != NULL) | 295 | if(argv[i + 1] != NULL) |
diff --git a/testing/toxic/prompt.c b/testing/toxic/prompt.c index e5dc5086..16750c5d 100644 --- a/testing/toxic/prompt.c +++ b/testing/toxic/prompt.c | |||
@@ -91,7 +91,7 @@ static void execute(ToxWindow* self, char* cmd) { | |||
91 | dht.ip.i = resolved_address; | 91 | dht.ip.i = resolved_address; |
92 | unsigned char *binary_string = hex_string_to_bin(key); | 92 | unsigned char *binary_string = hex_string_to_bin(key); |
93 | DHT_bootstrap(dht, binary_string); | 93 | DHT_bootstrap(dht, binary_string); |
94 | free(binary_string); | 94 | free(binary_string); |
95 | } | 95 | } |
96 | else if(!strncmp(cmd, "add ", strlen("add "))) { | 96 | else if(!strncmp(cmd, "add ", strlen("add "))) { |
97 | uint8_t id_bin[32]; | 97 | uint8_t id_bin[32]; |
@@ -137,7 +137,7 @@ static void execute(ToxWindow* self, char* cmd) { | |||
137 | 137 | ||
138 | num = m_addfriend(id_bin, (uint8_t*) msg, strlen(msg)+1); | 138 | num = m_addfriend(id_bin, (uint8_t*) msg, strlen(msg)+1); |
139 | switch (num) { | 139 | switch (num) { |
140 | case -1: | 140 | case -1: |
141 | wprintw(self->window, "Message is too long.\n"); | 141 | wprintw(self->window, "Message is too long.\n"); |
142 | break; | 142 | break; |
143 | case -2: | 143 | case -2: |
@@ -151,7 +151,7 @@ static void execute(ToxWindow* self, char* cmd) { | |||
151 | break; | 151 | break; |
152 | case -5: | 152 | case -5: |
153 | wprintw(self->window, "Undefined error when adding friend.\n"); | 153 | wprintw(self->window, "Undefined error when adding friend.\n"); |
154 | break; | 154 | break; |
155 | default: | 155 | default: |
156 | wprintw(self->window, "Friend added as %d.\n", num); | 156 | wprintw(self->window, "Friend added as %d.\n", num); |
157 | on_friendadded(num); | 157 | on_friendadded(num); |
@@ -174,7 +174,7 @@ static void execute(ToxWindow* self, char* cmd) { | |||
174 | } | 174 | } |
175 | msg++; | 175 | msg++; |
176 | 176 | ||
177 | m_set_userstatus((uint8_t*) msg, strlen(msg)+1); | 177 | m_set_userstatus(USERSTATUS_KIND_RETAIN, (uint8_t*) msg, strlen(msg)+1); |
178 | wprintw(self->window, "Status set to: %s\n", msg); | 178 | wprintw(self->window, "Status set to: %s\n", msg); |
179 | } | 179 | } |
180 | else if(!strncmp(cmd, "nick ", strlen("nick "))) { | 180 | else if(!strncmp(cmd, "nick ", strlen("nick "))) { |