From 3c9bc48f746eac476dc955954cdbba83b960ddaa Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Mon, 15 Jul 2019 09:45:25 -0400 Subject: [PATCH] Added option to blacklist specific stations' HB messages --- Configuration.cpp | 10 ++++++++++ Configuration.hpp | 1 + Configuration.ui | 22 ++++++++++++++++------ mainwindow.cpp | 5 +++++ 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/Configuration.cpp b/Configuration.cpp index ffb22f4..24850c0 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -580,6 +580,7 @@ private: QStringList my_groups_; QStringList auto_whitelist_; QStringList auto_blacklist_; + QStringList hb_blacklist_; QStringList primary_highlight_words_; QStringList secondary_highlight_words_; QString eot_; @@ -1004,6 +1005,11 @@ QSet Configuration::auto_blacklist() const { return QSet::fromList(m_->auto_blacklist_); } + +QSet Configuration::hb_blacklist() const { + return QSet::fromList(m_->hb_blacklist_); +} + QSet Configuration::primary_highlight_words() const { return QSet::fromList(m_->primary_highlight_words_); } @@ -1408,6 +1414,7 @@ void Configuration::impl::initialize_models () ui_->groups_line_edit->setText(my_groups_.join(", ")); 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_->primaryHighlightLineEdit->setText(primary_highlight_words_.join(", ")); ui_->secondaryHighlightLineEdit->setText(secondary_highlight_words_.join(", ")); ui_->eot_line_edit->setText(eot_.trimmed().left(2)); @@ -1564,6 +1571,7 @@ void Configuration::impl::read_settings () my_groups_ = settings_->value("MyGroups", QStringList{}).toStringList(); auto_whitelist_ = settings_->value("AutoWhitelist", QStringList{}).toStringList(); auto_blacklist_ = settings_->value("AutoBlacklist", QStringList{}).toStringList(); + hb_blacklist_ = settings_->value("HBBlacklist", 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 (); @@ -1835,6 +1843,7 @@ void Configuration::impl::write_settings () settings_->setValue ("MyGroups", my_groups_); settings_->setValue ("AutoWhitelist", auto_whitelist_); settings_->setValue ("AutoBlacklist", auto_blacklist_); + settings_->setValue ("HBBlacklist", hb_blacklist_); settings_->setValue ("PrimaryHighlightWords", primary_highlight_words_); settings_->setValue ("SecondaryHighlightWords", secondary_highlight_words_); settings_->setValue ("EOTCharacter", eot_); @@ -2439,6 +2448,7 @@ void Configuration::impl::accept () my_groups_ = splitGroups(ui_->groups_line_edit->text().toUpper().trimmed(), true); 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()); 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 75f4b05..af74494 100644 --- a/Configuration.hpp +++ b/Configuration.hpp @@ -102,6 +102,7 @@ public: void removeGroup(QString const &group); QSet auto_whitelist() const; QSet auto_blacklist() const; + QSet hb_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 02b4e08..1908fd2 100644 --- a/Configuration.ui +++ b/Configuration.ui @@ -23,7 +23,7 @@ Select tab to change configuration parameters. - 6 + 0 @@ -277,9 +277,9 @@ 0 - 0 - 615 - 808 + -266 + 724 + 839 @@ -605,6 +605,16 @@ text message. + + + + Never ACK HBs from these callsigns (comman separated): + + + + + + @@ -3694,8 +3704,8 @@ QListView::item:hover { 0 0 - 738 - 378 + 277 + 93 diff --git a/mainwindow.cpp b/mainwindow.cpp index 35dc572..3a70f0a 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -10777,6 +10777,11 @@ void MainWindow::processCommandActivity() { // if we have auto reply enabled and auto ack enabled and no callsign is selected else if (d.cmd == " HB" && ui->autoReplyButton->isChecked() && m_hbAutoAck && selectedCallsign.isEmpty()){ + // check to make sure this callsign isn't blacklisted + if(m_config.hb_blacklist().contains(d.from) || m_config.hb_blacklist().contains(Radio::base_callsign(d.from))){ + continue; + } + // check to see if we have a message for a station who is heartbeating QString extra; auto mid = getNextMessageIdForCallsign(d.from);