def changeConnection(): # Connect, or display status if we're already using selected VPN profile # If there is no profile, then skip this as the user has selected something non-selectable debugTrace("Changing connection to " + params + " from " + getVPNProfile() + ", connected:" + str(isVPNConnected())) addon = xbmcaddon.Addon(getID()) ignore = False user_text = "" vpn_provider = addon.getSetting("vpn_provider") if isAlternative(vpn_provider): # Convert the friendly name to a file name, or an error message _, ovpn_connection, user_text, ignore = getAlternativeLocation( vpn_provider, params, 0, True) else: # Just extract the ovpn name from the URL for regular providers ovpn_connection = params # Try and connect if we've got a connection name. If we're already connection, display the status if not ignore: if not user_text == "": xbmcgui.Dialog().ok(addon_name, user_text) elif isVPNConnected() and ovpn_connection == getVPNProfile( ) and not allowReconnection(vpn_provider) and not addon.getSetting( "allow_cycle_reconnect") == "true": displayStatus() else: connectVPN("0", ovpn_connection) return
def changeConnection(): # Connect, or display status if we're already using selected VPN profile debugTrace("Changing connection to " + params + " from " + getVPNProfile() + ", connected:" + str(isVPNConnected())) if isVPNConnected() and params == getVPNProfile(): displayStatus() else: connectVPN("0", params) return
def changeConnection(): # Connect, or display status if we're already using selected VPN profile debugTrace("Changing connection to " + params + " from " + getVPNProfile() + ", connected:" + str(isVPNConnected())) if isVPNConnected() and params == getVPNProfile(): displayStatus() else: connectVPN("0", params) return
def changeConnection(): # Connect, or display status if we're already using selected VPN profile debugTrace("Changing connection to " + params + " from " + getVPNProfile() + ", connected:" + str(isVPNConnected())) if isVPNConnected() and params == getVPNProfile() and not isAlternative( addon.getSetting("vpn_provider")) and not addon.getSetting( "allow_cycle_reconnect") == "true": displayStatus() else: connectVPN("0", params) return
def changeConnection(): xbmc.executebuiltin("ActivateWindow(busydialog)") # Connect, or display status if we're already using selected VPN profile debugTrace("Changing connection to " + params + " from " + getVPNProfile() + ", connected:" + str(isVPNConnected())) if isVPNConnected() and params == getVPNProfile(): displayStatus() else: disconnectVPN2() connectVPN("1", params) xbmc.executebuiltin("Dialog.Close(busydialog)") return
addon_name = addon.getAddonInfo("name") # Get the first argument which will indicate the connection that's being dealt with connection_order = sys.argv[1] debugTrace("Entered connect.py with parameter " + connection_order) # If a new connection is being validated, check everything needed is entered vpn_provider = addon.getSetting("vpn_provider") vpn_username = addon.getSetting("vpn_username") vpn_password = addon.getSetting("vpn_password") if xbmcvfs.exists( getUserDataPath(getVPNLocation(vpn_provider) + "/DEFAULT.txt")): vpn_username = "******" vpn_password = "******" if not usesPassAuth(getVPNLocation(vpn_provider)) or ( not vpn_username == "" and not vpn_provider == ""): connectVPN(str(connection_order), "") else: xbmcgui.Dialog().ok( addon_name, "Please enter a user name and password. " + vpn_provider + " requires them for authentication.") # Finally return to the settings screen if that's where we came from if connection_order > 0: xbmc.executebuiltin("Addon.OpenSettings(service.vpn.manager)") debugTrace("Exit connect.py")
from libs.platform import getAddonPath addon = xbmcaddon.Addon("service.vpn.manager") addon_name = addon.getAddonInfo("name") # Get the first argument which will indicate the connection that's being dealt with connection_order = sys.argv[1] debugTrace("Entered connect.py with parameter " + connection_order) # If a new connection is being validated, check everything needed is entered vpn_provider = addon.getSetting("vpn_provider") vpn_username = addon.getSetting("vpn_username") vpn_password = addon.getSetting("vpn_password") if xbmcvfs.exists(getUserDataPath(getVPNLocation(vpn_provider) + "/DEFAULT.txt")): vpn_username = "******" vpn_password = "******" if not usesPassAuth(vpn_provider) or (not vpn_username == "" and not vpn_provider == ""): connectVPN(str(connection_order), "") else: xbmcgui.Dialog().ok(addon_name, "Please enter a user name and password. " + vpn_provider + " requires them for authentication.") # Finally return to the settings screen if that's where we came from if connection_order > 0: xbmc.executebuiltin("Addon.OpenSettings(service.vpn.manager)") debugTrace("Exit connect.py")