Initial 'dev' branch commit.
[python-purple] / libpurple / blist.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 buddyicon
24
25 cdef extern from *:
26     ctypedef char const_char "const char"
27
28 # hack to avoid recursive loops by cython
29 cdef extern from "libpurple/status.h":
30     ctypedef struct PurplePresence:
31         pass
32
33 cdef extern from "libpurple/blist.h":
34     ctypedef struct PurpleBuddyList
35     ctypedef struct PurpleBlistUiOps
36     ctypedef struct PurpleBlistNode
37     ctypedef struct PurpleChat
38     ctypedef struct PurpleGroup
39     ctypedef struct PurpleContact
40     ctypedef struct PurpleBuddy
41
42     ctypedef enum PurpleBlistNodeType:
43         PURPLE_BLIST_GROUP_NODE
44         PURPLE_BLIST_CONTACT_NODE
45         PURPLE_BLIST_BUDDY_NODE
46         PURPLE_BLIST_CHAT_NODE
47         PURPLE_BLIST_OTHER_NODE
48
49     ctypedef enum PurpleBlistNodeFlags:
50         PURPLE_BLIST_NODE_FLAG_NO_SAVE = 1 << 0
51
52     ctypedef struct PurpleBlistNode:
53         PurpleBlistNodeType type
54         PurpleBlistNode *prev
55         PurpleBlistNode *next
56         PurpleBlistNode *parent
57         PurpleBlistNode *child
58         glib.GHashTable *settings
59         void *ui_data
60         PurpleBlistNodeFlags flags
61
62     ctypedef struct PurpleBuddy:
63         char *name
64         char *alias
65         char *server_alias
66         void *proto_data
67         buddyicon.PurpleBuddyIcon *icon
68         account.PurpleAccount *account
69         PurplePresence *presence
70
71     ctypedef struct PurpleContact:
72         PurpleBlistNode node
73         char *alias
74         int totalsize
75         int currentsize
76         int online
77         PurpleBuddy *priority
78         glib.gboolean priority_valid
79
80     ctypedef struct PurpleGroup:
81         PurpleBlistNode node
82         char *name
83         int totalsize
84         int currentsize
85         int online
86
87     ctypedef struct PurpleChat:
88         PurpleBlistNode node
89         char *alias
90         glib.GHashTable *components
91         account.PurpleAccount *account
92
93     ctypedef struct PurpleBuddyList:
94         PurpleBlistNode *root
95         glib.GHashTable *buddies
96         void *ui_data
97
98     ctypedef struct PurpleBlistUiOps:
99         void (*new_list) (PurpleBuddyList *list)
100         void (*new_node) (PurpleBlistNode *node)
101         void (*show) (PurpleBuddyList *list)
102         void (*update) (PurpleBuddyList *list, PurpleBlistNode *node)
103         void (*remove) (PurpleBuddyList *list, PurpleBlistNode *node)
104         void (*destroy) (PurpleBuddyList *list)
105         void (*set_visible) (PurpleBuddyList *list, glib.gboolean show)
106         void (*request_add_buddy) (account.PurpleAccount *account, const_char *username, const_char *group, const_char *alias)
107         void (*request_add_chat) (account.PurpleAccount *account, PurpleGroup *group, const_char *alias, const_char *name)
108         void (*request_add_group) ()
109
110     void *c_purple_blist_get_handle "purple_blist_get_handle" ()
111     void c_purple_blist_load "purple_blist_load" ()
112     PurpleBuddyList* c_purple_blist_new "purple_blist_new" ()
113     PurpleBlistNodeType c_purple_blist_node_get_type \
114             "purple_blist_node_get_type" (PurpleBlistNode *node)
115     int c_purple_blist_get_group_size "purple_blist_get_group_size" \
116             (PurpleGroup *group, glib.gboolean offline)
117     int c_purple_blist_get_group_online_count \
118             "purple_blist_get_group_online_count" (PurpleGroup *group)
119     void c_purple_blist_set_ui_ops "purple_blist_set_ui_ops" (PurpleBlistUiOps *ops)
120     const_char *c_purple_chat_get_name "purple_chat_get_name" (PurpleChat *chat)
121     const_char *c_purple_contact_get_alias "purple_contact_get_alias" (PurpleContact *contact)
122     const_char *c_purple_group_get_name "purple_group_get_name" (PurpleGroup *group)
123     PurpleBuddy *c_purple_buddy_new "purple_buddy_new" (account.PurpleAccount *account,
124             char *screenname, char *alias)
125     const_char *c_purple_buddy_get_alias_only "purple_buddy_get_alias_only" (PurpleBuddy *buddy)
126     const_char *c_purple_buddy_get_name "purple_buddy_get_name" (PurpleBuddy *buddy)
127     PurpleBuddy *c_purple_find_buddy "purple_find_buddy" (account.PurpleAccount *account, char *name)
128     void c_purple_set_blist "purple_set_blist" (PurpleBuddyList *list)
129     glib.GSList *c_purple_find_buddies "purple_find_buddies" (account.PurpleAccount *account, char *name)
130     account.PurpleAccount *c_purple_buddy_get_account "purple_buddy_get_account" (PurpleBuddy *buddy)
131     PurplePresence *c_purple_buddy_get_presence "purple_buddy_get_presence" (PurpleBuddy *buddy)