Removed ecore necessity from python-purple.
[python-purple] / libpurple / connection.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 cimport glib
21
22 cimport account
23 cimport plugin
24
25 cdef extern from *:
26     ctypedef int size_t
27     ctypedef long int time_t
28
29 cdef extern from "libpurple/connection.h":
30     ctypedef struct PurpleConnection
31
32     ctypedef enum PurpleConnectionFlags:
33         PURPLE_CONNECTION_HTML = 0x0001
34         PURPLE_CONNECTION_NO_BGCOLOR = 0x0002
35         PURPLE_CONNECTION_AUTO_RESP = 0x0004
36         PURPLE_CONNECTION_FORMATTING_WBFO = 0x0008
37         PURPLE_CONNECTION_NO_NEWLINES = 0x0010
38         PURPLE_CONNECTION_NO_FONTSIZE = 0x0020
39         PURPLE_CONNECTION_NO_URLDESC = 0x0040
40         PURPLE_CONNECTION_NO_IMAGES = 0x0080
41         PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY = 0x0100
42
43     ctypedef enum PurpleConnectionState:
44         PURPLE_DISCONNECTED = 0
45         PURPLE_CONNECTED
46         PURPLE_CONNECTING
47
48     ctypedef enum PurpleConnectionError:
49         PURPLE_CONNECTION_ERROR_NETWORK_ERROR = 0
50         PURPLE_CONNECTION_ERROR_INVALID_USERNAME = 1
51         PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED = 2
52         PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE = 3
53         PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT = 4
54         PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR = 5
55         PURPLE_CONNECTION_ERROR_NAME_IN_USE = 6
56         PURPLE_CONNECTION_ERROR_INVALID_SETTINGS = 7
57         PURPLE_CONNECTION_ERROR_CERT_NOT_PROVIDED = 8
58         PURPLE_CONNECTION_ERROR_CERT_UNTRUSTED = 9
59         PURPLE_CONNECTION_ERROR_CERT_EXPIRED = 10
60         PURPLE_CONNECTION_ERROR_CERT_NOT_ACTIVATED = 11
61         PURPLE_CONNECTION_ERROR_CERT_HOSTNAME_MISMATCH = 12
62         PURPLE_CONNECTION_ERROR_CERT_FINGERPRINT_MISMATCH = 13
63         PURPLE_CONNECTION_ERROR_CERT_SELF_SIGNED = 14
64         PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR = 15
65         PURPLE_CONNECTION_ERROR_OTHER_ERROR = 16
66
67     ctypedef struct PurpleConnectionErrorInfo:
68         PurpleConnectionError type
69         char *description
70
71     ctypedef struct PurpleConnectionUiOps:
72         void (*connect_progress) (PurpleConnection *gc, char *text, size_t step, size_t step_count)
73         void (*connected) (PurpleConnection *gc)
74         void (*disconnected) (PurpleConnection *gc)
75         void (*notice) (PurpleConnection *gc, char *text)
76         void (*report_disconnect) (PurpleConnection *gc, char *text)
77         void (*network_connected) ()
78         void (*network_disconnected) ()
79         void (*report_disconnect_reason) (PurpleConnection *gc, PurpleConnectionError reason, char *text)
80
81     ctypedef struct PurpleConnection:
82         plugin.PurplePlugin *prpl
83         PurpleConnectionFlags flags
84         PurpleConnectionState state
85         account.PurpleAccount *account
86         char *password
87         int inpa
88         glib.GSList *buddy_chats
89         void *proto_data
90         char *display_name
91         glib.guint keepalive
92         glib.gboolean wants_to_die
93         glib.guint disconnect_timeout
94         time_t last_received
95
96     # Connection API FIXME
97     void purple_connection_set_state(PurpleConnection *gc, \
98             PurpleConnectionState state)
99     void purple_connection_set_account(PurpleConnection *gc, \
100             account.PurpleAccount *account)
101     void purple_connection_set_display_name(PurpleConnection *gc, char *name)
102     PurpleConnectionState purple_connection_get_state(PurpleConnection *gc)
103     account.PurpleAccount *purple_connection_get_account(PurpleConnection *gc)
104     plugin.PurplePlugin * purple_connection_get_prpl(PurpleConnection *gc)
105     char *purple_connection_get_password(PurpleConnection *gc)
106     char *purple_connection_get_display_name(PurpleConnection *gc)
107     void purple_connection_update_progress(PurpleConnection *gc, char *text, \
108             size_t step, size_t count)
109     void purple_connection_notice(PurpleConnection *gc, char *text)
110     void purple_connection_error(PurpleConnection *gc, char *reason)
111     void purple_connection_error_reason (PurpleConnection *gc, \
112             PurpleConnectionError reason, char *description)
113     #void purple_connection_ssl_error (PurpleConnection *gc, \
114             #PurpleSslErrorType ssl_error)
115     glib.gboolean purple_connection_error_is_fatal ( \
116             PurpleConnectionError reason)
117
118     # Connections API
119     void purple_connections_disconnect_all()
120     glib.GList *purple_connections_get_all()
121     glib.GList *purple_connections_get_connecting()
122
123     # UI Registration Functions
124     void purple_connections_set_ui_ops(PurpleConnectionUiOps *ops)
125     PurpleConnectionUiOps *purple_connections_get_ui_ops()
126
127     # Connections Subsystem
128     void purple_connections_init()
129     void purple_connections_uninit()
130     void *purple_connections_get_handle()