From: Ragner Magalhaes Date: Tue, 2 Dec 2008 20:54:26 +0000 (+0000) Subject: Adding function get_types to ProxyInfo class X-Git-Url: http://git.maemo.org/git/?p=python-purple;a=commitdiff_plain;h=ac12b59ff91e972e8f34209ed58a1f7dfa4cb6f5 Adding function get_types to ProxyInfo class Adding function get_types to ProxyInfo class to return all proxy types as string Signed-off-by: Ragner Magalhaes git-svn-id: https://garage.maemo.org/svn/carman/branches/carman-0.7-beta2/python-purple@1370 596f6dd7-e928-0410-a184-9e12fd12cf7e --- diff --git a/proxy.pyx b/proxy.pyx index 54fca86..453922c 100644 --- a/proxy.pyx +++ b/proxy.pyx @@ -56,10 +56,19 @@ cdef class ProxyInfoType: cdef class ProxyInfo: cdef proxy.PurpleProxyInfo *c_proxyinfo + cdef object types def __init__(self): self.c_proxyinfo = NULL + self.types = {"HTTP": proxy.PURPLE_PROXY_HTTP, + "USER_GLOBAL": proxy.PURPLE_PROXY_USE_GLOBAL, + "USE_ENVVAR": proxy.PURPLE_PROXY_USE_ENVVAR, + "SOCKS4": proxy.PURPLE_PROXY_SOCKS4, + "SOCKS5": proxy.PURPLE_PROXY_SOCKS5, + "NONE": proxy.PURPLE_PROXY_NONE} + + def set_type(self, ProxyInfoType type): if self.c_proxyinfo: proxy.c_purple_proxy_info_set_type(self.c_proxyinfo, type.c_type) @@ -80,3 +89,6 @@ cdef class ProxyInfo: if self.c_proxyinfo: proxy.c_purple_proxy_info_set_password(self.c_proxyinfo, password) + def get_types(self): + return self.types.keys() +