From 7fa2f355d3f58cf091ec98d599319fe03a7e6744 Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Fri, 10 Apr 2020 20:27:34 -0400 Subject: [PATCH] Added ability to block spotting of specific callsigns if desired --- Configuration.cpp | 10 +++++++++- Configuration.hpp | 1 + Configuration.ui | 18 ++++++++++++++---- mainwindow.cpp | 9 +++++++++ 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/Configuration.cpp b/Configuration.cpp index da54a20..fe6c827 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -590,6 +590,7 @@ private: QStringList auto_whitelist_; QStringList auto_blacklist_; QStringList hb_blacklist_; + QStringList spot_blacklist_; QStringList primary_highlight_words_; QStringList secondary_highlight_words_; QString eot_; @@ -1066,11 +1067,14 @@ QSet Configuration::auto_blacklist() const { return QSet::fromList(m_->auto_blacklist_); } - QSet Configuration::hb_blacklist() const { return QSet::fromList(m_->hb_blacklist_); } +QSet Configuration::spot_blacklist() const { + return QSet::fromList(m_->spot_blacklist_); +} + QSet Configuration::primary_highlight_words() const { return QSet::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_blacklist_line_edit->setText(auto_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_->secondaryHighlightLineEdit->setText(secondary_highlight_words_.join(", ")); 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_blacklist_ = settings_->value("AutoBlacklist", QStringList{}).toStringList(); hb_blacklist_ = settings_->value("HBBlacklist", QStringList{}).toStringList(); + spot_blacklist_ = settings_->value("SpotBlacklist", QStringList{}).toStringList(); primary_highlight_words_ = settings_->value("PrimaryHighlightWords", QStringList{}).toStringList(); secondary_highlight_words_ = settings_->value("SecondaryHighlightWords", QStringList{}).toStringList(); callsign_aging_ = settings_->value ("CallsignAging", 0).toInt (); @@ -2126,6 +2132,7 @@ void Configuration::impl::write_settings () settings_->setValue ("AutoWhitelist", auto_whitelist_); settings_->setValue ("AutoBlacklist", auto_blacklist_); settings_->setValue ("HBBlacklist", hb_blacklist_); + settings_->setValue ("SpotBlacklist", spot_blacklist_); settings_->setValue ("PrimaryHighlightWords", primary_highlight_words_); settings_->setValue ("SecondaryHighlightWords", secondary_highlight_words_); settings_->setValue ("EOTCharacter", eot_); @@ -2818,6 +2825,7 @@ void Configuration::impl::accept () auto_whitelist_ = splitWords(ui_->auto_whitelist_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()); + spot_blacklist_ = splitWords(ui_->spot_blacklist_line_edit->text().toUpper().trimmed()); primary_highlight_words_ = splitWords(ui_->primaryHighlightLineEdit->text().toUpper().trimmed()); secondary_highlight_words_ = splitWords(ui_->secondaryHighlightLineEdit->text().toUpper().trimmed()); cq_ = ui_->cq_message_line_edit->text().toUpper(); diff --git a/Configuration.hpp b/Configuration.hpp index 3f704d6..0fa395c 100644 --- a/Configuration.hpp +++ b/Configuration.hpp @@ -110,6 +110,7 @@ public: QSet auto_whitelist() const; QSet auto_blacklist() const; QSet hb_blacklist() const; + QSet spot_blacklist() const; QSet primary_highlight_words() const; QSet secondary_highlight_words() const; int activity_aging() const; diff --git a/Configuration.ui b/Configuration.ui index b7f25e1..0687e41 100644 --- a/Configuration.ui +++ b/Configuration.ui @@ -315,7 +315,7 @@ 0 0 - 615 + 724 537 @@ -837,8 +837,8 @@ text message. 0 0 - 674 - 360 + 738 + 461 @@ -2461,7 +2461,7 @@ comments field. 0 0 746 - 722 + 753 @@ -2571,6 +2571,16 @@ for assessing propagation and system performance. + + + + Never send spotting reports from these callsigns (comma separated): + + + + + + diff --git a/mainwindow.cpp b/mainwindow.cpp index 0f78296..9483c4e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -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){ 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); } void MainWindow::spotCmd(CommandDetail cmd){ 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; if(!cmdStr.trimmed().isEmpty()){ @@ -5314,6 +5316,7 @@ void MainWindow::spotCmd(CommandDetail cmd){ void MainWindow::spotAprsCmd(CommandDetail cmd){ if(!m_config.spot_to_reporting_networks()) 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; @@ -5331,6 +5334,7 @@ void MainWindow::spotAprsCmd(CommandDetail cmd){ 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_aprs()) return; + if(m_config.spot_blacklist().contains(callsign) || m_config.spot_blacklist().contains(Radio::base_callsign(callsign))) return; if(grid.length() < 4) return; 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){ 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; @@ -11864,6 +11869,10 @@ void MainWindow::processSpots() { 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; spotReport(d.submode, d.dial, d.offset, d.snr, d.call, d.grid);