# Disconnect so that live files are not being modified if isVPNConnected(): resetVPNConnections(addon) # Select the provider provider_list = [] for provider in providers: if usesUserKeys(provider): provider_list.append(getVPNDisplay(provider)) provider_list.sort() index = xbmcgui.Dialog().select("Select VPN provider", provider_list) provider_display = provider_list[index] provider = getVPNLocation(provider_display) # Get the key/cert pairs for that provider and offer up for deletion user_keys = getUserKeys(provider) user_certs = getUserCerts(provider) if len(user_keys) > 0 or len(user_certs) > 0: still_deleting = True while still_deleting: if len(user_keys) > 0 or len(user_certs) > 0: # Build a list of things to display. We should always have pairs, but if # something didn't copy or the user has messed with the dir this will cope all_user = [] single_pair = "user [I](Same key and certificate used for all connections)[/I]" for key in user_keys: list_item = os.path.basename(key) list_item = list_item.replace(".key", "") if list_item == "user": list_item = single_pair all_user.append(list_item) for cert in user_certs:
# Reset the connection before we do anything else if isVPNConnected(): resetVPNConnections(addon) # Select the provider provider_list = [] for provider in providers: if usesUserKeys(provider): provider_list.append(getVPNDisplay(provider)) provider_list.sort() index = xbmcgui.Dialog().select("Select VPN provider", provider_list) provider_display = provider_list[index] provider = getVPNLocation(provider_display) # Get the key/cert pairs for that provider and offer up for deletion user_keys = getUserKeys(provider) user_certs = getUserCerts(provider) if len(user_keys) > 0 or len(user_certs) > 0: still_deleting = True while still_deleting: if len(user_keys) > 0 or len(user_certs) > 0: # Build a list of things to display. We should always have pairs, but if # something didn't copy or the user has messed with the dir this will cope all_user = [] single_pair = "user [I](Same key and certificate used for all connections)[/I]" for key in user_keys: list_item = os.path.basename(key) list_item = list_item.replace(".key", "") if list_item == "user": list_item = single_pair all_user.append(list_item) for cert in user_certs: