diff --git a/src/mirall/socketapi.cpp b/src/mirall/socketapi.cpp index f657cd4b79..0d2b5a0b2a 100644 --- a/src/mirall/socketapi.cpp +++ b/src/mirall/socketapi.cpp @@ -22,6 +22,7 @@ #include "mirall/theme.h" #include "mirall/syncjournalfilerecord.h" #include "mirall/syncfileitem.h" +#include "version.h" #include #include @@ -32,6 +33,11 @@ #include #include +// This is the version that is returned when the client asks for the VERSION. +// The first number should be changed if there is an incompatible change that breaks old clients. +// The second number should be changed when there are new features. +#define MIRALL_SOCKET_API_VERSION "1.0" + extern "C" { enum csync_exclude_type_e { @@ -400,4 +406,10 @@ void SocketApi::command_RETRIEVE_FILE_STATUS(const QString& argument, QTcpSocket sendMessage(socket, message); } +void SocketApi::command_VERSION(const QString&, QTcpSocket* socket) +{ + sendMessage(socket, QLatin1String(MIRALL_VERSION_STRING ":" MIRALL_SOCKET_API_VERSION)); +} + + } // namespace Mirall diff --git a/src/mirall/socketapi.h b/src/mirall/socketapi.h index cfab53ee68..bfd3d12fef 100644 --- a/src/mirall/socketapi.h +++ b/src/mirall/socketapi.h @@ -59,6 +59,8 @@ private: Q_INVOKABLE void command_RETRIEVE_FOLDER_STATUS(const QString& argument, QTcpSocket* socket); Q_INVOKABLE void command_RETRIEVE_FILE_STATUS(const QString& argument, QTcpSocket* socket); + Q_INVOKABLE void command_VERSION(const QString& argument, QTcpSocket* socket); + private: QTcpServer *_localServer; QList _listeners;