diff options
author | spede <spede@dota2.fi> | 2016-05-19 01:31:35 +0300 |
---|---|---|
committer | Mikkel Krautz <mikkel@krautz.dk> | 2016-05-19 01:31:42 +0300 |
commit | 5d1a56e6e86f17aa68e9b600b53f9bf73158b477 (patch) | |
tree | ea6bbf7daaa79f69d34883808370752f8489931d /src/murmur/Messages.cpp | |
parent | ec87aa6bd82d6c278d1746e91c528a8758f92d76 (diff) |
Add logging for ban removals/changes.
Fixes mumble-voip/mumble#1996
Diffstat (limited to 'src/murmur/Messages.cpp')
-rw-r--r-- | src/murmur/Messages.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/murmur/Messages.cpp b/src/murmur/Messages.cpp index b3670bb09..e4beff64c 100644 --- a/src/murmur/Messages.cpp +++ b/src/murmur/Messages.cpp @@ -400,6 +400,7 @@ void Server::msgAuthenticate(ServerUser *uSource, MumbleProto::Authenticate &msg void Server::msgBanList(ServerUser *uSource, MumbleProto::BanList &msg) { MSG_SETUP(ServerUser::Authenticated); + QSet<Ban> previousBans, newBans; if (! hasPermission(uSource, qhChannels.value(0), ChanACL::Ban)) { PERM_DENIED(uSource, qhChannels.value(0), ChanACL::Ban); return; @@ -419,6 +420,7 @@ void Server::msgBanList(ServerUser *uSource, MumbleProto::BanList &msg) { } sendMessage(uSource, msg); } else { + previousBans = qlBans.toSet(); qlBans.clear(); for (int i=0;i < msg.bans_size(); ++i) { const MumbleProto::BanList_BanEntry &be = msg.bans(i); @@ -436,8 +438,18 @@ void Server::msgBanList(ServerUser *uSource, MumbleProto::BanList &msg) { b.qdtStart = QDateTime::currentDateTime().toUTC(); } b.iDuration = be.duration(); - if (b.isValid()) + if (b.isValid()) { qlBans << b; + } + } + newBans = qlBans.toSet(); + QSet<Ban> removed = previousBans - newBans; + QSet<Ban> added = newBans - previousBans; + foreach(const Ban &b, removed) { + log(uSource, QString("Removed ban: %1").arg(b.toString())); + } + foreach(const Ban &b, added) { + log(uSource, QString("New ban: %1").arg(b.toString())); } saveBans(); log(uSource, "Updated banlist"); |