summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/Messenger.c6
-rw-r--r--testing/toxic/main.c13
2 files changed, 9 insertions, 10 deletions
diff --git a/core/Messenger.c b/core/Messenger.c
index 5532c9cc..4e994a15 100644
--- a/core/Messenger.c
+++ b/core/Messenger.c
@@ -116,8 +116,8 @@ int m_addfriend(uint8_t *client_id, uint8_t *data, uint16_t length)
116 return FAERR_ALREADYSENT; 116 return FAERR_ALREADYSENT;
117 117
118 uint32_t i; 118 uint32_t i;
119 for (i = 0; i < numfriends && i < MAX_NUM_FRIENDS; ++i) { /*TODO: dynamic memory allocation to allow for more than MAX_NUM_FRIENDS friends */ 119 for (i = 0; i <= numfriends && i <= MAX_NUM_FRIENDS; ++i) { /*TODO: dynamic memory allocation to allow for more than MAX_NUM_FRIENDS friends */
120 if(friendlist[i].status == NOFRIEND) { 120 if (friendlist[i].status == NOFRIEND) {
121 DHT_addfriend(client_id); 121 DHT_addfriend(client_id);
122 friendlist[i].status = FRIEND_ADDED; 122 friendlist[i].status = FRIEND_ADDED;
123 friendlist[i].crypt_connection_id = -1; 123 friendlist[i].crypt_connection_id = -1;
@@ -141,7 +141,7 @@ int m_addfriend_norequest(uint8_t * client_id)
141 if (getfriend_id(client_id) != -1) 141 if (getfriend_id(client_id) != -1)
142 return -1; 142 return -1;
143 uint32_t i; 143 uint32_t i;
144 for (i = 0; i < numfriends && i < MAX_NUM_FRIENDS; ++i) { /*TODO: dynamic memory allocation to allow for more than MAX_NUM_FRIENDS friends */ 144 for (i = 0; i <= numfriends && i <= MAX_NUM_FRIENDS; ++i) { /*TODO: dynamic memory allocation to allow for more than MAX_NUM_FRIENDS friends */
145 if(friendlist[i].status == NOFRIEND) { 145 if(friendlist[i].status == NOFRIEND) {
146 DHT_addfriend(client_id); 146 DHT_addfriend(client_id);
147 friendlist[i].status = FRIEND_REQUESTED; 147 friendlist[i].status = FRIEND_REQUESTED;
diff --git a/testing/toxic/main.c b/testing/toxic/main.c
index 1ba8b6c9..8de76244 100644
--- a/testing/toxic/main.c
+++ b/testing/toxic/main.c
@@ -249,6 +249,7 @@ static void load_data(char *path)
249static void draw_bar() 249static void draw_bar()
250{ 250{
251 static int odd = 0; 251 static int odd = 0;
252 int blinkrate = 30;
252 253
253 attron(COLOR_PAIR(4)); 254 attron(COLOR_PAIR(4));
254 mvhline(LINES - 2, 0, '_', COLS); 255 mvhline(LINES - 2, 0, '_', COLS);
@@ -266,14 +267,13 @@ static void draw_bar()
266 if (i == active_window) 267 if (i == active_window)
267 attron(A_BOLD); 268 attron(A_BOLD);
268 269
269 odd = (odd+1) % 10; 270 odd = (odd+1) % blinkrate;
270 if (windows[i].blink && (odd < 5)) { 271 if (windows[i].blink && (odd < (blinkrate/2))) {
271 attron(COLOR_PAIR(3)); 272 attron(COLOR_PAIR(3));
272 } 273 }
273
274 printw(" %s", windows[i].title); 274 printw(" %s", windows[i].title);
275 if (windows[i].blink && (odd < 5)) { 275 if (windows[i].blink && (odd < (blinkrate/2))) {
276 attron(COLOR_PAIR(3)); 276 attroff(COLOR_PAIR(3));
277 } 277 }
278 if (i == active_window) { 278 if (i == active_window) {
279 attroff(A_BOLD); 279 attroff(A_BOLD);
@@ -375,9 +375,8 @@ int main(int argc, char *argv[])
375 ch = getch(); 375 ch = getch();
376 if (ch == '\t' || ch == KEY_BTAB) 376 if (ch == '\t' || ch == KEY_BTAB)
377 set_active_window(ch); 377 set_active_window(ch);
378 else if (ch != ERR) { 378 else if (ch != ERR)
379 a->onKey(a, ch); 379 a->onKey(a, ch);
380 }
381 } 380 }
382 return 0; 381 return 0;
383} 382}