This switches from build-number-based versioning to a ProtocolVersion and a version
string that is merely descriptive. version.inc can be overriden by version.gen, which
is supposed to be generated by build scripts.
In addition, we now create a build date automatically.
QVariantMap clientInit;
clientInit["MsgType"] = "ClientInit";
clientInit["ClientVersion"] = Global::quasselVersion;
- clientInit["ClientDate"] = Global::quasselDate;
- clientInit["ClientBuild"] = Global::quasselBuild; // this is a minimum, since we probably won't update for every commit
+ clientInit["ClientBuild"] = 860; // FIXME legacy!
+ clientInit["ClientDate"] = Global::quasselBuildDate;
+ clientInit["ProtocolVersion"] = Global::protocolVersion;
clientInit["UseSsl"] = coreConnectionInfo["useSsl"];
#ifndef QT_NO_COMPRESS
clientInit["UseCompression"] = true;
clientInit["UseCompression"] = false;
#endif
-
SignalProxy::writeDataToDevice(socket, clientInit);
}
void ClientSyncer::clientInitAck(const QVariantMap &msg) {
// Core has accepted our version info and sent its own. Let's see if we accept it as well...
- if(msg["CoreBuild"].toUInt() < Global::coreBuildNeeded) {
+ if(msg.contains("CoreBuild") && msg["CoreBuild"].toUInt() < 732 // legacy!
+ || !msg.contains("CoreBuild") && msg["ProtocolVersion"].toUInt() < Global::clientNeedsProtocol) {
emit connectionError(tr("<b>The Quassel Core you are trying to connect to is too old!</b><br>"
- "Need at least a Core Version %1 (Build >= %2) to connect.").arg(Global::quasselVersion).arg(Global::coreBuildNeeded));
+ "Need at least core/client protocol v%1 to connect.").arg(Global::clientNeedsProtocol));
disconnectFromCore();
return;
}
qt4_wrap_cpp(MOC ${HEADERS})
+include_directories(${CMAKE_SOURCE_DIR}) # for version.inc and version.gen
+
add_library(mod_common STATIC ${SOURCES} ${MOC})
qRegisterMetaTypeStreamOperators<MsgId>("MsgId");
}
+//! This includes version.inc and possibly version.gen and sets up our version numbers.
+void Global::setupVersion() {
+
+# include "version.inc"
+# ifdef HAVE_VERSION_GEN
+# include "version.gen"
+# endif
+
+ if(quasselGeneratedVersion.isEmpty()) {
+ quasselVersion = QString("v%1 (unknown rev)").arg(quasselBaseVersion);
+ } else {
+ QStringList parts = quasselGeneratedVersion.split(':');
+ if(parts.count() < 2) parts.append("unknown rev");
+ quasselVersion = QString("v%1 (%2)").arg(parts[0], parts[1]);
+ }
+# ifdef __DATE__
+ quasselBuildDate = __DATE__;
+# endif
+
+}
+
// Static variables
QString Global::quasselVersion;
-QString Global::quasselDate;
-uint Global::quasselBuild;
-uint Global::clientBuildNeeded;
-QString Global::clientVersionNeeded;
-uint Global::coreBuildNeeded;
-QString Global::coreVersionNeeded;
+QString Global::quasselBaseVersion;
+QString Global::quasselGeneratedVersion;
+QString Global::quasselBuildDate;
+uint Global::protocolVersion;
+uint Global::clientNeedsProtocol;
+uint Global::coreNeedsProtocol;
Global::RunMode Global::runMode;
uint Global::defaultPort;
namespace Global {
extern QString quasselVersion;
- extern QString quasselDate;
- extern uint quasselBuild;
+ extern QString quasselBaseVersion;
+ extern QString quasselBuildDate;
+ extern uint protocolVersion;
- //! Minimum client build number the core needs
- extern uint clientBuildNeeded;
- extern QString clientVersionNeeded;
+ extern uint clientNeedsProtocol; //< Minimum protocol version the client needs
+ extern uint coreNeedsProtocol; //< Minimum protocol version the core needs
- //! Minimum core build number the client needs
- extern uint coreBuildNeeded;
- extern QString coreVersionNeeded;
+ extern QString quasselGeneratedVersion; //< This is possibly set in version.gen
// We need different config (QSettings) files for client and gui, since the core cannot work with GUI types
// Set these here. They're used in ClientSettings and CoreSettings.
extern bool DEBUG;
void registerMetaTypes();
+ void setupVersion();
};
#endif
// Logger logger;
Global::registerMetaTypes();
-
-#include "../../version.inc"
+ Global::setupVersion();
#if defined BUILD_CORE
Global::runMode = Global::CoreOnly;
QVariantMap state;
QVariantList activeSessions;
foreach(UserId user, instance()->sessions.keys()) activeSessions << QVariant::fromValue<UserId>(user);
- state["CoreBuild"] = Global::quasselBuild;
+ state["CoreStateVersion"] = 1;
state["ActiveSessions"] = activeSessions;
s.setCoreState(state);
}
return;
}
CoreSettings s;
- uint build = s.coreState().toMap()["CoreBuild"].toUInt();
- if(build < 362) {
+ /* We don't check, since we are at the first version since switching to Git
+ uint statever = s.coreState().toMap()["CoreStateVersion"].toUInt();
+ if(statever < 1) {
qWarning() << qPrintable(tr("Core state too old, ignoring..."));
return;
}
+ */
QVariantList activeSessions = s.coreState().toMap()["ActiveSessions"].toList();
if(activeSessions.count() > 0) {
qDebug() << "Restoring previous core state...";
// OK, so we have at least an init message format we can understand
if(msg["MsgType"] == "ClientInit") {
QVariantMap reply;
+
+ // Just version information -- check it!
+ if(msg.contains("ClientBuild") && msg["ClientBuild"].toUInt() < 732
+ || !msg.contains("ClientBuild") && msg["ProtocolVersion"].toUInt() < Global::coreNeedsProtocol) {
+ reply["MsgType"] = "ClientInitReject";
+ reply["Error"] = tr("<b>Your Quassel Client is too old!</b><br>"
+ "This core needs at least client/core protocol version %1.<br>"
+ "Please consider upgrading your client.").arg(Global::coreNeedsProtocol);
+ SignalProxy::writeDataToDevice(socket, reply);
+ qWarning() << qPrintable(tr("Client %1 too old, rejecting.").arg(socket->peerAddress().toString()));
+ socket->close(); return;
+ }
+
reply["CoreVersion"] = Global::quasselVersion;
- reply["CoreDate"] = Global::quasselDate;
- reply["CoreBuild"] = Global::quasselBuild;
+ reply["CoreDate"] = Global::quasselBuildDate;
+ reply["CoreBuild"] = 860; // FIXME legacy
+ reply["ProtocolVersion"] = Global::protocolVersion;
// TODO: Make the core info configurable
int uptime = startTime.secsTo(QDateTime::currentDateTime());
int updays = uptime / 86400; uptime %= 86400;
int uphours = uptime / 3600; uptime %= 3600;
int upmins = uptime / 60;
- reply["CoreInfo"] = tr("<b>Quassel Core Version %1 (Build ≥ %2)</b><br>"
- "Up %3d%4h%5m (since %6)").arg(Global::quasselVersion).arg(Global::quasselBuild)
+ reply["CoreInfo"] = tr("<b>Quassel Core Version %1</b><br>"
+ "Built: %2<br>"
+ "Up %3d%4h%5m (since %6)").arg(Global::quasselVersion).arg(Global::quasselBuildDate)
.arg(updays).arg(uphours,2,10,QChar('0')).arg(upmins,2,10,QChar('0')).arg(startTime.toString(Qt::TextDate));
#ifndef QT_NO_OPENSSL
#else
bool supportsCompression = false;
#endif
-
+
reply["SupportSsl"] = supportSsl;
reply["SupportsCompression"] = supportsCompression;
// switch to ssl/compression after client has been informed about our capabilities (see below)
reply["LoginEnabled"] = true;
- // Just version information -- check it!
- if(msg["ClientBuild"].toUInt() < Global::clientBuildNeeded) {
- reply["MsgType"] = "ClientInitReject";
- reply["Error"] = tr("<b>Your Quassel Client is too old!</b><br>"
- "This core needs at least client version %1 (Build >= %2).<br>"
- "Please consider upgrading your client.").arg(Global::quasselVersion).arg(Global::quasselBuild);
- SignalProxy::writeDataToDevice(socket, reply);
- qWarning() << qPrintable(tr("Client %1 too old, rejecting.").arg(socket->peerAddress().toString()));
- socket->close(); return;
- }
// check if we are configured, start wizard otherwise
if(!configured) {
reply["Configured"] = false;
void CtcpHandler::handleVersion(CtcpType ctcptype, const QString &prefix, const QString &target, const QString ¶m) {
Q_UNUSED(target)
if(ctcptype == CtcpQuery) {
- reply(nickFromMask(prefix), "VERSION", QString("Quassel IRC (v%1 build >= %2) -- http://www.quassel-irc.org")
- .arg(Global::quasselVersion).arg(Global::quasselBuild));
+ reply(nickFromMask(prefix), "VERSION", QString("Quassel IRC %1, built: %2 -- http://www.quassel-irc.org")
+ .arg(Global::quasselVersion).arg(Global::quasselBuildDate));
emit displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("Received CTCP VERSION request by %1").arg(prefix));
} else {
// display Version answer
AboutDlg::AboutDlg(QWidget *parent) : QDialog(parent) {
ui.setupUi(this);
- ui.versionLabel->setText(QString("<b>Version %1, Build ≥ %2 (%3)</b>").arg(Global::quasselVersion).arg(Global::quasselBuild).arg(Global::quasselDate));
+ ui.versionLabel->setText(QString("<b>Version %1, built %2</b>").arg(Global::quasselVersion).arg(Global::quasselBuildDate));
ui.aboutTextBrowser->setHtml(about());
ui.authorTextBrowser->setHtml(authors());
ui.contributorTextBrowser->setHtml(contributors());
// Versioning, should be kept current :)
// This is included in main.cpp
-{ using namespace Global;
+//! This is the fallback version number in case we can't autogenerate one
+quasselBaseVersion = "0.3.0-pre";
+protocolVersion = 1; //< Version of the client/core protocol
- quasselVersion = "0.3.0-pre";
- quasselDate = "2008-06-04";
- quasselBuild = 869;
-
- //! Minimum client build number the core needs
- clientBuildNeeded = 731;
- clientVersionNeeded = quasselVersion;
-
- //! Minimum core build number the client needs
- coreBuildNeeded = 731;
- coreVersionNeeded = quasselVersion;
-
-}
+coreNeedsProtocol = 1; //< Minimum protocol version the core needs
+clientNeedsProtocol = 1; //< Minimum protocol version the client needs