getVersion() for DBus/ICE

git-svn-id: https://mumble.svn.sourceforge.net/svnroot/mumble/trunk@1302 05730e5d-ab1b-0410-a4ac-84af385074fa
This commit is contained in:
Thorvald Natvig 2008-09-10 14:59:20 +00:00
parent 5b0322d116
commit f34ca68cf2
9 changed files with 34 additions and 0 deletions

View File

@ -3,6 +3,7 @@ include(../compiler.pri)
VERSION = 1.1.6
DIST = mumble.pro murmur.pro mumble.pri mumble.ico Message.h mumble_plugin.h PacketDataStream.h CryptState.h Timer.h Version.h
CONFIG += qt thread debug_and_release warn_on
DEFINES *= MUMBLE_VERSION_STRING=$$VERSION
INCLUDEPATH += $$PWD

View File

@ -1108,3 +1108,7 @@ void MetaDBus::quit() {
qWarning("Quit requested from D-Bus");
QCoreApplication::instance()->quit();
}
void MetaDBus::getVersion(int &major, int &minor, int &patch, QString &text) {
Meta::getVersion(major, minor, patch, text);
}

View File

@ -245,6 +245,7 @@ class MetaDBus : public QDBusAbstractAdaptor {
void setSuperUserPassword(int server_id, const QString &pw, const QDBusMessage &);
void rotateLogs(const QDBusMessage &);
void getLog(int server_id, int min_offset, int max_offset, const QDBusMessage &, QList<LogEntry> &entries);
void getVersion(int &major, int &minor, int &patch, QString &string);
void quit();
signals:
void started(int server_id);

View File

@ -96,6 +96,7 @@ class Meta : public QObject {
bool banCheck(const QHostAddress &);
void kill(int);
void killAll();
static void getVersion(int &major, int &minor, int &patch, QString &string);
};
extern Meta *meta;

View File

@ -149,5 +149,6 @@ module Murmur
idempotent ServerList getBootedServers();
idempotent ServerList getAllServers();
idempotent ConfigMap getDefaultConf();
idempotent void getVersion(out int major, out int minor, out int patch, out string text);
};
};

View File

@ -175,6 +175,9 @@ class MetaI : virtual public Meta {
virtual void getDefaultConf_async(const ::Murmur::AMD_Meta_getDefaultConfPtr&,
const Ice::Current&);
virtual void getVersion_async(const ::Murmur::AMD_Meta_getVersionPtr&,
const Ice::Current&);
};
}

View File

@ -778,4 +778,11 @@ static void impl_Meta_getBootedServers(const ::Murmur::AMD_Meta_getBootedServers
cb->ice_response(sl);
}
static void impl_Meta_getVersion(const ::Murmur::AMD_Meta_getVersionPtr cb, const Ice::ObjectAdapterPtr) {
int major, minor, patch;
QString txt;
::Meta::getVersion(major, minor, patch, txt);
cb->ice_response(major, minor, patch, toStdUtf8String(txt));
}
#include "MurmurIceWrapper.cpp"

View File

@ -162,3 +162,7 @@ void ::Murmur::MetaI::getDefaultConf_async(const ::Murmur::AMD_Meta_getDefaultCo
IceEvent *ie = new IceEvent(boost::bind(&impl_Meta_getDefaultConf, cb, current.adapter));
QCoreApplication::instance()->postEvent(mi, ie);
};
void ::Murmur::MetaI::getVersion_async(const ::Murmur::AMD_Meta_getVersionPtr &cb, const ::Ice::Current &current) {
IceEvent *ie = new IceEvent(boost::bind(&impl_Meta_getVersion, cb, current.adapter));
QCoreApplication::instance()->postEvent(mi, ie);
};

View File

@ -29,6 +29,7 @@
*/
#include "Server.h"
#include "Version.h"
void Server::setPlayerState(Player *pPlayer, Channel *cChannel, bool mute, bool deaf, bool suppressed) {
bool changed = false;
@ -184,3 +185,14 @@ void Server::sendTextMessage(Channel *cChannel, User *pPlayer, bool tree, const
}
}
}
void Meta::getVersion(int &major, int &minor, int &patch, QString &string) {
string = QLatin1String(MUMBLE_RELEASE);
major = minor = patch = 0;
QRegExp rx(QLatin1String("(\\d+)\\.(\\d+)\\.(\\d+)"));
if (rx.exactMatch(QLatin1String(MUMTEXT(MUMBLE_VERSION_STRING)))) {
major = rx.cap(1).toInt();
minor = rx.cap(2).toInt();
patch = rx.cap(3).toInt();
}
}