diff --git a/src/autocomplete.c b/src/autocomplete.c index b074771..2333fef 100644 --- a/src/autocomplete.c +++ b/src/autocomplete.c @@ -306,7 +306,7 @@ static void complete_home_dir(ToxWindow *self, char *path, int pathsize, const c * Returns the diff between old len and new len of ctx->line on success. * Returns -1 if no matches or more than one match. */ -#define MAX_DIRS 512 +#define MAX_DIRS 75 int dir_match(ToxWindow *self, Tox *m, const wchar_t *line, const wchar_t *cmd) { char b_path[MAX_STR_SIZE + 1]; diff --git a/src/curl_util.h b/src/curl_util.h index 2590308..716d3a4 100644 --- a/src/curl_util.h +++ b/src/curl_util.h @@ -27,7 +27,7 @@ #define TLS_CIPHER_SUITE_LIST "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK" /* Max size of an http response that we can store in Recv_Data */ -#define MAX_RECV_CURL_DATA_SIZE 32767 +#define MAX_RECV_CURL_DATA_SIZE 1024 /* Holds data received from curl lookup */ struct Recv_Curl_Data { diff --git a/src/global_commands.c b/src/global_commands.c index cd9b677..265a7bd 100644 --- a/src/global_commands.c +++ b/src/global_commands.c @@ -41,6 +41,7 @@ extern char *DATA_FILE; extern ToxWindow *prompt; extern FriendsList Friends; +extern FriendRequests FrndRequests; /* command functions */ void cmd_accept(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]) @@ -87,7 +88,6 @@ void cmd_accept(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[ FrndRequests.max_idx = i; --FrndRequests.num_requests; - } void cmd_add_helper(ToxWindow *self, Tox *m, const char *id_bin, const char *msg) diff --git a/src/notify.c b/src/notify.c index 543829c..5198ea2 100644 --- a/src/notify.c +++ b/src/notify.c @@ -60,7 +60,7 @@ #define MAX_BOX_MSG_LEN 127 #define SOUNDS_SIZE 10 -#define ACTIVE_NOTIFS_MAX 50 +#define ACTIVE_NOTIFS_MAX 10 extern struct user_settings *user_settings; @@ -754,20 +754,18 @@ int box_notify2(ToxWindow *self, Notification notif, uint64_t flags, int id, con actives[id].size++; actives[id].n_timeout = get_unix_time() + Control.notif_timeout / 1000; - char formated[128 * 129] = {'\0'}; + char *formatted = calloc(1, sizeof(char) * ((MAX_BOX_MSG_LEN + 1) * (MAX_BOX_MSG_LEN + 2))); - int i = 0; - - for (; i < actives[id].size; i ++) { - strcat(formated, actives[id].messages[i]); - strcat(formated, "\n"); + for (size_t i = 0; i < actives[id].size; ++i) { + strcat(formatted, actives[id].messages[i]); + strcat(formatted, "\n"); } - formated[strlen(formated) - 1] = '\0'; - - notify_notification_update(actives[id].box, actives[id].title, formated, NULL); + notify_notification_update(actives[id].box, actives[id].title, formatted, NULL); notify_notification_show(actives[id].box, NULL); + free(formatted); + control_unlock(); return id; @@ -863,20 +861,18 @@ int box_silent_notify2(ToxWindow *self, uint64_t flags, int id, const char *form actives[id].size ++; actives[id].n_timeout = get_unix_time() + Control.notif_timeout / 1000; - char formated[128 * 129] = {'\0'}; + char *formatted = calloc(1, sizeof(char) * ((MAX_BOX_MSG_LEN + 1) * (MAX_BOX_MSG_LEN + 2))); - int i = 0; - - for (; i < actives[id].size; i ++) { - strcat(formated, actives[id].messages[i]); - strcat(formated, "\n"); + for (size_t i = 0; i < actives[id].size; ++i) { + strcat(formatted, actives[id].messages[i]); + strcat(formatted, "\n"); } - formated[strlen(formated) - 1] = '\0'; - - notify_notification_update(actives[id].box, actives[id].title, formated, NULL); + notify_notification_update(actives[id].box, actives[id].title, formatted, NULL); notify_notification_show(actives[id].box, NULL); + free(formatted); + control_unlock(); return id; diff --git a/src/prompt.h b/src/prompt.h index 59b4a8e..dedf34f 100644 --- a/src/prompt.h +++ b/src/prompt.h @@ -26,22 +26,20 @@ #include "toxic.h" #include "windows.h" -#define MAX_FRIEND_REQUESTS 32 +#define MAX_FRIEND_REQUESTS 20 struct friend_request { bool active; - char msg[MAX_STR_SIZE]; + char msg[TOX_MAX_FRIEND_REQUEST_LENGTH + 1]; uint8_t key[TOX_PUBLIC_KEY_SIZE]; }; -typedef struct { +typedef struct FriendRequests { int max_idx; int num_requests; struct friend_request request[MAX_FRIEND_REQUESTS]; } FriendRequests; -extern FriendRequests FrndRequests; - ToxWindow *new_prompt(void); void prep_prompt_win(void);