1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Disallow sendfile in e2ee chat sessions

This commit is contained in:
moppman 2020-02-14 14:58:48 +01:00 committed by Michael Vetter
parent ca3afa7e05
commit 674a8aaf7e

View File

@ -4797,6 +4797,41 @@ cmd_sendfile(ProfWin *window, const char *const command, gchar **args)
return TRUE;
}
switch (window->type) {
case WIN_MUC:
{
ProfMucWin *mucwin = (ProfMucWin*)window;
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
if (mucwin->is_omemo) { //no pgp or otr available in MUCs
cons_show_error("Uploading '%s' failed: Encrypted file uploads not yet implemented!", filename);
win_println(window, THEME_ERROR, '-', "Sending encrypted files via http_upload is not possible yet.");
free(filename);
return TRUE;
}
break;
}
case WIN_CHAT:
{
ProfChatWin *chatwin = (ProfChatWin*)window;
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
if (chatwin->pgp_send || chatwin->is_omemo || chatwin->is_otr) {
cons_show_error("Uploading '%s' failed: Encrypted file uploads not yet implemented!", filename);
win_println(window, THEME_ERROR, '-', "Sending encrypted files via http_upload is not possible yet.");
free(filename);
return TRUE;
}
break;
}
case WIN_PRIVATE:
{
break; //we don't support encryption in private muc windows anyway
}
default:
cons_show_error("Unsupported window for file transmission.");
free(filename);
return TRUE;
}
if (access(filename, R_OK) != 0) {
cons_show_error("Uploading '%s' failed: File not found!", filename);
free(filename);