Added ability to block spotting of specific callsigns if desired

This commit is contained in:
Jordan Sherer 2020-04-10 20:27:34 -04:00
parent 211685e3a4
commit 7fa2f355d3
4 changed files with 33 additions and 5 deletions

View File

@ -590,6 +590,7 @@ private:
QStringList auto_whitelist_; QStringList auto_whitelist_;
QStringList auto_blacklist_; QStringList auto_blacklist_;
QStringList hb_blacklist_; QStringList hb_blacklist_;
QStringList spot_blacklist_;
QStringList primary_highlight_words_; QStringList primary_highlight_words_;
QStringList secondary_highlight_words_; QStringList secondary_highlight_words_;
QString eot_; QString eot_;
@ -1066,11 +1067,14 @@ QSet<QString> Configuration::auto_blacklist() const {
return QSet<QString>::fromList(m_->auto_blacklist_); return QSet<QString>::fromList(m_->auto_blacklist_);
} }
QSet<QString> Configuration::hb_blacklist() const { QSet<QString> Configuration::hb_blacklist() const {
return QSet<QString>::fromList(m_->hb_blacklist_); return QSet<QString>::fromList(m_->hb_blacklist_);
} }
QSet<QString> Configuration::spot_blacklist() const {
return QSet<QString>::fromList(m_->spot_blacklist_);
}
QSet<QString> Configuration::primary_highlight_words() const { QSet<QString> Configuration::primary_highlight_words() const {
return QSet<QString>::fromList(m_->primary_highlight_words_); return QSet<QString>::fromList(m_->primary_highlight_words_);
} }
@ -1520,6 +1524,7 @@ void Configuration::impl::initialize_models ()
ui_->auto_whitelist_line_edit->setText(auto_whitelist_.join(", ")); ui_->auto_whitelist_line_edit->setText(auto_whitelist_.join(", "));
ui_->auto_blacklist_line_edit->setText(auto_blacklist_.join(", ")); ui_->auto_blacklist_line_edit->setText(auto_blacklist_.join(", "));
ui_->hb_blacklist_line_edit->setText(hb_blacklist_.join(", ")); ui_->hb_blacklist_line_edit->setText(hb_blacklist_.join(", "));
ui_->spot_blacklist_line_edit->setText(spot_blacklist_.join(", "));
ui_->primaryHighlightLineEdit->setText(primary_highlight_words_.join(", ")); ui_->primaryHighlightLineEdit->setText(primary_highlight_words_.join(", "));
ui_->secondaryHighlightLineEdit->setText(secondary_highlight_words_.join(", ")); ui_->secondaryHighlightLineEdit->setText(secondary_highlight_words_.join(", "));
ui_->eot_line_edit->setText(eot_.trimmed().left(2)); ui_->eot_line_edit->setText(eot_.trimmed().left(2));
@ -1801,6 +1806,7 @@ void Configuration::impl::read_settings ()
auto_whitelist_ = settings_->value("AutoWhitelist", QStringList{}).toStringList(); auto_whitelist_ = settings_->value("AutoWhitelist", QStringList{}).toStringList();
auto_blacklist_ = settings_->value("AutoBlacklist", QStringList{}).toStringList(); auto_blacklist_ = settings_->value("AutoBlacklist", QStringList{}).toStringList();
hb_blacklist_ = settings_->value("HBBlacklist", QStringList{}).toStringList(); hb_blacklist_ = settings_->value("HBBlacklist", QStringList{}).toStringList();
spot_blacklist_ = settings_->value("SpotBlacklist", QStringList{}).toStringList();
primary_highlight_words_ = settings_->value("PrimaryHighlightWords", QStringList{}).toStringList(); primary_highlight_words_ = settings_->value("PrimaryHighlightWords", QStringList{}).toStringList();
secondary_highlight_words_ = settings_->value("SecondaryHighlightWords", QStringList{}).toStringList(); secondary_highlight_words_ = settings_->value("SecondaryHighlightWords", QStringList{}).toStringList();
callsign_aging_ = settings_->value ("CallsignAging", 0).toInt (); callsign_aging_ = settings_->value ("CallsignAging", 0).toInt ();
@ -2126,6 +2132,7 @@ void Configuration::impl::write_settings ()
settings_->setValue ("AutoWhitelist", auto_whitelist_); settings_->setValue ("AutoWhitelist", auto_whitelist_);
settings_->setValue ("AutoBlacklist", auto_blacklist_); settings_->setValue ("AutoBlacklist", auto_blacklist_);
settings_->setValue ("HBBlacklist", hb_blacklist_); settings_->setValue ("HBBlacklist", hb_blacklist_);
settings_->setValue ("SpotBlacklist", spot_blacklist_);
settings_->setValue ("PrimaryHighlightWords", primary_highlight_words_); settings_->setValue ("PrimaryHighlightWords", primary_highlight_words_);
settings_->setValue ("SecondaryHighlightWords", secondary_highlight_words_); settings_->setValue ("SecondaryHighlightWords", secondary_highlight_words_);
settings_->setValue ("EOTCharacter", eot_); settings_->setValue ("EOTCharacter", eot_);
@ -2818,6 +2825,7 @@ void Configuration::impl::accept ()
auto_whitelist_ = splitWords(ui_->auto_whitelist_line_edit->text().toUpper().trimmed()); auto_whitelist_ = splitWords(ui_->auto_whitelist_line_edit->text().toUpper().trimmed());
auto_blacklist_ = splitWords(ui_->auto_blacklist_line_edit->text().toUpper().trimmed()); auto_blacklist_ = splitWords(ui_->auto_blacklist_line_edit->text().toUpper().trimmed());
hb_blacklist_ = splitWords(ui_->hb_blacklist_line_edit->text().toUpper().trimmed()); hb_blacklist_ = splitWords(ui_->hb_blacklist_line_edit->text().toUpper().trimmed());
spot_blacklist_ = splitWords(ui_->spot_blacklist_line_edit->text().toUpper().trimmed());
primary_highlight_words_ = splitWords(ui_->primaryHighlightLineEdit->text().toUpper().trimmed()); primary_highlight_words_ = splitWords(ui_->primaryHighlightLineEdit->text().toUpper().trimmed());
secondary_highlight_words_ = splitWords(ui_->secondaryHighlightLineEdit->text().toUpper().trimmed()); secondary_highlight_words_ = splitWords(ui_->secondaryHighlightLineEdit->text().toUpper().trimmed());
cq_ = ui_->cq_message_line_edit->text().toUpper(); cq_ = ui_->cq_message_line_edit->text().toUpper();

