Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Hacker <dd0t@users.sourceforge.net>2010-04-29 17:20:07 +0400
committerStefan Hacker <dd0t@users.sourceforge.net>2010-04-29 17:53:43 +0400
commit02811bc2851fba9ad70c2c2b15d3e97c1c160b2b (patch)
tree44f88a5de7e1e1d2d2a53c36ccdc84a42d5a5917 /src/murmur/RPC.cpp
parent6b5b73816b150dd4caae64e581d654ec91646240 (diff)
Make sure temporary group memberships of a user are purged once he disconnects
Diffstat (limited to 'src/murmur/RPC.cpp')
-rw-r--r--src/murmur/RPC.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/murmur/RPC.cpp b/src/murmur/RPC.cpp
index c90795ab1..a4a16dad8 100644
--- a/src/murmur/RPC.cpp
+++ b/src/murmur/RPC.cpp
@@ -36,6 +36,20 @@
#include "ServerDB.h"
#include "Version.h"
+/*!
+ \fn void Server::setTempGroups(int userid, Channel *cChannel, const QStringList &groups)
+ Sets the list of temporary groups the given userid is a member of. If no channel is given root will
+ be targeted.
+
+ If userid is negative the absolute value is a session id. If it is positive it is a registration id.
+*/
+
+/*!
+ \fn void Server::clearTempGroups(User *user, Channel *cChannel = NULL, bool recurse = true)
+ Clears temporary group memberships for the given User. If no channel is given root will be targeted.
+ If recursion is activated all temporary memberships in related channels will also be cleared.
+*/
+
void Server::setUserState(User *pUser, Channel *cChannel, bool mute, bool deaf, bool suppressed, bool prioritySpeaker, const QString &comment) {
bool changed = false;
@@ -234,6 +248,27 @@ void Server::setTempGroups(int userid, Channel *cChannel, const QStringList &gro
clearACLCache(p);
}
+void Server::clearTempGroups(User *user, Channel *cChannel, bool recurse) {
+ QList<Channel*> qlChans;
+ if (! cChannel)
+ cChannel = qhChannels.value(0);
+
+ qlChans.append(cChannel);
+
+ while (!qlChans.isEmpty()) {
+ Channel *chan = qlChans.takeLast();
+ Group *g;
+ foreach(g, chan->qhGroups) {
+ g->qsTemporary.remove(user->iId);
+ g->qsTemporary.remove(- static_cast<int>(user->uiSession));
+ }
+
+ if (recurse)
+ qlChans.append(chan->qlChannels);
+ }
+
+ clearACLCache(user);
+}
void Server::connectAuthenticator(QObject *obj) {
connect(this, SIGNAL(registerUserSig(int &, const QMap<int, QString> &)), obj, SLOT(registerUserSlot(int &, const QMap<int, QString> &)));