Adding function get_types to ProxyInfo class
[python-purple] / proxy.pyx
index bb03d6d..453922c 100644 (file)
--- a/proxy.pyx
+++ b/proxy.pyx
@@ -17,7 +17,7 @@
 #  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
-cimport proxy
+cimport purple
 
 cdef class ProxyInfoType:
     cdef proxy.PurpleProxyType c_type
@@ -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()
+