View File

@ -110,6 +110,7 @@ public:
QSet<QString> auto_whitelist() const; QSet<QString> auto_whitelist() const;
QSet<QString> auto_blacklist() const; QSet<QString> auto_blacklist() const;
QSet<QString> hb_blacklist() const; QSet<QString> hb_blacklist() const;
QSet<QString> spot_blacklist() const;
QSet<QString> primary_highlight_words() const; QSet<QString> primary_highlight_words() const;
QSet<QString> secondary_highlight_words() const; QSet<QString> secondary_highlight_words() const;
int activity_aging() const; int activity_aging() const;

View File

@ -315,7 +315,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>615</width> <width>724</width>
<height>537</height> <height>537</height>
</rect> </rect>
</property> </property>
@ -837,8 +837,8 @@ text message.</string>
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>674</width> <width>738</width>
<height>360</height> <height>461</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_16"> <layout class="QVBoxLayout" name="verticalLayout_16">
@ -2461,7 +2461,7 @@ comments field.</string>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>746</width> <width>746</width>
<height>722</height> <height>753</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_30"> <layout class="QVBoxLayout" name="verticalLayout_30">
@ -2571,6 +2571,16 @@ for assessing propagation and system performance.</string>
</item> </item>
</layout> </layout>
</item> </item>
<item row="3" column="0">
<widget class="QLabel" name="label_31">
<property name="text">
<string>Never send spotting reports from these callsigns (comma separated):</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="spot_blacklist_line_edit"/>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -5295,12 +5295,14 @@ QString MainWindow::lookupCallInCompoundCache(QString const &call){
void MainWindow::spotReport(int submode, int dial, int offset, int snr, QString callsign, QString grid){ void MainWindow::spotReport(int submode, int dial, int offset, int snr, QString callsign, QString grid){
if(!m_config.spot_to_reporting_networks()) return; if(!m_config.spot_to_reporting_networks()) return;
if(m_config.spot_blacklist().contains(callsign) || m_config.spot_blacklist().contains(Radio::base_callsign(callsign))) return;
m_spotClient->enqueueSpot(callsign, grid, submode, dial, offset, snr); m_spotClient->enqueueSpot(callsign, grid, submode, dial, offset, snr);
} }
void MainWindow::spotCmd(CommandDetail cmd){ void MainWindow::spotCmd(CommandDetail cmd){
if(!m_config.spot_to_reporting_networks()) return; if(!m_config.spot_to_reporting_networks()) return;
if(m_config.spot_blacklist().contains(cmd.from) || m_config.spot_blacklist().contains(Radio::base_callsign(cmd.from))) return;
QString cmdStr = cmd.cmd; QString cmdStr = cmd.cmd;
if(!cmdStr.trimmed().isEmpty()){ if(!cmdStr.trimmed().isEmpty()){
@ -5314,6 +5316,7 @@ void MainWindow::spotCmd(CommandDetail cmd){
void MainWindow::spotAprsCmd(CommandDetail cmd){ void MainWindow::spotAprsCmd(CommandDetail cmd){
if(!m_config.spot_to_reporting_networks()) return; if(!m_config.spot_to_reporting_networks()) return;
if(!m_config.spot_to_aprs()) return; if(!m_config.spot_to_aprs()) return;
if(m_config.spot_blacklist().contains(cmd.from) || m_config.spot_blacklist().contains(Radio::base_callsign(cmd.from))) return;
if(cmd.cmd != " CMD") return; if(cmd.cmd != " CMD") return;
@ -5331,6 +5334,7 @@ void MainWindow::spotAprsCmd(CommandDetail cmd){
void MainWindow::spotAprsGrid(int dial, int offset, int snr, QString callsign, QString grid){ void MainWindow::spotAprsGrid(int dial, int offset, int snr, QString callsign, QString grid){
if(!m_config.spot_to_reporting_networks()) return; if(!m_config.spot_to_reporting_networks()) return;
if(!m_config.spot_to_aprs()) return; if(!m_config.spot_to_aprs()) return;
if(m_config.spot_blacklist().contains(callsign) || m_config.spot_blacklist().contains(Radio::base_callsign(callsign))) return;
if(grid.length() < 4) return; if(grid.length() < 4) return;
Frequency frequency = dial + offset; Frequency frequency = dial + offset;
@ -5350,6 +5354,7 @@ void MainWindow::spotAprsGrid(int dial, int offset, int snr, QString callsign, Q
void MainWindow::pskLogReport(QString mode, int dial, int offset, int snr, QString callsign, QString grid){ void MainWindow::pskLogReport(QString mode, int dial, int offset, int snr, QString callsign, QString grid){
if(!m_config.spot_to_reporting_networks()) return; if(!m_config.spot_to_reporting_networks()) return;
if(m_config.spot_blacklist().contains(callsign) || m_config.spot_blacklist().contains(Radio::base_callsign(callsign))) return;
Frequency frequency = dial + offset; Frequency frequency = dial + offset;
@ -11864,6 +11869,10 @@ void MainWindow::processSpots() {
continue; continue;
} }
if(m_config.spot_blacklist().contains(d.call) || m_config.spot_blacklist().contains(Radio::base_callsign(d.call))){
continue;
}
qDebug() << "spotting call to reporting networks" << d.call << d.snr << d.dial << d.offset; qDebug() << "spotting call to reporting networks" << d.call << d.snr << d.dial << d.offset;
spotReport(d.submode, d.dial, d.offset, d.snr, d.call, d.grid); spotReport(d.submode, d.dial, d.offset, d.snr, d.call, d.grid);