Socket api: Add a VERSION command

This commit is contained in:
Olivier Goffart 2014-08-27 12:02:47 +02:00
parent 61138b58bf
commit 253d65727b
2 changed files with 14 additions and 0 deletions

View file

@ -22,6 +22,7 @@
#include "mirall/theme.h"
#include "mirall/syncjournalfilerecord.h"
#include "mirall/syncfileitem.h"
#include "version.h"
#include <QDebug>
#include <QUrl>
@ -32,6 +33,11 @@
#include <QDir>
#include <QApplication>
// 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

View file

@ -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<QTcpSocket*> _listeners;