#include "DispatchResult.h"
#include "FuncRequest.h"
+#include "LyX.h"
#include "LyXAction.h"
-#include "LyXFunc.h"
#include "frontends/Application.h"
#include "support/FileName.h"
#include "support/socktools.h"
-#include <boost/bind.hpp>
+#include "support/bind.h"
#include <cerrno>
#include <ostream>
using namespace std;
using namespace lyx::support;
-using boost::shared_ptr;
+
namespace lyx {
// Address is the unix address for the socket.
// MAX_CLIENTS is the maximum number of clients
// that can connect at the same time.
-ServerSocket::ServerSocket(LyXFunc * f, FileName const & addr)
- : func(f),
- fd_(socktools::listen(addr, 3)),
+ServerSocket::ServerSocket(FileName const & addr)
+ : fd_(socktools::listen(addr, 3)),
address_(addr)
{
if (fd_ == -1) {
// Needed by xdvi
setEnv("XEDITOR", "lyxclient -g %f %l");
// Needed by lyxclient
- setEnv("LYXSOCKET", address_.absFilename());
+ setEnv("LYXSOCKET", address_.absFileName());
theApp()->registerSocketCallback(
fd_,
- boost::bind(&ServerSocket::serverCallback, this)
+ bind(&ServerSocket::serverCallback, this)
);
LYXERR(Debug::LYXSERVER, "lyx: New server socket "
- << fd_ << ' ' << address_.absFilename());
+ << fd_ << ' ' << address_.absFileName());
}
string const ServerSocket::address() const
{
- return address_.absFilename();
+ return address_.absFileName();
}
shared_ptr<LyXDataSocket>(new LyXDataSocket(client_fd));
theApp()->registerSocketCallback(
client_fd,
- boost::bind(&ServerSocket::dataCallback,
+ bind(&ServerSocket::dataCallback,
this, client_fd)
);
}
if (key == "LYXCMD") {
string const cmd = line.substr(pos + 1);
DispatchResult dr;
- func->dispatch(lyxaction.lookupFunc(cmd), dr);
+ theApp()->dispatch(lyxaction.lookupFunc(cmd), dr);
+ theApp()->dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
string const rval = to_utf8(dr.message());
if (dr.error())
client->writeln("ERROR:" + cmd + ':' + rval);
// void ServerSocket::dump() const
// {
// lyxerr << "ServerSocket debug dump.\n"
-// << "fd = " << fd_ << ", address = " << address_.absFilename() << ".\n"
+// << "fd = " << fd_ << ", address = " << address_.absFileName() << ".\n"
// << "Clients: " << clients.size() << ".\n";
// map<int, shared_ptr<LyXDataSocket> >::const_iterator client = clients.begin();
// map<int, shared_ptr<LyXDataSocket> >::const_iterator end = clients.end();