aports/main/dhcpcd-ui/dont-spam.patch
Natanael Copa d099b21d37 main/dhcpcd-ui: backport fix to not spam when connected
prevent spamming notify messages when we are connected
2018-04-20 11:20:11 +00:00

77 lines
2.1 KiB
Diff

From ed60b357213cb8d90e10483e37fa343ddb346a0c Mon Sep 17 00:00:00 2001
From: Roy Marples <roy@marples.name>
Date: Mon, 6 Nov 2017 13:45:47 +0000
Subject: Don't spam the user about new AP's if we're connected already.
---
src/dhcpcd-gtk/main.c | 45 ++++++++++++++++++++++++---------------------
src/dhcpcd-qt/dhcpcd-qt.cpp | 39 +++++++++++++++++++++++----------------
2 files changed, 47 insertions(+), 37 deletions(-)
diff --git a/src/dhcpcd-gtk/main.c b/src/dhcpcd-gtk/main.c
index 00e18d8..6444bf8 100644
--- a/src/dhcpcd-gtk/main.c
+++ b/src/dhcpcd-gtk/main.c
@@ -584,9 +584,8 @@ dhcpcd_wpa_scan_cb(DHCPCD_WPA *wpa, _unused void *data)
DHCPCD_IF *i;
WI_SCAN *w;
DHCPCD_WI_SCAN *scans, *s1, *s2;
- char *txt, *t;
- int lerrno, fd;
const char *msg;
+ int lerrno, fd;
/* This could be a new WPA so watch it */
fd = dhcpcd_wpa_get_fd(wpa);
@@ -621,27 +620,31 @@ dhcpcd_wpa_scan_cb(DHCPCD_WPA *wpa, _unused void *data)
TAILQ_INIT(&w->menus);
TAILQ_INSERT_TAIL(&wi_scans, w, next);
} else {
- txt = NULL;
- msg = N_("New Access Point");
- for (s1 = scans; s1; s1 = s1->next) {
- for (s2 = w->scans; s2; s2 = s2->next)
- if (g_strcmp0(s1->ssid, s2->ssid) == 0)
- break;
- if (s2 == NULL) {
- if (txt == NULL)
- txt = g_strdup(s1->ssid);
- else {
- msg = N_("New Access Points");
- t = g_strconcat(txt, "\n",
- s1->ssid, NULL);
- g_free(txt);
- txt = t;
+ if (!i->up) {
+ char *txt, *t;
+
+ txt = NULL;
+ msg = N_("New Access Point");
+ for (s1 = scans; s1; s1 = s1->next) {
+ for (s2 = w->scans; s2; s2 = s2->next)
+ if (g_strcmp0(s1->ssid, s2->ssid) == 0)
+ break;
+ if (s2 == NULL) {
+ if (txt == NULL)
+ txt = g_strdup(s1->ssid);
+ else {
+ msg = N_("New Access Points");
+ t = g_strconcat(txt, "\n",
+ s1->ssid, NULL);
+ g_free(txt);
+ txt = t;
+ }
}
}
- }
- if (txt) {
- notify(msg, txt, "network-wireless");
- g_free(txt);
+ if (txt) {
+ notify(msg, txt, "network-wireless");
+ g_free(txt);
+ }
}
menu_update_scans(w, scans);
}