Export channel description over Ice

This commit is contained in:
Thorvald Natvig 2009-04-24 14:11:07 +02:00
parent 139d4e0dac
commit 031bf2bce5
4 changed files with 14 additions and 3 deletions

View File

@ -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.

View File

@ -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();

View File

@ -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<Channel *> &links) {
bool Server::setChannelState(Channel *cChannel, Channel *cParent, const QString &qsName, const QSet<Channel *> &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);

View File

@ -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<Channel *> &links);
bool setChannelState(Channel *c, Channel *parent, const QString &qsName, const QSet<Channel *> &links, const QString &desc = QString());
void sendTextMessage(Channel *cChannel, User *pPlayer, bool tree, const QString &text);
// Database / DBus functions. Implementation in ServerDB.cpp