Commit d069d479 authored by Zeeshan Ali's avatar Zeeshan Ali

wifi: Refactor code to check if AP should be ignored

https://bugs.freedesktop.org/show_bug.cgi?id=74288
parent 87d1093a
......@@ -135,18 +135,11 @@ on_ap_strength_notify (GObject *gobject,
on_ap_added (wifi->priv->wifi_device, ap, user_data);
}
static void
on_ap_added (NMDeviceWifi *device,
NMAccessPoint *ap,
gpointer user_data)
static gboolean
should_ignore_ap (NMAccessPoint *ap)
{
GClueWifi *wifi = GCLUE_WIFI (user_data);
const GByteArray *ssid;
if (wifi->priv->refresh_timeout != 0)
return;
g_debug ("WiFi AP '%s' added.", nm_access_point_get_bssid (ap));
ssid = nm_access_point_get_ssid (ap);
if (ssid->len >= 6 &&
ssid->data[ssid->len - 1] == 'p' &&
......@@ -158,9 +151,26 @@ on_ap_added (NMDeviceWifi *device,
g_debug ("WiFi AP '%s' has '_nomap' suffix in its SSID."
", Ignoring..",
nm_access_point_get_bssid (ap));
return;
return TRUE;
}
return FALSE;
}
static void
on_ap_added (NMDeviceWifi *device,
NMAccessPoint *ap,
gpointer user_data)
{
GClueWifi *wifi = GCLUE_WIFI (user_data);
if (wifi->priv->refresh_timeout != 0)
return;
g_debug ("WiFi AP '%s' added.", nm_access_point_get_bssid (ap));
if (should_ignore_ap (ap))
return;
if (nm_access_point_get_strength (ap) <= 20) {
g_debug ("WiFi AP '%s' has very low strength (%u)"
", ignoring for now..",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment