1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
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);
}
|