1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-12-23 15:53:26 +01:00

alert chat window on file send/failure

This commit is contained in:
Jfreegman 2013-11-19 16:00:24 -05:00
parent f43d735861
commit d8da80914d
3 changed files with 16 additions and 4 deletions

View File

@ -166,7 +166,7 @@ void cmd_sendfile(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv
if (!file_senders[i].active) {
memcpy(file_senders[i].pathname, path, path_len + 1);
file_senders[i].active = true;
file_senders[i].chatwin = window;
file_senders[i].toxwin = self;
file_senders[i].file = file_to_send;
file_senders[i].filenum = (uint8_t) filenum;
file_senders[i].friendnum = self->num;

View File

@ -379,7 +379,13 @@ static void do_file_senders(Tox *m)
/* If file transfer has timed out kill transfer and send kill control */
if (timed_out(file_senders[i].timestamp, current_time, TIMEOUT_FILESENDER)) {
wprintw(file_senders[i].chatwin, "File transfer for '%s' timed out.\n", pathname);
ChatContext *ctx = (ChatContext *) file_senders[i].toxwin->chatwin;
if (ctx != NULL) {
wprintw(ctx->history, "File transfer for '%s' timed out.\n", pathname);
alert_window(file_senders[i].toxwin);
}
tox_file_sendcontrol(m, friendnum, 0, filenum, TOX_FILECONTROL_KILL, 0, 0);
close_file_sender(i);
continue;
@ -397,7 +403,13 @@ static void do_file_senders(Tox *m)
tox_filedata_size(m, friendnum), fp);
if (file_senders[i].piecelen == 0) {
wprintw(file_senders[i].chatwin, "File '%s' successfuly sent.\n", pathname);
ChatContext *ctx = (ChatContext *) file_senders[i].toxwin->chatwin;
if (ctx != NULL) {
wprintw(ctx->history, "File '%s' successfuly sent.\n", pathname);
alert_window(file_senders[i].toxwin);
}
tox_file_sendcontrol(m, friendnum, 0, filenum, TOX_FILECONTROL_FINISHED, 0, 0);
close_file_sender(i);
break;

View File

@ -107,7 +107,7 @@ typedef struct {
typedef struct {
FILE *file;
WINDOW *chatwin;
ToxWindow *toxwin;
int friendnum;
bool active;
uint8_t filenum;