add tox friend faux offline message (still wonky) + small file copy error handling

This commit is contained in:
2024-02-02 20:26:50 +01:00
parent 7948d820c3
commit 0c674e0137
6 changed files with 261 additions and 3 deletions

View File

@ -96,13 +96,21 @@ const void* clipboard_callback(void* userdata, const char* mime_type, size_t* si
}
void ChatGui4::setClipboardData(std::vector<std::string> mime_types, std::shared_ptr<std::vector<uint8_t>>&& data) {
std::vector<const char*> tmp_mimetype_list;
for (const auto& mime_type : mime_types) {
tmp_mimetype_list.push_back(mime_type.data());
if (!static_cast<bool>(data)) {
std::cerr << "CG error: tried to set clipboard with empty shp\n";
return;
}
if (data->empty()) {
std::cerr << "CG error: tried to set clipboard with empty data\n";
return;
}
std::vector<const char*> tmp_mimetype_list;
std::lock_guard lg{_set_clipboard_data_mutex};
for (const auto& mime_type : mime_types) {
tmp_mimetype_list.push_back(mime_type.data());
_set_clipboard_data[mime_type] = data;
}