1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-07-01 16:06:44 +02:00

send name instead of full path with file send request

This commit is contained in:
Jfreegman
2014-02-11 18:52:04 -05:00
parent 1f06606c5b
commit 16b8f85d95
5 changed files with 30 additions and 21 deletions

View File

@ -136,23 +136,7 @@ static void chat_onFileSendRequest(ToxWindow *self, Tox *m, int num, uint8_t fil
ChatContext *ctx = self->chatwin;
int idx = strlen(pathname) - 1;
while (idx >= 0 && pathname[idx] == '/') {
pathname[idx--] = 0;
}
/* try to get file name from path */
uint8_t *filename = strrchr(pathname, '/'); // Try unix style paths
if (filename != NULL) {
if (!strlen(++filename))
filename = pathname;
} else {
filename = strrchr(pathname, '\\'); // Try windows style paths
if (filename == NULL)
filename = pathname;
}
uint8_t *filename = get_file_name(pathname);
wprintw(ctx->history, "File transfer request for '%s' (%llu bytes).\n", filename,
(long long unsigned int)filesize);