mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-16 04:13:02 +01:00
kill file transfer if writing fails
This commit is contained in:
parent
57c2872b75
commit
a02bbfa643
@ -188,7 +188,12 @@ static void chat_onFileControl(ToxWindow *self, Tox *m, int num, uint8_t receive
|
|||||||
break;
|
break;
|
||||||
case TOX_FILECONTROL_KILL:
|
case TOX_FILECONTROL_KILL:
|
||||||
wprintw(ctx->history, "File transfer for '%s' failed.\n", filename);
|
wprintw(ctx->history, "File transfer for '%s' failed.\n", filename);
|
||||||
|
|
||||||
|
if (receive_send == 1)
|
||||||
friends[num].file_receiver.pending[filenum] = false;
|
friends[num].file_receiver.pending[filenum] = false;
|
||||||
|
else
|
||||||
|
close_file_sender(filenum);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case TOX_FILECONTROL_FINISHED:
|
case TOX_FILECONTROL_FINISHED:
|
||||||
wprintw(ctx->history, "File transfer for '%s' complete.\n", filename);
|
wprintw(ctx->history, "File transfer for '%s' complete.\n", filename);
|
||||||
@ -214,6 +219,7 @@ static void chat_onFileData(ToxWindow *self, Tox *m, int num, uint8_t filenum, u
|
|||||||
wattron(ctx->history, COLOR_PAIR(RED));
|
wattron(ctx->history, COLOR_PAIR(RED));
|
||||||
wprintw(ctx->history, "* Error writing to file.\n");
|
wprintw(ctx->history, "* Error writing to file.\n");
|
||||||
wattroff(ctx->history, COLOR_PAIR(RED));
|
wattroff(ctx->history, COLOR_PAIR(RED));
|
||||||
|
tox_file_send_control(m, num, 1, filenum, TOX_FILECONTROL_KILL, 0, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,6 +227,7 @@ static void chat_onFileData(ToxWindow *self, Tox *m, int num, uint8_t filenum, u
|
|||||||
wattron(ctx->history, COLOR_PAIR(RED));
|
wattron(ctx->history, COLOR_PAIR(RED));
|
||||||
wprintw(ctx->history, "* Error writing to file.\n");
|
wprintw(ctx->history, "* Error writing to file.\n");
|
||||||
wattroff(ctx->history, COLOR_PAIR(RED));
|
wattroff(ctx->history, COLOR_PAIR(RED));
|
||||||
|
tox_file_send_control(m, num, 1, filenum, TOX_FILECONTROL_KILL, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(file_to_save);
|
fclose(file_to_save);
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
extern char *DATA_FILE;
|
extern char *DATA_FILE;
|
||||||
extern int store_data(Tox *m, char *path);
|
extern int store_data(Tox *m, char *path);
|
||||||
|
|
||||||
GroupChat groupchats[MAX_GROUPCHAT_NUM];
|
static GroupChat groupchats[MAX_GROUPCHAT_NUM];
|
||||||
int num_groupchats = 0;
|
int num_groupchats = 0;
|
||||||
static int max_groupchat_index = 0;
|
static int max_groupchat_index = 0;
|
||||||
|
|
||||||
|
@ -352,7 +352,7 @@ static void load_data(Tox *m, char *path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void close_file_sender(int i)
|
void close_file_sender(int i)
|
||||||
{
|
{
|
||||||
fclose(file_senders[i].file);
|
fclose(file_senders[i].file);
|
||||||
memset(&file_senders[i], 0, sizeof(FileSender));
|
memset(&file_senders[i], 0, sizeof(FileSender));
|
||||||
|
Loading…
Reference in New Issue
Block a user