]> git.lyx.org Git - lyx.git/blobdiff - src/ServerSocket.cpp
Set "dryrun" to true for XHTML copying routine. This suppresses
[lyx.git] / src / ServerSocket.cpp
index e36b071e3484630d764722380d32dc80afacea90..3d73a67ed6d955c08318323357856f5ec10aa8f9 100644 (file)
@@ -28,7 +28,7 @@
 #include "support/FileName.h"
 #include "support/socktools.h"
 
-#include <boost/bind.hpp>
+#include "support/bind.h"
 
 #include <cerrno>
 #include <ostream>
@@ -40,7 +40,6 @@
 using namespace std;
 using namespace lyx::support;
 
-using boost::shared_ptr;
 
 namespace lyx {
 
@@ -64,7 +63,7 @@ ServerSocket::ServerSocket(FileName const & addr)
 
        theApp()->registerSocketCallback(
                fd_,
-               boost::bind(&ServerSocket::serverCallback, this)
+               bind(&ServerSocket::serverCallback, this)
                );
 
        LYXERR(Debug::LYXSERVER, "lyx: New server socket "
@@ -115,7 +114,7 @@ void ServerSocket::serverCallback()
                shared_ptr<LyXDataSocket>(new LyXDataSocket(client_fd));
        theApp()->registerSocketCallback(
                client_fd,
-               boost::bind(&ServerSocket::dataCallback,
+               bind(&ServerSocket::dataCallback,
                            this, client_fd)
                );
 }
@@ -125,8 +124,10 @@ void ServerSocket::serverCallback()
 // if the connection has been closed
 void ServerSocket::dataCallback(int fd)
 {
-       shared_ptr<LyXDataSocket> client = clients[fd];
-
+       map<int, shared_ptr<LyXDataSocket> >::const_iterator it = clients.find(fd);
+       if (it == clients.end())
+               return;
+       shared_ptr<LyXDataSocket> client = it->second;
        string line;
        size_t pos;
        bool saidbye = false;
@@ -141,8 +142,10 @@ void ServerSocket::dataCallback(int fd)
                string const key = line.substr(0, pos);
                if (key == "LYXCMD") {
                        string const cmd = line.substr(pos + 1);
+                       FuncRequest fr(lyxaction.lookupFunc(cmd));
+                       fr.setOrigin(FuncRequest::LYXSERVER);
                        DispatchResult dr;
-                       theApp()->dispatch(lyxaction.lookupFunc(cmd), dr);
+                       theApp()->dispatch(fr, dr);
                        string const rval = to_utf8(dr.message());
                        if (dr.error())
                                client->writeln("ERROR:" + cmd + ':' + rval);