+ if (result.identifier == NULL)
+ goto done;
+
+ if (result.identifier[0] == '\0')
+ goto done;
+
+ temp = g_strdup(result.identifier);
+ if (temp == NULL)
+ goto done;
+
+ for (i = 0; i < strlen(temp); i++) {
+ char tmp = temp[i];
+ if ((tmp < '0' || tmp > '9') && (tmp < 'A' || tmp > 'Z') &&
+ (tmp < 'a' || tmp > 'z'))
+ temp[i] = '_';
+ }
+
+ strength = result.quality;
+
+ network = connman_device_get_network(task->device, temp);
+ if (network == NULL) {
+ const char *mode, *security;
+ unsigned char strength;
+
+ network = connman_network_create(temp,
+ CONNMAN_NETWORK_TYPE_WIFI);
+ if (network == NULL)
+ goto done;
+
+ connman_network_set_string(network, "Name", result.identifier);
+
+ connman_network_set_blob(network, "WiFi.SSID",
+ result.ssid, result.ssid_len);