received LyX will inform the client that it's listening its
messages, and 'bye' will inform that lyx is closing.
- See development/server_monitor.c for an example client.
+ See development/lyxserver/server_monitor.cpp for an example client.
Purpose: implement a client/server lib for LyX
*/
#include <config.h>
#include "Server.h"
+
+#include "DispatchResult.h"
#include "FuncRequest.h"
+#include "LyX.h"
#include "LyXAction.h"
-#include "LyXFunc.h"
#include "frontends/Application.h"
#include "support/lstrings.h"
#include "support/os.h"
-#include <boost/bind.hpp>
+#include "support/bind.h"
#ifdef _WIN32
#include <QCoreApplication>
bool LyXComm::startPipe(DWORD index)
{
pipe_[index].pending_io = false;
+ pipe_[index].overlap.Offset = 0;
+ pipe_[index].overlap.OffsetHigh = 0;
// Overlapped ConnectNamedPipe should return zero.
if (ConnectNamedPipe(pipe_[index].handle, &pipe_[index].overlap)) {
<< "\nLyXComm: Resetting connection" << endl;
ReleaseMutex(outbuf_mutex_);
closeConnection();
- if (!checkStopServer())
- openConnection();
+ openConnection();
}
}
if (!write) {
theApp()->registerSocketCallback(fd,
- boost::bind(&LyXComm::read_ready, this));
+ bind(&LyXComm::read_ready, this));
}
return fd;
server->callback(msg);
}
-Server::Server(LyXFunc * f, string const & pipes)
- : numclients_(0), func_(f), pipes_(pipes, this, &ServerCallback)
+Server::Server(string const & pipes)
+ : numclients_(0), pipes_(pipes, this, &ServerCallback)
{}
// The correct solution would be to have a
// specialized (non-gui) BufferView. But how do
// we do it now? Probably we should just let it
- // connect to the lyxfunc in the single LyXView we
+ // connect to the lyxfunc in the single GuiView we
// support currently. (Lgb)
- func_->dispatch(FuncRequest(lyxaction.lookupFunc(cmd), arg));
- string const rval = to_utf8(func_->getMessage());
+ FuncRequest const fr(lyxaction.lookupFunc(cmd), arg);
+ DispatchResult dr;
+ theApp()->dispatch(fr, dr);
+ string const rval = to_utf8(dr.message());
// all commands produce an INFO or ERROR message
// in the output pipe, even if they do not return
// anything. See chapter 4 of Customization doc.
string buf;
- if (func_->errorStat())
+ if (dr.error())
buf = "ERROR:";
else
buf = "INFO:";