summaryrefslogtreecommitdiffstats
path: root/kit
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2019-05-29 16:26:16 +0100
committerMichael Meeks <michael.meeks@collabora.com>2019-08-05 15:47:47 -0400
commit52e477e57eb7c6df8bbc085b603fdb25b314d63d (patch)
tree0a571705d90f6ad736a49f619159c5d453872d6f /kit
parentfakesockettest: respect CPPUNIT_TEST_NAME (diff)
downloadonline-52e477e57eb7c6df8bbc085b603fdb25b314d63d.tar.gz
online-52e477e57eb7c6df8bbc085b603fdb25b314d63d.zip
Switch to text/html for paste where we can.
Build special URLs to detect the same host being in-use, and much more. Change-Id: I0ca639ea416cb78bf5e5274eac4400542b6b2cda
Diffstat (limited to 'kit')
-rw-r--r--kit/ChildSession.cpp12
-rw-r--r--kit/ChildSession.hpp18
2 files changed, 26 insertions, 4 deletions
diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index 01853e94b6..ab9f83ef51 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -922,12 +922,22 @@ bool ChildSession::paste(const char* buffer, int length, const std::vector<std::
const std::string firstLine = getFirstLine(buffer, length);
const char* data = buffer + firstLine.size() + 1;
const int size = length - firstLine.size() - 1;
+ bool success = false;
+ std::string result = "pasteresult: ";
if (size > 0)
{
getLOKitDocument()->setView(_viewId);
- getLOKitDocument()->paste(mimeType.c_str(), data, size);
+ LOG_TRC("Paste data of size " << size << " bytes and hash " << SpookyHash::Hash64(data, size, 0));
+ success = getLOKitDocument()->paste(mimeType.c_str(), data, size);
+ if (!success)
+ LOG_WRN("Paste failed " << getLOKitLastError());
}
+ if (success)
+ result += "success";
+ else
+ result += "fallback";
+ sendTextFrame(result);
return true;
}
diff --git a/kit/ChildSession.hpp b/kit/ChildSession.hpp
index bb6a3d7207..737b7d8e6b 100644
--- a/kit/ChildSession.hpp
+++ b/kit/ChildSession.hpp
@@ -53,12 +53,12 @@ public:
/// if it is the last and only.
virtual void onUnload(const ChildSession& session) = 0;
+ /// Access to the Kit instance.
+ virtual std::shared_ptr<lok::Office> getLOKit() = 0;
+
/// Access to the document instance.
virtual std::shared_ptr<lok::Document> getLOKitDocument() = 0;
- /// Access to the office instance.
- virtual std::shared_ptr<lok::Office> getLOKit() = 0;
-
/// Send updated view info to all active sessions.
virtual void notifyViewInfo() = 0;
virtual void updateEditorSpeeds(int id, int speed) = 0;
@@ -278,6 +278,18 @@ private:
return _docManager.getLOKitDocument();
}
+ std::string getLOKitLastError()
+ {
+ char *lastErr = _docManager.getLOKit()->getError();
+ std::string ret;
+ if (lastErr)
+ {
+ ret = std::string(lastErr, strlen(lastErr));
+ free (lastErr);
+ }
+ return ret;
+ }
+
private:
const std::string _jailId;
DocumentManagerInterface& _docManager;