bool Account::operator<( const Account &other ) const { #if QT_VERSION >= 0x040500 int compare = m_login.localeAwareCompare( other.login() ); #else int compare = m_login.compare( other.login() ); #endif if ( compare != 0 ) return compare < 0; return networkName( m_serviceUrl ) < networkName( other.serviceUrl() ); }
QString NetworkItem::toolTip(int column) const { Q_UNUSED(column); #if QT_VERSION < 0x050000 QStringList toolTip(QString("<b>%1</b>").arg(Qt::escape(networkName()))); toolTip.append(tr("Server: %1").arg(Qt::escape(currentServer()))); #else QStringList toolTip(QString("<b>%1</b>").arg(networkName().toHtmlEscaped())); toolTip.append(tr("Server: %1").arg(currentServer().toHtmlEscaped())); #endif toolTip.append(tr("Users: %1").arg(nickCount())); if (_network) { toolTip.append(tr("Lag: %1 msecs").arg(_network->latency())); } return QString("<p> %1 </p>").arg(toolTip.join("<br />")); }
QString Account::toString() const { return QString( "%1 @ %2" ).arg( m_login, networkName( m_serviceUrl ) ); }
void WPASupplicantApp::_SuccessfullyJoined(const wpa_supplicant *interface, const BMessage &joinRequest) { // We successfully connected with this configuration, store the config, // if requested, by adding a persistent network on the network device. if (!joinRequest.FindBool("persistent")) return; wpa_ssid *networkConfig = interface->current_ssid; if (networkConfig == NULL) return; wireless_network network; memset(network.name, 0, sizeof(network.name)); memcpy(network.name, networkConfig->ssid, min_c(sizeof(network.name), networkConfig->ssid_len)); //network.address.SetToLinkLevel((uint8 *)interface->bssid, ETH_ALEN); // TODO: Decide if we want to do this, it limits the network to // a specific base station instead of a "service set" that might // consist of more than one base station. On the other hand it makes // the network unique so the right one is connected in case of name // conflicts. It should probably be used as a hint, as in "preferred" // base station. if (joinRequest.FindUInt32("authentication", &network.authentication_mode) != B_OK) { return; } if (network.authentication_mode > B_NETWORK_AUTHENTICATION_NONE) { const char *password = NULL; if (joinRequest.FindString("password", &password) != B_OK) return; BString networkName(network.name, sizeof(network.name)); BPasswordKey key(password, B_KEY_PURPOSE_NETWORK, networkName); BKeyStore keyStore; keyStore.AddKeyring(kWPASupplicantKeyring); keyStore.AddKey(kWPASupplicantKeyring, key); } switch (interface->pairwise_cipher) { case WPA_CIPHER_NONE: network.cipher = B_NETWORK_CIPHER_NONE; break; case WPA_CIPHER_TKIP: network.cipher = B_NETWORK_CIPHER_TKIP; break; case WPA_CIPHER_CCMP: network.cipher = B_NETWORK_CIPHER_CCMP; break; } switch (interface->group_cipher) { case WPA_CIPHER_NONE: network.group_cipher = B_NETWORK_CIPHER_NONE; break; case WPA_CIPHER_WEP40: network.group_cipher = B_NETWORK_CIPHER_WEP_40; break; case WPA_CIPHER_WEP104: network.group_cipher = B_NETWORK_CIPHER_WEP_104; break; case WPA_CIPHER_TKIP: network.group_cipher = B_NETWORK_CIPHER_TKIP; break; case WPA_CIPHER_CCMP: network.group_cipher = B_NETWORK_CIPHER_CCMP; break; } switch (interface->key_mgmt) { case WPA_KEY_MGMT_IEEE8021X: network.key_mode = B_KEY_MODE_IEEE802_1X; break; case WPA_KEY_MGMT_PSK: network.key_mode = B_KEY_MODE_PSK; break; case WPA_KEY_MGMT_NONE: network.key_mode = B_KEY_MODE_NONE; break; case WPA_KEY_MGMT_FT_IEEE8021X: network.key_mode = B_KEY_MODE_FT_IEEE802_1X; break; case WPA_KEY_MGMT_FT_PSK: network.key_mode = B_KEY_MODE_FT_PSK; break; case WPA_KEY_MGMT_IEEE8021X_SHA256: network.key_mode = B_KEY_MODE_IEEE802_1X_SHA256; break; case WPA_KEY_MGMT_PSK_SHA256: network.key_mode = B_KEY_MODE_PSK_SHA256; break; } BNetworkRoster::Default().AddPersistentNetwork(network); }