make tta ignore avatar transfers and sub updates

This commit is contained in:
Green Sky 2023-10-14 01:08:45 +02:00
parent 8e5525c6b4
commit 6dc4650862
No known key found for this signature in database
5 changed files with 12 additions and 4 deletions

@ -1 +1 @@
Subproject commit 738d2abe7b4d6088412e56b89f4e26aab1a8bdba Subproject commit 5ff7d1cee0c3ed22f9fe7d66021d95ad1c5a3f04

@ -1 +1 @@
Subproject commit c577a1fa3d19272d481a0ed4a5b8715524204928 Subproject commit 48fb5f0889404370006ae12b3637a77d7d4ba485

@ -1 +1 @@
Subproject commit 0e6556cd86c558c86dfde60d82891a46bf32b64f Subproject commit 0404ed84fcc31716918b90b3603c722a73e908cb

View File

@ -45,4 +45,5 @@ target_link_libraries(plugin_transfer_auto_accept PUBLIC
solanaceae_plugin solanaceae_plugin
solanaceae_util solanaceae_util
solanaceae_message3 solanaceae_message3
solanaceae_tox_messages # sad, for filekind
) )

View File

@ -1,6 +1,8 @@
#include "./transfer_auto_accept.hpp" #include "./transfer_auto_accept.hpp"
#include <solanaceae/message3/components.hpp> #include <solanaceae/message3/components.hpp>
// for comp transfer tox filekind (TODO: generalize -> content system?)
#include <solanaceae/tox_messages/components.hpp>
#include <solanaceae/util/config_model.hpp> #include <solanaceae/util/config_model.hpp>
@ -34,7 +36,7 @@ void TransferAutoAccept::iterate(void) {
// TODO: contact to entry // TODO: contact to entry
_conf.get_string("TransferAutoAccept", "save_path").value_or("tmp_save_dir") _conf.get_string("TransferAutoAccept", "save_path").value_or("tmp_save_dir")
); );
std::cout << "TAA: auto accpeted transfer\n"; std::cout << "TAA: auto accepted transfer\n";
_rmm.throwEventUpdate(it); _rmm.throwEventUpdate(it);
} }
_accept_queue.clear(); _accept_queue.clear();
@ -49,6 +51,11 @@ void TransferAutoAccept::checkMsg(Message3Handle h) {
return; return;
} }
// dont touch avatars for now
if (h.all_of<Message::Components::Transfer::FileKind>() && h.get<Message::Components::Transfer::FileKind>().kind == 1) {
return;
}
const auto& file_info = h.get<Message::Components::Transfer::FileInfo>(); const auto& file_info = h.get<Message::Components::Transfer::FileInfo>();
// TODO: contact to entry // TODO: contact to entry
if (file_info.total_size > uint64_t(_conf.get_int("TransferAutoAccept", "autoaccept_limit").value_or(1024*1024))) { if (file_info.total_size > uint64_t(_conf.get_int("TransferAutoAccept", "autoaccept_limit").value_or(1024*1024))) {