From 031bf2bce54decc0123804f62f512db66cbaad70 Mon Sep 17 00:00:00 2001 From: Thorvald Natvig Date: Fri, 24 Apr 2009 14:11:07 +0200 Subject: [PATCH] Export channel description over Ice --- src/murmur/Murmur.ice | 2 ++ src/murmur/MurmurIce.cpp | 4 +++- src/murmur/RPC.cpp | 9 ++++++++- src/murmur/Server.h | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/murmur/Murmur.ice b/src/murmur/Murmur.ice index 1897bd1df..04fa62d2c 100644 --- a/src/murmur/Murmur.ice +++ b/src/murmur/Murmur.ice @@ -62,6 +62,8 @@ module Murmur int parent; /** List of id of linked channels. */ IntList links; + /** Description of channel. Shown as tooltip for this channel. */ + string description; }; /** A group. Groups are defined per channel, and can inherit members from parent channels. diff --git a/src/murmur/MurmurIce.cpp b/src/murmur/MurmurIce.cpp index d4751c550..a92120334 100644 --- a/src/murmur/MurmurIce.cpp +++ b/src/murmur/MurmurIce.cpp @@ -100,6 +100,8 @@ static void channelToChannel(const ::Channel *c, Murmur::Channel &mc) { mc.name = u8(c->qsName); mc.parent = c->cParent ? c->cParent->iId : -1; mc.links.clear(); + if (! c->qsDesc.isEmpty()) + mc.description = u8(c->qsDesc); foreach(::Channel *chn, c->qsPermLinks) mc.links.push_back(chn->iId); } @@ -964,7 +966,7 @@ static void impl_Server_setChannelState(const ::Murmur::AMD_Server_setChannelSta newset << cLink; } - if (! server->setChannelState(channel, np, qsName, newset)) + if (! server->setChannelState(channel, np, qsName, newset, u8(state.description))) cb->ice_exception(::Murmur::InvalidChannelException()); else cb->ice_response(); diff --git a/src/murmur/RPC.cpp b/src/murmur/RPC.cpp index 5f1fc4d6e..10f7df30a 100644 --- a/src/murmur/RPC.cpp +++ b/src/murmur/RPC.cpp @@ -83,7 +83,7 @@ void Server::setPlayerState(Player *pPlayer, Channel *cChannel, bool mute, bool } } -bool Server::setChannelState(Channel *cChannel, Channel *cParent, const QString &qsName, const QSet &links) { +bool Server::setChannelState(Channel *cChannel, Channel *cParent, const QString &qsName, const QSet &links, const QString &desc) { bool changed = false; bool updated = false; @@ -135,6 +135,13 @@ bool Server::setChannelState(Channel *cChannel, Channel *cParent, const QString changed = true; } + + if (! desc.isNull() && desc != cChannel->qsDesc) { + updated = true; + changed = true; + cChannel->qsDesc = desc; + mpcs.set_description(u8(desc)); + } if (updated) updateChannel(cChannel); diff --git a/src/murmur/Server.h b/src/murmur/Server.h index 654079730..3ce6081c5 100644 --- a/src/murmur/Server.h +++ b/src/murmur/Server.h @@ -267,7 +267,7 @@ class Server : public QThread { void contextAction(const Player *, const QString &, unsigned int, int); public: void setPlayerState(Player *p, Channel *parent, bool mute, bool deaf, bool suppressed, const QString &comment = QString()); - bool setChannelState(Channel *c, Channel *parent, const QString &qsName, const QSet &links); + bool setChannelState(Channel *c, Channel *parent, const QString &qsName, const QSet &links, const QString &desc = QString()); void sendTextMessage(Channel *cChannel, User *pPlayer, bool tree, const QString &text); // Database / DBus functions. Implementation in ServerDB.cpp