Fixed accounts.pxd recursive call from other .pxd files.
[python-purple] / proxy.pyx
1 #
2 #  Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia
3 #
4 #  This file is part of python-purple.
5 #
6 #  python-purple is free software: you can redistribute it and/or modify
7 #  it under the terms of the GNU General Public License as published by
8 #  the Free Software Foundation, either version 3 of the License, or
9 #  (at your option) any later version.
10 #
11 #  python-purple is distributed in the hope that it will be useful,
12 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 #  GNU General Public License for more details.
15 #
16 #  You should have received a copy of the GNU General Public License
17 #  along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 #
19
20 cimport proxy
21
22 cdef class ProxyInfoType:
23
24     cdef proxy.PurpleProxyType c_proxyinfotype
25
26     def __init__(self):
27         self.c_proxyinfotype = proxy.PURPLE_PROXY_NONE
28
29     def USE_GLOBAL(self):
30         self.c_proxyinfotype = proxy.PURPLE_PROXY_USE_GLOBAL
31         return self
32
33     def HTTP(self):
34         self.c_proxyinfotype = proxy.PURPLE_PROXY_HTTP
35         return self
36
37     def SOCKS4(self):
38         self.c_proxyinfotype = proxy.PURPLE_PROXY_SOCKS4
39         return self
40
41     def SOCKS5(self):
42         self.c_proxyinfotype = proxy.PURPLE_PROXY_SOCKS5
43         return self
44
45     def USE_ENVVAR(self):
46         self.c_proxyinfotype = proxy.PURPLE_PROXY_USE_ENVVAR
47         return self
48
49 cdef class ProxyInfo:
50
51     cdef proxy.PurpleProxyInfo *c_proxyinfo
52
53     def __init__(self):
54         self.c_proxyinfo = NULL
55
56     def cnew(self):
57         if self.c_proxyinfo == NULL:
58             self.c_proxyinfo = proxy.c_purple_proxy_info_new()
59
60     def set_type(self, ProxyInfoType type):
61         if self.c_proxyinfo:
62             proxy.c_purple_proxy_info_set_type(self.c_proxyinfo, type.c_proxyinfotype)
63
64     def set_host(self, char *host):
65         if self.c_proxyinfo:
66             proxy.c_purple_proxy_info_set_host(self.c_proxyinfo, host)
67
68     def set_port(self, int port):
69         if self.c_proxyinfo:
70             proxy.c_purple_proxy_info_set_port(self.c_proxyinfo, port)
71
72     def set_username(self, char *username):
73         if self.c_proxyinfo:
74             proxy.c_purple_proxy_info_set_username(self.c_proxyinfo, username)
75
76     def set_password(self, char *password):
77         if self.c_proxyinfo:
78             proxy.c_purple_proxy_info_set_password(self.c_proxyinfo, password)
79