Added whitelist to the configuration for AUTO replies. That way you can restrict who you allow to use your station
This commit is contained in:
parent
a46035fa86
commit
d0d9c4d352
@ -591,6 +591,7 @@ private:
|
||||
QString my_grid_;
|
||||
QString my_station_;
|
||||
QStringList my_groups_;
|
||||
QStringList auto_whitelist_;
|
||||
QString my_qth_;
|
||||
QString cq_;
|
||||
QString reply_;
|
||||
@ -977,6 +978,10 @@ void Configuration::removeGroup(QString const &group){
|
||||
m_->write_settings();
|
||||
}
|
||||
|
||||
QSet<QString> Configuration::auto_whitelist() const {
|
||||
return QSet<QString>::fromList(m_->auto_whitelist_);
|
||||
}
|
||||
|
||||
QString Configuration::my_qth() const
|
||||
{
|
||||
return m_->my_qth_.trimmed();
|
||||
@ -1171,6 +1176,7 @@ Configuration::impl::impl (Configuration * self, QDir const& temp_directory,
|
||||
setUppercase(ui_->reply_message_line_edit);
|
||||
setUppercase(ui_->cq_message_line_edit);
|
||||
setUppercase(ui_->groups_line_edit);
|
||||
setUppercase(ui_->auto_whitelist_line_edit);
|
||||
|
||||
ui_->udp_server_port_spin_box->setMinimum (1);
|
||||
ui_->udp_server_port_spin_box->setMaximum (std::numeric_limits<port_type>::max ());
|
||||
@ -1361,6 +1367,7 @@ void Configuration::impl::initialize_models ()
|
||||
ui_->activity_aging_spin_box->setValue(activity_aging_);
|
||||
ui_->station_message_line_edit->setText (my_station_.toUpper());
|
||||
ui_->groups_line_edit->setText(my_groups_.join(", "));
|
||||
ui_->auto_whitelist_line_edit->setText(auto_whitelist_.join(", "));
|
||||
ui_->qth_message_line_edit->setText (my_qth_.toUpper());
|
||||
ui_->cq_message_line_edit->setText(cq_.toUpper());
|
||||
ui_->reply_message_line_edit->setText (reply_.toUpper());
|
||||
@ -1505,6 +1512,7 @@ void Configuration::impl::read_settings ()
|
||||
my_grid_ = settings_->value ("MyGrid", QString {}).toString ();
|
||||
my_station_ = settings_->value("MyStation", QString {}).toString();
|
||||
my_groups_ = settings_->value("MyGroups", QStringList{}).toStringList();
|
||||
auto_whitelist_ = settings_->value("AutoWhitelist", QStringList{}).toStringList();
|
||||
callsign_aging_ = settings_->value ("CallsignAging", 0).toInt ();
|
||||
activity_aging_ = settings_->value ("ActivityAging", 2).toInt ();
|
||||
my_qth_ = settings_->value("MyQTH", QString {}).toString();
|
||||
@ -1765,6 +1773,7 @@ void Configuration::impl::write_settings ()
|
||||
settings_->setValue ("MyGrid", my_grid_);
|
||||
settings_->setValue ("MyStation", my_station_);
|
||||
settings_->setValue ("MyGroups", my_groups_);
|
||||
settings_->setValue ("AutoWhitelist", auto_whitelist_);
|
||||
settings_->setValue ("MyQTH", my_qth_);
|
||||
settings_->setValue ("CQMessage", cq_);
|
||||
settings_->setValue ("Reply", reply_);
|
||||
@ -2047,6 +2056,20 @@ QStringList splitGroups(QString groupsString, bool filter){
|
||||
return groups;
|
||||
}
|
||||
|
||||
QStringList splitCalls(QString callsString){
|
||||
QStringList calls;
|
||||
if(callsString.isEmpty()){
|
||||
return calls;
|
||||
}
|
||||
|
||||
foreach(QString call, callsString.split(",")){
|
||||
auto g = call.trimmed();
|
||||
calls.append(call.trimmed().toUpper());
|
||||
}
|
||||
|
||||
return calls;
|
||||
}
|
||||
|
||||
bool Configuration::impl::validate ()
|
||||
{
|
||||
auto callsign = ui_->callsign_line_edit->text().toUpper().trimmed();
|
||||
@ -2062,6 +2085,13 @@ bool Configuration::impl::validate ()
|
||||
}
|
||||
}
|
||||
|
||||
foreach(auto call, splitCalls(ui_->auto_whitelist_line_edit->text().toUpper().trimmed())){
|
||||
if(!Varicode::isValidCallsign(call, nullptr)){
|
||||
MessageBox::critical_message (this, QString("%1 is not a valid callsign to whitelist").arg(call));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
auto cq = ui_->cq_message_line_edit->text().toUpper().trimmed();
|
||||
if(!cq.isEmpty() && !(cq.startsWith("CQ") || cq.contains(callsign))){
|
||||
MessageBox::critical_message (this, QString("The CQ message format is invalid. It must either start with \"CQ\" or contain your callsign."));
|
||||
@ -2320,6 +2350,7 @@ void Configuration::impl::accept ()
|
||||
my_grid_ = ui_->grid_line_edit->text ().toUpper();
|
||||
my_station_ = ui_->station_message_line_edit->text().toUpper();
|
||||
my_groups_ = splitGroups(ui_->groups_line_edit->text().toUpper().trimmed(), true);
|
||||
auto_whitelist_ = splitCalls(ui_->auto_whitelist_line_edit->text().toUpper().trimmed());
|
||||
cq_ = ui_->cq_message_line_edit->text().toUpper();
|
||||
reply_ = ui_->reply_message_line_edit->text().toUpper();
|
||||
my_qth_ = ui_->qth_message_line_edit->text().toUpper();
|
||||
|
@ -101,6 +101,7 @@ public:
|
||||
QSet<QString> my_groups() const;
|
||||
void addGroup(QString const &group);
|
||||
void removeGroup(QString const &group);
|
||||
QSet<QString> auto_whitelist() const;
|
||||
int activity_aging() const;
|
||||
int callsign_aging() const;
|
||||
QString my_qth () const;
|
||||
|
@ -295,8 +295,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>654</width>
|
||||
<height>511</height>
|
||||
<width>724</width>
|
||||
<height>586</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_26">
|
||||
@ -344,20 +344,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="autoreply_off_check_box">
|
||||
<property name="text">
|
||||
<string>Autoreply (AUTO) off at startup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="relay_disabled_check_box">
|
||||
<property name="text">
|
||||
<string>Disable message relay (>) when AUTO is enabled</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="monitor_last_used_check_box">
|
||||
<property name="visible">
|
||||
@ -568,6 +554,39 @@ text message.</string>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_9">
|
||||
<property name="title">
|
||||
<string>Autoreply</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="autoreply_off_check_box">
|
||||
<property name="text">
|
||||
<string>Autoreply (AUTO) off at startup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="relay_disabled_check_box">
|
||||
<property name="text">
|
||||
<string>Disable message relay (>) when AUTO is enabled</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_23">
|
||||
<property name="text">
|
||||
<string>Only autoreply to these callsigns (comma separated):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="auto_whitelist_line_edit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_15">
|
||||
<property name="title">
|
||||
@ -1319,8 +1338,8 @@ a few, particularly some Kenwood rigs, require it).</string>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-81</y>
|
||||
<width>718</width>
|
||||
<y>0</y>
|
||||
<width>237</width>
|
||||
<height>467</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -4098,12 +4117,12 @@ soundcard changes</string>
|
||||
</connection>
|
||||
</connections>
|
||||
<buttongroups>
|
||||
<buttongroup name="split_mode_button_group"/>
|
||||
<buttongroup name="CAT_stop_bits_button_group"/>
|
||||
<buttongroup name="TX_audio_source_button_group"/>
|
||||
<buttongroup name="CAT_data_bits_button_group"/>
|
||||
<buttongroup name="TX_mode_button_group"/>
|
||||
<buttongroup name="CAT_handshake_button_group"/>
|
||||
<buttongroup name="TX_mode_button_group"/>
|
||||
<buttongroup name="CAT_data_bits_button_group"/>
|
||||
<buttongroup name="PTT_method_button_group"/>
|
||||
<buttongroup name="split_mode_button_group"/>
|
||||
<buttongroup name="TX_audio_source_button_group"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
@ -9506,6 +9506,13 @@ void MainWindow::processCommandActivity() {
|
||||
continue;
|
||||
}
|
||||
|
||||
// we're only responding to callsigns in our whitelist if we have one defined...
|
||||
// make sure the whitelist is empty (no restrictions) or the from callsign or its base callsign is on it
|
||||
auto whitelist = m_config.auto_whitelist();
|
||||
if(!whitelist.isEmpty() && !(whitelist.contains(d.from) || whitelist.contains(Radio::base_callsign(d.from)))){
|
||||
continue;
|
||||
}
|
||||
|
||||
// display the command activity
|
||||
ActivityDetail ad = {};
|
||||
ad.isLowConfidence = false;
|
||||
|
Loading…
Reference in New Issue
Block a user