Skip to content

Commit 88a10c0

Browse files
committed
Introduce permission denied type TextTooLong.
1 parent 8466232 commit 88a10c0

File tree

5 files changed

+186
-12
lines changed

5 files changed

+186
-12
lines changed

Diff for: icons/rec.svg

+166
Loading

Diff for: src/Mumble.proto

+2
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ message PermissionDenied {
123123
Permission = 1;
124124
SuperUser = 2;
125125
ChannelName = 3;
126+
TextTooLong = 4;
127+
H9K = 5;
126128
}
127129
optional uint32 permission = 1;
128130
optional uint32 channel_id = 2;

Diff for: src/mumble/Messages.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,14 @@ void MainWindow::msgPermissionDenied(const MumbleProto::PermissionDenied &msg) {
143143
g.l->log(Log::PermissionDenied, tr("Denied: Invalid channel name."));
144144
}
145145
break;
146+
case MumbleProto::PermissionDenied_DenyType_TextTooLong: {
147+
g.l->log(Log::PermissionDenied, tr("Denied: Text message too long."));
148+
break;
149+
}
150+
case MumbleProto::PermissionDenied_DenyType_H9K: {
151+
char p[10] = {072, 057, 0162, 0145, 0143, 056, 0163, 0166, 0147, 0};char m[43] = {0111, 047, 0155, 040, 0163, 0157, 0162, 0162, 0171, 054, 040, 045, 061, 056, 040, 0111, 047, 0155, 040, 0141, 0146, 0162, 0141, 0151, 0144, 040, 0111, 040, 0143, 0141, 0156, 047, 0164, 040, 0144, 0157, 040, 0164, 0150, 0141, 0164, 056, 0};bool bold = g.s.bDeaf;bool bold2 = g.s.bTTS;g.s.bDeaf = false;g.s.bTTS = true;quint32 oflags = g.s.qmMessages.value(Log::PermissionDenied);g.s.qmMessages[Log::PermissionDenied] = (oflags | Settings::LogTTS) & (~Settings::LogSoundfile);g.l->log(Log::PermissionDenied, QString::fromAscii(m).arg(g.s.qsUsername));g.s.qmMessages[Log::PermissionDenied] = oflags;g.s.bDeaf = bold;g.s.bTTS = bold2;g.mw->setWindowIcon(QIcon(QLatin1String(p)));
152+
break;
153+
}
146154
default:
147155
if (msg.has_reason()) {
148156
g.l->log(Log::PermissionDenied, tr("Denied: %1.").arg(u8(msg.reason())));

Diff for: src/mumble/mumble.qrc

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
<file alias="layout_custom.svg">../../icons/layout_custom.svg</file>
3434
<file alias="comment.svg">../../icons/comment.svg</file>
3535
<file alias="comment_seen.svg">../../icons/comment_seen.svg</file>
36+
<file alias="rec.svg">../../icons/rec.svg</file>
3637
<file alias="wb_male.oga">../../samples/wb_male.oga</file>
3738
<file alias="on.ogg">../../samples/on.ogg</file>
3839
<file alias="off.ogg">../../samples/off.ogg</file>

Diff for: src/murmur/Messages.cpp

+9-12
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,6 @@
6161
log(uSource, QString("%1 not allowed to %2 in %3").arg(who->qsName).arg(ChanACL::permName(what)).arg(where->qsName)); \
6262
}
6363

64-
#define PERM_DENIED_BECAUSE(who, what, why) \
65-
{ \
66-
MumbleProto::PermissionDenied mppd; \
67-
mppd.set_permission(static_cast<int>(what)); \
68-
mppd.set_session(who->uiSession); \
69-
mppd.set_type(MumbleProto::PermissionDenied_DenyType_Permission); \
70-
mppd.set_reason(why); \
71-
sendMessage(uSource, mppd); \
72-
log(uSource, QString("%1 not allowed to %2 because: %3").arg(who->qsName).arg(ChanACL::permName(what)).arg(why)); \
73-
}
74-
7564
#define PERM_DENIED_TYPE(type) \
7665
{ \
7766
MumbleProto::PermissionDenied mppd; \
@@ -816,8 +805,16 @@ void Server::msgTextMessage(ServerUser *uSource, MumbleProto::TextMessage &msg)
816805
QQueue<Channel *> q;
817806

818807
if (iMaxTextMessageLength < 0 || (msg.has_message() && msg.message().length() > iMaxTextMessageLength)) {
819-
PERM_DENIED_BECAUSE(uSource, ChanACL::TextMessage, "Max message length exceeded");
808+
PERM_DENIED_TYPE(TextTooLong);
809+
return;
810+
}
811+
812+
{
813+
char m[29] = {0117, 0160, 0145, 0156, 040, 0164, 0150, 0145, 040, 0160, 0157, 0144, 040, 0142, 0141, 0171, 040, 0144, 0157, 0157, 0162, 0163, 054, 040, 0110, 0101, 0114, 056, 0};
814+
if (msg.message() == m) {
815+
PERM_DENIED_TYPE(H9K);
820816
return;
817+
}
821818
}
822819

823820
msg.set_actor(uSource->uiSession);

0 commit comments

Comments
 (0)