mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 01:33:02 +01:00
fmove file send success message to chat window
This commit is contained in:
parent
371fbc87a5
commit
5f3293bfec
@ -220,6 +220,7 @@ static void chat_sendfile(ToxWindow *self, ChatContext *ctx, Tox *m, uint8_t *pa
|
|||||||
|
|
||||||
memcpy(file_senders[num_file_senders].pathname, path, path_len + 1);
|
memcpy(file_senders[num_file_senders].pathname, path, path_len + 1);
|
||||||
memcpy(file_senders[num_file_senders].friendname, friendname, strlen(friendname) + 1);
|
memcpy(file_senders[num_file_senders].friendname, friendname, strlen(friendname) + 1);
|
||||||
|
file_senders[num_file_senders].chatwin = ctx->history;
|
||||||
file_senders[num_file_senders].file = file_to_send;
|
file_senders[num_file_senders].file = file_to_send;
|
||||||
file_senders[num_file_senders].filenum = filenum;
|
file_senders[num_file_senders].filenum = filenum;
|
||||||
file_senders[num_file_senders].friendnum = friendnum;
|
file_senders[num_file_senders].friendnum = friendnum;
|
||||||
|
10
src/main.c
10
src/main.c
@ -347,7 +347,7 @@ static void load_data(Tox *m, char *path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_file_senders(Tox *m)
|
void chat_do_file_senders(Tox *m)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -367,11 +367,9 @@ void do_file_senders(Tox *m)
|
|||||||
fclose(file_senders[i].file);
|
fclose(file_senders[i].file);
|
||||||
file_senders[i].file = NULL;
|
file_senders[i].file = NULL;
|
||||||
tox_file_sendcontrol(m, file_senders[i].friendnum, 0, file_senders[i].filenum,
|
tox_file_sendcontrol(m, file_senders[i].friendnum, 0, file_senders[i].filenum,
|
||||||
3, 0, 0);
|
TOX_FILECONTROL_FINISHED, 0, 0);
|
||||||
|
|
||||||
/* TODO: move this alert to chat window */
|
wprintw(file_senders[i].chatwin, "File successfuly sent.\n");
|
||||||
wprintw(prompt->window, "File '%s' successfuly sent to %s.\n",
|
|
||||||
file_senders[i].pathname, file_senders[i].friendname);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -480,7 +478,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
do_tox(m, prompt);
|
do_tox(m, prompt);
|
||||||
do_file_senders(m);
|
chat_do_file_senders(m);
|
||||||
draw_active_window(m);
|
draw_active_window(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,11 +98,12 @@ typedef struct {
|
|||||||
/* Start file transfer code */
|
/* Start file transfer code */
|
||||||
|
|
||||||
#define NUM_FILE_SENDERS 256
|
#define NUM_FILE_SENDERS 256
|
||||||
#define MAX_FILENUMBER 100 /* fix */
|
#define MAX_FILENUMBER 100
|
||||||
#define FILE_PIECE_SIZE 1024
|
#define FILE_PIECE_SIZE 1024
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
FILE *file;
|
FILE *file;
|
||||||
|
WINDOW *chatwin;
|
||||||
uint16_t friendnum;
|
uint16_t friendnum;
|
||||||
uint8_t filenum;
|
uint8_t filenum;
|
||||||
uint8_t nextpiece[FILE_PIECE_SIZE];
|
uint8_t nextpiece[FILE_PIECE_SIZE];
|
||||||
|
Loading…
Reference in New Issue
Block a user