Permalink
Browse files

Prevent user from accepting the channel add/edit dialog when channel …

…names are empty.

Implements patch #3289052 in a leaner way
  • Loading branch information...
1 parent bc32f8d commit c873e08b80c80fa4068077c3c5a67864f9018e2e @hacst hacst committed Jun 9, 2011
Showing with 13 additions and 5 deletions.
  1. +13 −5 src/mumble/ACLEditor.cpp
View
@@ -242,31 +242,39 @@ void ACLEditor::accept() {
QDialog::reject();
return;
}
+
+ if (qleChannelName->text().isEmpty()) {
+ // Empty channel name
+ QMessageBox::warning(this, QLatin1String("Mumble"), tr("Channel must have a name"), QMessageBox::Ok);
+ qleChannelName->setFocus();
+ return;
+ }
+
// Update channel state
if (bAddChannelMode) {
g.sh->createChannel(iChannel, qleChannelName->text(), rteChannelDescription->text(), qsbChannelPosition->value(), qcbChannelTemporary->isChecked());
} else {
- bool b = false;
+ bool needs_update = false;
updatePasswordACL();
MumbleProto::ChannelState mpcs;
mpcs.set_channel_id(pChannel->iId);
if (pChannel->qsName != qleChannelName->text()) {
mpcs.set_name(u8(qleChannelName->text()));
- b = true;
+ needs_update = true;
}
if (rteChannelDescription->isModified() && (pChannel->qsDesc != rteChannelDescription->text())) {
const QString &msg = rteChannelDescription->text();
mpcs.set_description(u8(msg));
- b = true;
+ needs_update = true;
Database::setBlob(sha1(msg), msg.toUtf8());
}
if (pChannel->iPosition != qsbChannelPosition->value()) {
mpcs.set_position(qsbChannelPosition->value());
- b = true;
+ needs_update = true;
}
- if (b)
+ if (needs_update)
g.sh->sendMessage(mpcs);
// Update ACL

0 comments on commit c873e08

Please sign in to comment.