]> git.lyx.org Git - lyx.git/blobdiff - src/ServerSocket.cpp
Get rid of all-insets-toggle and explain how to replace it with inset-forall.
[lyx.git] / src / ServerSocket.cpp
index f3fb5cab3fbdeb5a9981cc04f5368b0c6859bf89..6d3368a517b1c44a2811f94812fa81fb04d8a8b2 100644 (file)
 
 #include "ServerSocket.h"
 
+#include "DispatchResult.h"
 #include "FuncRequest.h"
+#include "LyX.h"
 #include "LyXAction.h"
-#include "LyXFunc.h"
 
 #include "frontends/Application.h"
 
 #endif
 
 using namespace std;
-using namespace std::tr1;
 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) {
@@ -140,13 +141,13 @@ void ServerSocket::dataCallback(int fd)
                string const key = line.substr(0, pos);
                if (key == "LYXCMD") {
                        string const cmd = line.substr(pos + 1);
-                       func->dispatch(lyxaction.lookupFunc(cmd));
-                       string const rval = to_utf8(func->getMessage());
-                       if (func->errorStat()) {
+                       DispatchResult dr;
+                       theApp()->dispatch(lyxaction.lookupFunc(cmd), dr);
+                       string const rval = to_utf8(dr.message());
+                       if (dr.error())
                                client->writeln("ERROR:" + cmd + ':' + rval);
-                       } else {
+                       else
                                client->writeln("INFO:" + cmd + ':' + rval);
-                       }
                } else if (key == "HELLO") {
                        // no use for client name!
                        client->writeln("HELLO:");