From 01c2ab4cbb3a7a08c21d3eacb29c2347df01c40e Mon Sep 17 00:00:00 2001 From: jolavillette Date: Wed, 18 Feb 2026 17:56:46 +0100 Subject: [PATCH 1/3] Add Ignore User button to Security Feed and implement Ignored Users list management --- retroshare-gui/src/gui/feeds/SecurityItem.cpp | 25 ++++++ retroshare-gui/src/gui/feeds/SecurityItem.h | 1 + retroshare-gui/src/gui/feeds/SecurityItem.ui | 27 +++++++ .../src/gui/settings/NotifyPage.cpp | 79 +++++++++++++++++++ retroshare-gui/src/gui/settings/NotifyPage.h | 11 +++ retroshare-gui/src/gui/settings/NotifyPage.ui | 55 +++++++++++++ 6 files changed, 198 insertions(+) diff --git a/retroshare-gui/src/gui/feeds/SecurityItem.cpp b/retroshare-gui/src/gui/feeds/SecurityItem.cpp index 234b97b48..c877f71a7 100644 --- a/retroshare-gui/src/gui/feeds/SecurityItem.cpp +++ b/retroshare-gui/src/gui/feeds/SecurityItem.cpp @@ -37,6 +37,7 @@ #include #include +#include "pqi/authssl.h" /***** * #define DEBUG_ITEM 1 @@ -54,6 +55,12 @@ SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, const RsPgpId &g chatButton->hide(); removeFriendButton->setEnabled(false); removeFriendButton->hide(); + banButton->hide(); + + QPalette pal = banButton->palette(); + pal.setColor(QPalette::ButtonText, Qt::red); + banButton->setPalette(pal); + peerDetailsButton->setEnabled(false); friendRequesttoolButton->hide(); requestLabel->hide(); @@ -68,6 +75,7 @@ SecurityItem::SecurityItem(FeedHolder *parent, uint32_t feedId, const RsPgpId &g //connect( quickmsgButton, SIGNAL( clicked( ) ), this, SLOT( sendMsg() ) ); connect( removeFriendButton, SIGNAL(clicked()), this, SLOT(removeFriend())); + connect( banButton, SIGNAL(clicked()), this, SLOT(banUser())); connect( peerDetailsButton, SIGNAL(clicked()), this, SLOT(peerDetails())); connect( friendRequesttoolButton, SIGNAL(clicked()), this, SLOT(friendRequest())); @@ -241,6 +249,7 @@ void SecurityItem::updateItem() removeFriendButton->setEnabled(false); removeFriendButton->hide(); + banButton->show(); peerDetailsButton->setEnabled(false); if(mType == RsFeedTypeFlags::RS_FEED_ITEM_SEC_BAD_CERTIFICATE) @@ -306,6 +315,7 @@ void SecurityItem::updateItem() requestLabel->hide(); removeFriendButton->setEnabled(true); removeFriendButton->show(); + banButton->hide(); } else { @@ -322,6 +332,7 @@ void SecurityItem::updateItem() } removeFriendButton->setEnabled(false); removeFriendButton->hide(); + banButton->show(); } //quickmsgButton->show(); @@ -375,6 +386,20 @@ void SecurityItem::removeFriend() rsPeers->removeFriend(mGpgId); } } + +void SecurityItem::banUser() +{ + // Confirmation dialog + QMessageBox::StandardButton reply; + reply = QMessageBox::question(this, tr("Ignore User"), tr("Are you sure you want to ignore this user? They will be added to the Ignored Users list and you will not receive further notifications from them. You can manage the list in Preferences -> Notify."), + QMessageBox::Yes|QMessageBox::No); + if (reply == QMessageBox::Yes) { + AuthSSL::instance().addNotifyDeny(mGpgId, mSslCn); + // Remove this item from the feed as it is now handled + removeItem(); + } +} + void SecurityItem::friendRequest() { #ifdef DEBUG_ITEM diff --git a/retroshare-gui/src/gui/feeds/SecurityItem.h b/retroshare-gui/src/gui/feeds/SecurityItem.h index e2ba2b394..e01d60975 100644 --- a/retroshare-gui/src/gui/feeds/SecurityItem.h +++ b/retroshare-gui/src/gui/feeds/SecurityItem.h @@ -55,6 +55,7 @@ private slots: void friendRequest(); void removeFriend(); + void banUser(); void peerDetails(); void sendMsg(); void openChat(); diff --git a/retroshare-gui/src/gui/feeds/SecurityItem.ui b/retroshare-gui/src/gui/feeds/SecurityItem.ui index 585c18e00..eb5cb1268 100644 --- a/retroshare-gui/src/gui/feeds/SecurityItem.ui +++ b/retroshare-gui/src/gui/feeds/SecurityItem.ui @@ -283,6 +283,33 @@ + + + + Qt::NoFocus + + + Ignore User + + + + :/images/user/deny_user48.png:/images/user/deny_user48.png + + + + 24 + 24 + + + + Qt::ToolButtonTextBesideIcon + + + false + + + + diff --git a/retroshare-gui/src/gui/settings/NotifyPage.cpp b/retroshare-gui/src/gui/settings/NotifyPage.cpp index 29ac17cb1..9ba8828b7 100755 --- a/retroshare-gui/src/gui/settings/NotifyPage.cpp +++ b/retroshare-gui/src/gui/settings/NotifyPage.cpp @@ -33,6 +33,13 @@ #include "gui/NewsFeed.h" #include "util/misc.h" +#include "pqi/authssl.h" +//#include "gui/common/Rsdialogs.h" // For getting ID +//#include "gui/peers/PeersDialog.h" // Maybe for friend selection? +#include +#include +#include "gui/common/FriendSelectionDialog.h" + /** Constructor */ NotifyPage::NotifyPage(QWidget * parent, Qt::WindowFlags flags) : ConfigPage(parent, flags) @@ -47,6 +54,9 @@ NotifyPage::NotifyPage(QWidget * parent, Qt::WindowFlags flags) connect(ui.pushButtonDisableAll,SIGNAL(toggled(bool)), RsGUIEventManager::getInstance(), SLOT(SetDisableAll(bool))); connect(RsGUIEventManager::getInstance(),SIGNAL(disableAllChanged(bool)), ui.pushButtonDisableAll, SLOT(setChecked(bool))); + connect(ui.addIgnoredButton, SIGNAL(clicked()), this, SLOT(addIgnoredUser())); + connect(ui.removeIgnoredButton, SIGNAL(clicked()), this, SLOT(removeIgnoredUser())); + ui.notify_Blogs->hide(); QFont font = ui.notify_Peers->font(); // use font from existing checkbox @@ -394,6 +404,35 @@ void NotifyPage::load() notifyToggled() ; + loadIgnoredUsers(); +} + +void NotifyPage::loadIgnoredUsers() +{ + ui.ignoredTreeWidget->clear(); + QStringList headers; + headers << tr("Name") << tr("PGP Id"); + ui.ignoredTreeWidget->setHeaderLabels(headers); + + std::map ids; + AuthSSL::instance().getNotifyDenyList(ids); + for(const auto& pair : ids) { + QTreeWidgetItem* item = new QTreeWidgetItem(ui.ignoredTreeWidget); + + std::string displayName = pair.second; + if(displayName.empty()) { + RsPeerDetails details; + if(rsPeers && rsPeers->getGPGDetails(pair.first, details)) { + displayName = details.name; + // Optionally update the list in AuthSSL? + // AuthSSL::instance().addNotifyDeny(pair.first, displayName); + // Better not to modify state during load, just display it. + } + } + + item->setText(0, QString::fromStdString(displayName)); + item->setText(1, QString::fromStdString(pair.first.toStdString())); + } } void NotifyPage::notifyToggled() @@ -444,3 +483,43 @@ void NotifyPage::testToaster() } } } + +void NotifyPage::showEvent(QShowEvent *event) +{ + loadIgnoredUsers(); + ConfigPage::showEvent(event); +} + +void NotifyPage::addIgnoredUser() +{ + std::set ids = FriendSelectionDialog::selectFriends_PGP(this, tr("Ban Friend"), tr("Select a friend to ban"), FriendSelectionWidget::MODUS_SINGLE, FriendSelectionWidget::SHOW_GPG); + + if (ids.empty()) { + return; + } + + // Since MODUS_SINGLE, we should have at most one ID, but loop just in case or take first. + for(const RsPgpId& id : ids) { + if (id.isNull()) continue; + + // Try to get name from peers interface if possible, otherwise empty + std::string name; + RsPeerDetails details; + if(rsPeers && rsPeers->getGPGDetails(id, details)) name = details.name; + + AuthSSL::instance().addNotifyDeny(id, name); + } + + // Refresh list + loadIgnoredUsers(); +} + +void NotifyPage::removeIgnoredUser() +{ + QTreeWidgetItem* item = ui.ignoredTreeWidget->currentItem(); + if(item) { + RsPgpId id(item->text(1).toStdString()); + AuthSSL::instance().removeNotifyDeny(id); + delete item; + } +} diff --git a/retroshare-gui/src/gui/settings/NotifyPage.h b/retroshare-gui/src/gui/settings/NotifyPage.h index 3e240c1da..b63268309 100755 --- a/retroshare-gui/src/gui/settings/NotifyPage.h +++ b/retroshare-gui/src/gui/settings/NotifyPage.h @@ -33,6 +33,8 @@ class UserNotify; class FeedNotify; class ToasterNotify; + + class UserNotifySetting { public: @@ -81,6 +83,12 @@ public: /** Loads the settings for this page */ virtual void load(); +protected: + void showEvent(QShowEvent *event) override; + +private: + void loadIgnoredUsers(); + virtual QPixmap iconPixmap() const { return FilesDefs::getPixmapFromQtResourcePath(":/icons/settings/notify.svg") ; } virtual QString pageName() const { return tr("Notify") ; } virtual QString helpText() const ; @@ -102,6 +110,9 @@ private slots: void updateToasterMargin(); void updateToasterPosition(); + + void addIgnoredUser(); + void removeIgnoredUser(); private: RsFeedTypeFlags getNewsFlags(); diff --git a/retroshare-gui/src/gui/settings/NotifyPage.ui b/retroshare-gui/src/gui/settings/NotifyPage.ui index d34c0fdf8..9e3f4cee1 100755 --- a/retroshare-gui/src/gui/settings/NotifyPage.ui +++ b/retroshare-gui/src/gui/settings/NotifyPage.ui @@ -481,6 +481,61 @@ + + + Ignored Users + + + + + + false + + + + Name + + + + + PGP Id + + + + + + + + + + Add + + + + + + + Remove + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + From c01c0a166f92f091d18fed2de7b56e0c5b6aa269 Mon Sep 17 00:00:00 2001 From: jolavillette Date: Wed, 18 Feb 2026 21:18:43 +0100 Subject: [PATCH 2/3] implement auto-deny when a PGP ID is marked as ignored --- retroshare-gui/src/gui/feeds/SecurityItem.cpp | 3 +++ retroshare-gui/src/gui/settings/NotifyPage.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/retroshare-gui/src/gui/feeds/SecurityItem.cpp b/retroshare-gui/src/gui/feeds/SecurityItem.cpp index c877f71a7..f167af1da 100644 --- a/retroshare-gui/src/gui/feeds/SecurityItem.cpp +++ b/retroshare-gui/src/gui/feeds/SecurityItem.cpp @@ -21,6 +21,8 @@ #include #include #include +#include +#include #include "SecurityItem.h" #include "FeedHolder.h" @@ -395,6 +397,7 @@ void SecurityItem::banUser() QMessageBox::Yes|QMessageBox::No); if (reply == QMessageBox::Yes) { AuthSSL::instance().addNotifyDeny(mGpgId, mSslCn); + rsPeers->removeFriend(mGpgId); // Remove this item from the feed as it is now handled removeItem(); } diff --git a/retroshare-gui/src/gui/settings/NotifyPage.cpp b/retroshare-gui/src/gui/settings/NotifyPage.cpp index 9ba8828b7..95d5a5f95 100755 --- a/retroshare-gui/src/gui/settings/NotifyPage.cpp +++ b/retroshare-gui/src/gui/settings/NotifyPage.cpp @@ -508,6 +508,9 @@ void NotifyPage::addIgnoredUser() if(rsPeers && rsPeers->getGPGDetails(id, details)) name = details.name; AuthSSL::instance().addNotifyDeny(id, name); + if(rsPeers) { + rsPeers->removeFriend(id); + } } // Refresh list From 9488388dc91d3f9af28fa98086ea5922adee55c9 Mon Sep 17 00:00:00 2001 From: jolavillette Date: Wed, 18 Feb 2026 22:30:53 +0100 Subject: [PATCH 3/3] restore auto-deny & suppress spam in NewsFeed --- retroshare-gui/src/gui/NewsFeed.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/retroshare-gui/src/gui/NewsFeed.cpp b/retroshare-gui/src/gui/NewsFeed.cpp index ee39a70e4..0d7eb5eee 100644 --- a/retroshare-gui/src/gui/NewsFeed.cpp +++ b/retroshare-gui/src/gui/NewsFeed.cpp @@ -23,6 +23,8 @@ #include "NewsFeed.h" #include "ui_NewsFeed.h" +#include "pqi/authssl.h" + #include #include #include @@ -478,6 +480,13 @@ void NewsFeed::handleSecurityEvent(std::shared_ptr event) return; auto& e(*pe); + + // Check if denied by AuthSSL (backend) + if(AuthSSL::instance().isNotifyDenied(e.mPgpId)) + { + return; + } + RsFeedTypeFlags flags = (RsFeedTypeFlags)Settings->getNewsFeedFlags(); // 1 - treat the case of unknown PeerID