@@ -2011,11 +2011,13 @@ bool ClientSession::postProcessCopyPayload(std::vector<char>& data)
2011
2011
return true ;
2012
2012
}
2013
2013
2014
+ #if 0
2014
2015
// The content may not be json or any textual form. For example:
2015
2016
// clipboardcontent: content.application/x-openoffice-svxb;windows_formatname="SVXB (StarView Bitmap/Animation)"
2016
2017
// Do not issue this in those cases. (We should also cap the data we dump here.)
2017
2018
LOG_DBG("Missing <body> in textselectioncontent/clipboardcontent payload:\n"
2018
2019
<< [data](auto& log) { Util::dumpHex(log, data); });
2020
+ #endif
2019
2021
2020
2022
return false ;
2021
2023
}
@@ -2441,7 +2443,7 @@ bool ClientSession::handleKitToClientMessage(const std::shared_ptr<Message>& pay
2441
2443
2442
2444
// TEMP
2443
2445
std::vector<char > res;
2444
- if (FileUtil::readFile (clipFile, res, f.size ()) != f.size ())
2446
+ if (FileUtil::readFile (clipFile, res, f.size ()) != static_cast < ssize_t >( f.size () ))
2445
2447
fprintf (stderr, " broken read\n " );
2446
2448
else
2447
2449
fprintf (stderr, " good read of %ld from %s\n " , res.size (), clipFile.c_str ());
@@ -2451,11 +2453,11 @@ bool ClientSession::handleKitToClientMessage(const std::shared_ptr<Message>& pay
2451
2453
2452
2454
std::cerr << " FOO len: " << res.size () << " \n " ;
2453
2455
2454
- FileUtil::removeFile (std::string (" /tmp/cliptest" ));
2455
- std::ofstream fileStream;
2456
- fileStream.open (" /tmp/cliptest" );
2457
- fileStream.write (res.data (), res.size ());
2458
- fileStream.close ();
2456
+ // FileUtil::removeFile(std::string("/tmp/cliptest"));
2457
+ // std::ofstream fileStream;
2458
+ // fileStream.open("/tmp/cliptest");
2459
+ // fileStream.write(res.data(), res.size());
2460
+ // fileStream.close();
2459
2461
2460
2462
// final cleanup ...
2461
2463
bool removeClipFile = true ;
@@ -2492,8 +2494,17 @@ bool ClientSession::handleKitToClientMessage(const std::shared_ptr<Message>& pay
2492
2494
headers.emplace_back (" Cache-Control" , " no-cache" );
2493
2495
headers.emplace_back (" Connection" , " close" );
2494
2496
2495
- // session->asyncUpload(clipFile, std::move(headers));
2496
- session->asyncUpload (" /tmp/cliptest" , std::move (headers));
2497
+ if (removeClipFile)
2498
+ {
2499
+ fprintf (stderr, " we will want to remove %s\n " , clipFile.c_str ());
2500
+ session->setFinishedHandler ([clipFile](const std::shared_ptr<http::ServerSession>&) {
2501
+ fprintf (stderr, " FINISHED WITH %s\n " , clipFile.c_str ());
2502
+ FileUtil::removeFile (clipFile);
2503
+ });
2504
+ }
2505
+
2506
+ session->asyncUpload (clipFile, std::move (headers));
2507
+ // session->asyncUpload("/tmp/cliptest", std::move(headers));
2497
2508
socket->setHandler (std::static_pointer_cast<ProtocolHandlerInterface>(session));
2498
2509
2499
2510
LOG_INF (" Queued " << (empty?" empty" :" clipboard" ) << " response for send." );
0 commit comments