Adding function get_all to Account
[python-purple] / proxy.pyx
index b52a0c9..54fca86 100644 (file)
--- a/proxy.pyx
+++ b/proxy.pyx
 #  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
 #  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
-cimport proxy
+cimport purple
 
 cdef class ProxyInfoType:
 
 cdef class ProxyInfoType:
-
-    cdef proxy.PurpleProxyType c_proxyinfotype
+    cdef proxy.PurpleProxyType c_type
 
     def __init__(self):
 
     def __init__(self):
-        self.c_proxyinfotype = proxy.PURPLE_PROXY_NONE
+        self.c_type = proxy.PURPLE_PROXY_NONE
+
+    def get_NONE(self):
+        self.c_type = proxy.PURPLE_PROXY_NONE
+        return self
+    NONE = property(get_NONE)
 
 
-    def USE_GLOBAL(self):
-        self.c_proxyinfotype = proxy.PURPLE_PROXY_USE_GLOBAL
+    def get_USE_GLOBAL(self):
+        self.c_type = proxy.PURPLE_PROXY_USE_GLOBAL
         return self
         return self
+    USE_GLOBAL = property(get_USE_GLOBAL)
 
 
-    def HTTP(self):
-        self.c_proxyinfotype = proxy.PURPLE_PROXY_HTTP
+    def get_HTTP(self):
+        self.c_type = proxy.PURPLE_PROXY_HTTP
         return self
         return self
+    HTTP = property(get_HTTP)
 
 
-    def SOCKS4(self):
-        self.c_proxyinfotype = proxy.PURPLE_PROXY_SOCKS4
+    def get_SOCKS4(self):
+        self.c_type = proxy.PURPLE_PROXY_SOCKS4
         return self
 
         return self
 
-    def SOCKS5(self):
-        self.c_proxyinfotype = proxy.PURPLE_PROXY_SOCKS5
+    def get_SOCKS5(self):
+        self.c_type = proxy.PURPLE_PROXY_SOCKS5
         return self
 
         return self
 
-    def USE_ENVVAR(self):
-        self.c_proxyinfotype = proxy.PURPLE_PROXY_USE_ENVVAR
+    def get_USE_ENVVAR (self):
+        self.c_type = proxy.PURPLE_PROXY_USE_ENVVAR
         return self
         return self
+    USE_ENVVAR = property(get_USE_ENVVAR)
 
 cdef class ProxyInfo:
 
 
 cdef class ProxyInfo:
 
@@ -53,13 +60,9 @@ cdef class ProxyInfo:
     def __init__(self):
         self.c_proxyinfo = NULL
 
     def __init__(self):
         self.c_proxyinfo = NULL
 
-    def cnew(self):
-        if self.c_proxyinfo == NULL:
-            self.c_proxyinfo = proxy.c_purple_proxy_info_new()
-
     def set_type(self, ProxyInfoType type):
         if self.c_proxyinfo:
     def set_type(self, ProxyInfoType type):
         if self.c_proxyinfo:
-            proxy.c_purple_proxy_info_set_type(self.c_proxyinfo, type.c_proxyinfotype)
+            proxy.c_purple_proxy_info_set_type(self.c_proxyinfo, type.c_type)
 
     def set_host(self, char *host):
         if self.c_proxyinfo:
 
     def set_host(self, char *host):
         if self.c_proxyinfo: