c45858f96900c1542ec5c9ae6064733785bba325
[python-purple] / purple.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 include "glib.pxd"
21
22 cdef extern from *:
23     ctypedef char* const_char_ptr "const char *"
24
25 cdef extern from "time.h":
26     ctypedef long int time_t
27
28 cdef extern from "libpurple/debug.h":
29     void c_purple_debug_set_enabled "purple_debug_set_enabled" (gboolean debug_enabled)
30
31 cdef extern from "libpurple/plugin.h":
32     void c_purple_plugins_add_search_path "purple_plugins_add_search_path" (const_char_ptr path)
33
34 cdef extern from "libpurple/util.h":
35     void c_purple_util_set_user_dir "purple_util_set_user_dir" (char *dir)
36
37 cdef extern from "c_purple.h":
38      void init_libpurple(const_char_ptr ui_id)
39
40 class Purple(object):
41     def __init__(self):
42         self.DEFAULT_PATH = "/home/user/MyDocs/Carman"
43         self.APP_NAME = "carman-purple-python"
44
45         self.debug_set_enabled(True)
46         self.util_set_user_dir(self.DEFAULT_PATH)
47         self.plugin_add_search_path(self.DEFAULT_PATH)
48
49         init_libpurple(self.APP_NAME)
50     # __init__
51
52     def debug_set_enabled(self, debug_enabled):
53         c_purple_debug_set_enabled(debug_enabled)
54     # debug_set_enabled
55
56     def plugin_add_search_path(self, path):
57         c_purple_plugins_add_search_path(path)
58     # plugin_add_search_path
59
60     def util_set_user_dir(self, dir):
61         c_purple_util_set_user_dir(dir)
62     # util_set_user_dir
63
64 #include "core/account.pxd"
65 #include "core/blist.pxd"
66 #include "core/connection.pxd"
67 #include "core/core.pxd"
68 #include "core/eventloop.pxd"
69 #include "core/idle.pxd"
70 #include "core/pounce.pxd"
71 #include "core/prefs.pxd"