X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=main%2Fglobal.cpp;h=3317cfdae71ea21d6baf2bfbcf8901b954c4ed24;hp=7a47771bda6269740277b3bd8e8955a31aa6490c;hb=8fc3a498f754f34b21d2a163e2a28323dae384cb;hpb=ba8f57d654b07d77cc91a2b901ad3b664a31ffcf diff --git a/main/global.cpp b/main/global.cpp index 7a47771b..3317cfda 100644 --- a/main/global.cpp +++ b/main/global.cpp @@ -21,9 +21,10 @@ #include "global.h" #include "logger.h" #include "core.h" +#include "message.h" +#include "util.h" -#include -#include +#include #include extern void messageHandler(QtMsgType type, const char *msg); @@ -31,6 +32,11 @@ extern void messageHandler(QtMsgType type, const char *msg); Global::Global() { if(global) qFatal("Trying to instantiate more than one Global object!"); qInstallMsgHandler(messageHandler); + qRegisterMetaType("Message"); + qRegisterMetaTypeStreamOperators("Message"); + qRegisterMetaType("BufferId"); + qRegisterMetaTypeStreamOperators("BufferId"); + //initIconMap(); } @@ -92,6 +98,35 @@ void Global::initIconMap() { */ } +/**************************************************************************************/ + + + +BufferId::BufferId(uint _id, QString _net, QString _buf, uint _gid) : id(_id), gid(_gid), net(_net), buf(_buf) { + + +} + +QString BufferId::buffer() { + if(isChannelName(buf)) return buf; + else return nickFromMask(buf); +} + +QDataStream &operator<<(QDataStream &out, const BufferId &bufferId) { + out << bufferId.id << bufferId.gid << bufferId.net.toUtf8() << bufferId.buf.toUtf8(); +} + +QDataStream &operator>>(QDataStream &in, BufferId &bufferId) { + QByteArray n, b; + BufferId i; + in >> bufferId.id >> bufferId.gid >> n >> b; + bufferId.net = QString::fromUtf8(n); + bufferId.buf = QString::fromUtf8(b); +} + +uint qHash(const BufferId &bid) { + return qHash(bid.id); +} /** * Retrieves an icon determined by its symbolic name. The mapping shall later @@ -108,3 +143,4 @@ void Global::initIconMap() { Global *global = 0; Global::RunMode Global::runMode; +QString Global::quasselDir;