diff --git a/src/chat.c b/src/chat.c index 827047b..d0debad 100644 --- a/src/chat.c +++ b/src/chat.c @@ -99,15 +99,16 @@ static void chat_onStatusMessageChange(ToxWindow *self, int num, uint8_t *status memcpy(statusbar->statusmsg, status, len); } -static void chat_onFileSendRequest(ToxWindow *self, Tox *m, int num, uint8_t filenum, uint64_t filesize, - uint8_t *filename, uint16_t filename_len) +static void chat_onFileSendRequest(ToxWindow *self, Tox *m, int num, uint8_t filenum, + uint64_t filesize, uint8_t *filename, uint16_t filename_len) { if (self-> num != num) return; ChatContext *ctx = (ChatContext *) self->chatwin; - wprintw(ctx->history, "File transfer request for '%s' of size %llu.\n", filename, (long long unsigned int)filesize); + wprintw(ctx->history, "File transfer request for '%s' of size %llu.\n", filename, + (long long unsigned int)filesize); if (filenum > MAX_FILENUMBER) { wprintw(ctx->history, "Too many pending file requests; discarding.\n"); @@ -123,8 +124,8 @@ static void chat_onFileSendRequest(ToxWindow *self, Tox *m, int num, uint8_t fil } -static void chat_onFileControl(ToxWindow *self, Tox *m, int num, uint8_t receive_send, uint8_t filenum, - uint8_t control_type, uint8_t *data, uint16_t length) +static void chat_onFileControl(ToxWindow *self, Tox *m, int num, uint8_t receive_send, + uint8_t filenum, uint8_t control_type, uint8_t *data, uint16_t length) { if (self->num != num) return; @@ -147,7 +148,8 @@ static void chat_onFileControl(ToxWindow *self, Tox *m, int num, uint8_t receive beep(); } -static void chat_onFileData(ToxWindow *self, Tox *m, int num, uint8_t filenum, uint8_t *data, uint16_t length) +static void chat_onFileData(ToxWindow *self, Tox *m, int num, uint8_t filenum, uint8_t *data, + uint16_t length) { if (self->num != num) return; diff --git a/src/commands.c b/src/commands.c index 400d541..bce5095 100644 --- a/src/commands.c +++ b/src/commands.c @@ -197,7 +197,8 @@ void cmd_file(WINDOW *window, ToxWindow *prompt, Tox *m, int argc, char **argv) int friendnum = pending_file_transfers[filenum]; if (tox_file_sendcontrol(m, friendnum, 1, filenum, 0, 0, 0)) - wprintw(window, "Accepted file transfer %u. Saving file as %d.%u.bin.\n", filenum, friendnum, filenum); + wprintw(window, "Accepted file transfer %u. Saving file as %d.%u.bin.\n", filenum, friendnum, + filenum); else wprintw(window, "File transfer failed.\n"); } diff --git a/src/groupchat.c b/src/groupchat.c index a53ce25..db11c15 100644 --- a/src/groupchat.c +++ b/src/groupchat.c @@ -94,7 +94,8 @@ static void print_groupchat_help(ChatContext *ctx) wattroff(ctx->history, COLOR_PAIR(CYAN)); } -static void groupchat_onGroupMessage(ToxWindow *self, Tox *m, int groupnum, int peernum, uint8_t *msg, uint16_t len) +static void groupchat_onGroupMessage(ToxWindow *self, Tox *m, int groupnum, int peernum, + uint8_t *msg, uint16_t len) { if (self->num != groupnum) return; diff --git a/src/main.c b/src/main.c index 2c0ec8f..550ccf7 100644 --- a/src/main.c +++ b/src/main.c @@ -360,17 +360,18 @@ void do_file_senders(Tox *m) file_senders[i].nextpiece, file_senders[i].piecelen)) return; - file_senders[i].piecelen = fread(file_senders[i].nextpiece, 1, tox_filedata_size(m, file_senders[i].friendnum), - file_senders[i].file); + file_senders[i].piecelen = fread(file_senders[i].nextpiece, 1, tox_filedata_size(m, + file_senders[i].friendnum), file_senders[i].file); if (file_senders[i].piecelen == 0) { fclose(file_senders[i].file); file_senders[i].file = NULL; - tox_file_sendcontrol(m, file_senders[i].friendnum, 0, file_senders[i].filenum, 3, 0, 0); + tox_file_sendcontrol(m, file_senders[i].friendnum, 0, file_senders[i].filenum, + 3, 0, 0); /* TODO: move this alert to chat window */ - wprintw(prompt->window, "File '%s' successfuly sent to %s.\n", file_senders[i].filename, - file_senders[i].friendname); + wprintw(prompt->window, "File '%s' successfuly sent to %s.\n", + file_senders[i].filename, file_senders[i].friendname); return; } } diff --git a/src/misc_tools.c b/src/misc_tools.c index 925ff50..c521be8 100644 --- a/src/misc_tools.c +++ b/src/misc_tools.c @@ -40,6 +40,16 @@ struct tm *get_time(void) return timeinfo; } +/* Prints the time to given window */ +void print_time(WINDOW *window) +{ + struct tm *timeinfo = get_time(); + + wattron(window, COLOR_PAIR(CYAN)); + wprintw(window, "[%02d:%02d:%02d] ", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); + wattroff(window, COLOR_PAIR(CYAN)); +} + /* check that the string has one non-space character */ int string_is_empty(char *string) { @@ -95,13 +105,3 @@ char *wc_to_char(wchar_t ch) return ret; } - -/* Prints the time to given window */ -void print_time(WINDOW *window) -{ - struct tm *timeinfo = get_time(); - - wattron(window, COLOR_PAIR(CYAN)); - wprintw(window, "[%02d:%02d:%02d] ", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); - wattroff(window, COLOR_PAIR(CYAN)); -} \ No newline at end of file diff --git a/src/misc_tools.h b/src/misc_tools.h index 6256beb..7a99142 100644 --- a/src/misc_tools.h +++ b/src/misc_tools.h @@ -8,6 +8,9 @@ unsigned char *hex_string_to_bin(char hex_string[]); /* get the current local time */ struct tm *get_time(void); +/* Prints the time to given window */ +void print_time(WINDOW *window); + /* check that the string has one non-space character */ int string_is_empty(char *string); @@ -16,6 +19,3 @@ uint8_t *wcs_to_char(wchar_t *string); /* convert a wide char to null terminated string */ char *wc_to_char(wchar_t ch); - -/* Prints the time to window w */ -void print_time(WINDOW *window); diff --git a/src/windows.c b/src/windows.c index 736dd86..2f24bdc 100644 --- a/src/windows.c +++ b/src/windows.c @@ -118,7 +118,8 @@ void on_friendadded(Tox *m, int friendnumber) wprintw(prompt->window, "\nCould not store Tox data\n"); } -void on_groupmessage(Tox *m, int groupnumber, int peernumber, uint8_t *message, uint16_t length, void *userdata) +void on_groupmessage(Tox *m, int groupnumber, int peernumber, uint8_t *message, uint16_t length, + void *userdata) { int i; @@ -162,7 +163,8 @@ void on_file_control (Tox *m, int friendnumber, uint8_t receive_send, uint8_t fi } } -void on_file_data(Tox *m, int friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length, void *userdata) +void on_file_data(Tox *m, int friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length, + void *userdata) { int i;