Skip to content

Commit

Permalink
Prevent user from accepting the channel add/edit dialog when channel …
Browse files Browse the repository at this point in the history
…names are empty.

Implements patch #3289052 in a leaner way
  • Loading branch information
hacst committed Jun 9, 2011
1 parent bc32f8d commit c873e08
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/mumble/ACLEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c873e08

Please sign in to comment.