Add callback logic for LOK_CALLBACK_EXPORT_FILE

Signed-off-by: NickWingate <nick.wingate@collabora.com>
Change-Id: I3ca6be3ff26c5f847abc64f1c38b67d131191143
This commit is contained in:
NickWingate 2022-09-22 09:30:53 +01:00 committed by Andras Timar
parent c5aadfc4d1
commit cc508630e5

View file

@ -3144,6 +3144,17 @@ void ChildSession::loKitCallback(const int type, const std::string& payload)
}
#endif
break;
case LOK_CALLBACK_EXPORT_FILE:
{
// Register download id -> URL mapping in the DocumentBroker
auto url = payload.substr(strlen("file:///tmp/"));
auto downloadId = Util::rng::getFilename(64);
std::string docBrokerMessage = "registerdownload: downloadid=" + downloadId + " url=" + url + " clientid=" + getId();
_docManager->sendFrame(docBrokerMessage.c_str(), docBrokerMessage.length());
std::string message = "downloadas: downloadid=" + downloadId + " port=" + std::to_string(ClientPortNumber) + " id=export";
sendTextFrame(message);
break;
}
default:
LOG_ERR("Unknown callback event (" << lokCallbackTypeToString(type) << "): " << payload);
}