mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 14:16:16 -04:00
Local API binary output support + qml image example
This commit is contained in:
parent
e59366d0fd
commit
db3dad3e23
2 changed files with 53 additions and 2 deletions
|
@ -105,9 +105,17 @@ readPath:
|
|||
resource_api::Request req(reqJson);
|
||||
req.mMethod = reqMeth;
|
||||
req.setPath(reqPath);
|
||||
std::string resultString = mApiServer->handleRequest(req);
|
||||
mLocalSocket->write(resultString.c_str(), resultString.length());
|
||||
|
||||
// Need this idiom because binary result may contains \0
|
||||
std::string&& resultString = mApiServer->handleRequest(req);
|
||||
QByteArray rB(resultString.data(), resultString.length());
|
||||
|
||||
// Dirty trick to support avatars answers
|
||||
if(rB.contains("\n") || !rB.startsWith("{") || !rB.endsWith("}"))
|
||||
mLocalSocket->write(rB.toBase64());
|
||||
else mLocalSocket->write(rB);
|
||||
mLocalSocket->write("\n\0");
|
||||
|
||||
mState = WAITING_PATH;
|
||||
|
||||
/* Because QLocalSocket is SOCK_STREAM some clients implementations
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue