Connect signals
[python-purple] / core / account.pxd
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 cdef extern from "glib.h":
21     ctypedef int gboolean
22
23 cdef extern from "libpurple/account.h":
24     cdef struct _PurpleAccount
25     ctypedef _PurpleAccount PurpleAccount
26
27     PurpleAccount *purple_account_new(const_char_ptr username, const_char_ptr protocol_id)
28     void purple_account_set_password(PurpleAccount *account, const_char_ptr password)
29     void purple_account_set_enabled(PurpleAccount *account, const_char_ptr ui, gboolean value)
30
31 cdef extern from "libpurple/status.h":
32     ctypedef int PurpleStatusPrimitive
33
34     cdef struct _PurpleSavedStatus
35     ctypedef _PurpleSavedStatus PurpleSavedStatus
36
37     PurpleSavedStatus *purple_saved_status_new(const_char_ptr title, PurpleStatusPrimitive type)
38     void purple_saved_status_activate(PurpleSavedStatus *saved_status)
39
40 cdef extern from "libpurple/proxy.h":
41     cdef struct PurpleProxyInfo
42
43     ctypedef int PurpleProxyType
44     PurpleProxyInfo *purple_proxy_info_new()
45     void c_purple_proxy_info_set_type "purple_proxy_info_set_type" (PurpleProxyInfo *info, PurpleProxyType type)
46     void c_purple_proxy_info_set_host "purple_proxy_info_set_host" (const_char_ptr host)
47     void c_purple_proxy_info_set_port "purple_proxy_info_set_port" (const_char_ptr port)
48
49
50 class ProxyType:
51     def __init__(self):
52         self.PROXY_USE_GLOBAL = -1
53         self.PROXY_NONE = 0
54         self.PROXY_HTTP = 1
55         self.PROXY_SOCKS4 = 2
56         self.PROXY_SOCKS5 = 3
57         self.PROXY_USE_ENVVAR = 4
58
59
60 class StatusPrimitive:
61     def __init__(self):
62         self.STAUTS_UNSET = 0
63         self.STATUS_OFFLINE = 1
64         self.STATUS_AVAILABLE = 2
65         self.STATUS_UNAVAILABLE = 3
66         self.STATUS_INVISIBLE = 4
67         self.STATUS_AWAY = 5
68         self.STATUS_EXTENDED_AWAY = 6
69         self.STATUS_MOBILE = 7
70         self.STATUS_TUNE = 8
71         self.STATUS_NUN_PRIMITIVE = 9
72
73 cdef class Account:
74     """ Account class """
75     cdef PurpleAccount *__account
76
77     def __cinit__(self, const_char_ptr username, const_char_ptr protocol_id):
78         self.__account = purple_account_new(username, protocol_id)
79         """FIXME: Check status implementation"""
80 #        self.__sstatus = purple_saved_status_new("on-line", StatusPrimitive().STATUS_AVAILABLE)
81 #        purple_saved_status_activate(self.__sstatus)
82
83     def set_password(self, password):
84         purple_account_set_password(self.__account, password)
85
86     def set_enabled(self, ui, value):
87         purple_account_set_enabled(self.__account, ui, value)