From: Ragner Magalhaes Date: Tue, 2 Dec 2008 20:04:04 +0000 (+0000) Subject: Update: Removed deprecated python-libpurple folder (to avoid mistakes), created class... X-Git-Url: http://git.maemo.org/git/?p=python-purple;a=commitdiff_plain;h=b3a2eb6281cdcd9743c29ecbdb58d906c2f8be19 Update: Removed deprecated python-libpurple folder (to avoid mistakes), created classes for all current .pxd files. FIXES: * Removed deprecated python-libpurple/ folder, to avoid mistakes. * Created classes for all current .pxd files. * Fixed correct .pxd call from inside purple.pyx. * Fixed "const char *" calls (vide http://wiki.cython.org/FAQ#head-af019db12f683abe6bc226926e8a2a92425b8e57 ). Signed-off-by: Bruno Abinader git-svn-id: https://garage.maemo.org/svn/carman/branches/carman-0.7-beta2/python-purple@1263 596f6dd7-e928-0410-a184-9e12fd12cf7e --- diff --git a/core/account.pxd b/core/account.pxd index 03b8333..50830e5 100644 --- a/core/account.pxd +++ b/core/account.pxd @@ -1,21 +1,43 @@ -ctypedef enum gboolean: - FALSE, TRUE +# +# Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia +# +# This file is part of python-purple. +# +# python-purple is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# python-purple is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# cdef extern from "libpurple/account.h": ctypedef struct PurpleAccount - cdef PurpleAccount *purple_account_new(char *username, char *protocol_id) + cdef PurpleAccount* c_purple_account_new "purple_account_new" (const_char_ptr username, const_char_ptr protocol_id) + cdef void c_purple_account_set_password "purple_account_set_password" (PurpleAccount *account, const_char_ptr password) + cdef void c_purple_account_set_enabled "purple_account_set_enabled" (PurpleAccount *account, const_char_ptr ui, gboolean value) - cdef void purple_account_set_password(PurpleAccount *account, - char *password) +class Account(object): + """ Account class """ - cdef void purple_account_set_enabled(PurpleAccount *account, char *ui, - gboolean value) - -cdef extern from "libpurple/connection.h": - ctypedef struct PurpleConnection - - cdef PurpleAccount *purple_connection_get_account(PurpleConnection *gc) + def __init__(self): + purple_account = None + # FIXME + """ + def purple_account_new(self, user_name, protocol_id): + return c_purple_account_new(user_name, protocol_id) + def purple_account_set_password(self, account, password): + c_purple_account_set_password(account, password) + def purple_account_set_enabled(self, account, ui, value): + c_purple_account_set_enabled(account, ui, value) + """ diff --git a/core/blist.pxd b/core/blist.pxd index 03e60c0..4e37f7f 100644 --- a/core/blist.pxd +++ b/core/blist.pxd @@ -1,6 +1,43 @@ +# +# Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia +# +# This file is part of python-purple. +# +# python-purple is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# python-purple is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + cdef extern from "libpurple/blist.h": ctypedef struct PurpleBuddyList - cdef void purple_set_blist(PurpleBuddyList *list) - cdef void purple_blist_load() - cdef PurpleBuddyList *purple_blist_new() + cdef void c_purple_set_blist "purple_set_blist" (PurpleBuddyList *list) + cdef void c_purple_blist_load "purple_blist_load" () + cdef PurpleBuddyList* purple_blist_new "purple_blist_new" () + +class BList(object): + """ BList class """ + + def __init__(self): + purple_buddy_list = None + + # FIXME + """ + def purple_set_blist(self, list): + c_purple_set_blist(list) + + def purple_blist_load(self): + c_purple_blist_load() + + def purple_blist_new(self): + return c_purple_blist_new() + """ diff --git a/core/core.pxd b/core/core.pxd index 6048e33..cec0e1a 100644 --- a/core/core.pxd +++ b/core/core.pxd @@ -1,6 +1,47 @@ +# +# Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia +# +# This file is part of python-purple. +# +# python-purple is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# python-purple is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + cdef extern from "libpurple/core.h": ctypedef struct PurpleCoreUiOps - cdef gboolean purple_core_init(char *ui) - cdef gboolean purple_core_migrate() - cdef void purple_core_set_ui_ops(PurpleCoreUiOps *ops) + cdef gboolean c_purple_core_init "purple_core_init" (const_char_ptr ui) + cdef void c_purple_core_quit "purple_core_quit" () + cdef gboolean c_purple_core_migrate "purple_core_migrate" () + cdef void c_purple_core_set_ui_ops "purple_core_set_ui_ops" (PurpleCoreUiOps *ops) + +class Core(object): + """ Core class """ + + def __init__(self): + purple_core_ui_ops = None + + def purple_core_init(self, ui_name): + return c_purple_core_init(ui_name) + + def purple_core_quit(self): + c_purple_core_quit() + + def purple_core_migrate(self): + return c_purple_core_migrate() + + # FIXME + """ + def purple_core_set_ui_ops(ui_ops): + c_purple_core_set_ui_ops(ui_ops) + """ diff --git a/core/debug.pxd b/core/debug.pxd index e6be240..e6d631b 100644 --- a/core/debug.pxd +++ b/core/debug.pxd @@ -1,2 +1,30 @@ +# +# Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia +# +# This file is part of python-purple. +# +# python-purple is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# python-purple is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + cdef extern from "libpurple/debug.h": - cdef void purple_debug_set_enabled(gboolean debug_enabled) + cdef void c_purple_debug_set_enabled "purple_debug_set_enabled" (gboolean debug_enabled) + +class Debug(object): + """ Debug class """ + + def __init__(self): + pass + + def purple_debug_set_enabled(self, debug_enabled): + c_purple_debug_set_enabled(debug_enabled) diff --git a/core/eventloop.pxd b/core/eventloop.pxd index 09cf3c8..c508b75 100644 --- a/core/eventloop.pxd +++ b/core/eventloop.pxd @@ -1,4 +1,35 @@ +# +# Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia +# +# This file is part of python-purple. +# +# python-purple is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# python-purple is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + cdef extern from "libpurple/eventloop.h": ctypedef struct PurpleEventLoopUiOps - cdef void purple_eventloop_set_ui_ops(PurpleEventLoopUiOps *ops) + cdef void c_purple_eventloop_set_ui_ops "purple_eventloop_set_ui_ops" (PurpleEventLoopUiOps *ops) + +class EventLoop(object): + """ EventLoop class """ + + def __init__(self): + purple_eventloop_ui_ops = None + + # FIXME + """ + def purple_eventloop_set_ui_ops(ops): + c_purple_eventloop_set_ui_ops(ops) + """ diff --git a/core/idle.pxd b/core/idle.pxd index 14963c2..fa33e2d 100644 --- a/core/idle.pxd +++ b/core/idle.pxd @@ -1,4 +1,35 @@ +# +# Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia +# +# This file is part of python-purple. +# +# python-purple is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# python-purple is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + cdef extern from "libpurple/idle.h": ctypedef struct PurpleIdleUiOps - cdef void purple_idle_set_ui_ops(PurpleIdleUiOps *ops) + cdef void c_purple_idle_set_ui_ops "purple_idle_set_ui_ops" (PurpleIdleUiOps *ops) + +class Idle(object): + """ Idle class """ + + def __init__(self): + purple_idle_ui_ops = None + + # FIXME + """ + def purple_idle_set_ui_ops(ops) + c_purple_idle_set_ui_ops(ops) + """ diff --git a/core/plugin.pxd b/core/plugin.pxd index 29905ba..aa8489d 100644 --- a/core/plugin.pxd +++ b/core/plugin.pxd @@ -1,3 +1,43 @@ +# +# Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia +# +# This file is part of python-purple. +# +# python-purple is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# python-purple is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + cdef extern from "libpurple/plugin.h": - cdef void purple_plugins_add_search_path(char *path) - cdef void purple_plugins_load_saved(char *key) + ctypedef struct PurplePlugin + + cdef void c_purple_plugins_add_search_path "purple_plugins_add_search_path" (const_char_ptr path) + cdef void c_purple_plugins_load_saved "purple_plugins_load_saved" (const_char_ptr key) + cdef gboolean c_purple_plugin_register "purple_plugin_register" (PurplePlugin *plugin) + +class Plugin(object): + """ Plugin class """ + + def __init__(self): + purple_plugin = None + + def purple_plugins_add_search_path(path): + c_purple_plugins_add_search_path(path) + + def purple_plugins_load_saved(key): + c_purple_plugins_load_saved(key) + + # FIXME + """ + def purple_plugin_register(plugin): + return c_purple_plugin_register(plugin) + """ diff --git a/core/pounce.pxd b/core/pounce.pxd index a652934..bd99f24 100644 --- a/core/pounce.pxd +++ b/core/pounce.pxd @@ -1,2 +1,30 @@ +# +# Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia +# +# This file is part of python-purple. +# +# python-purple is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# python-purple is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + cdef extern from "libpurple/pounce.h": - cdef gboolean purple_pounces_load() + cdef gboolean c_purple_pounces_load "purple_pounces_load" () + +class Pounce(object): + """ Pounce class """ + + def __init__(self): + pass + + def purple_pounces_load(): + return c_purple_pounces_load() diff --git a/core/prefs.pxd b/core/prefs.pxd index 5f71d8f..326749d 100644 --- a/core/prefs.pxd +++ b/core/prefs.pxd @@ -1,4 +1,38 @@ +# +# Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia +# +# This file is part of python-purple. +# +# python-purple is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# python-purple is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + cdef extern from "libpurple/prefs.h": - cdef void purple_prefs_rename(char *oldname, char *newname) - cdef char *purple_prefs_get_string(char *name) - cdef gboolean purple_prefs_load() + cdef void c_purple_prefs_rename "purple_prefs_rename" (const_char_ptr oldname, const_char_ptr newname) + cdef const_char_ptr c_purple_prefs_get_string "purple_prefs_get_string" (const_char_ptr name) + cdef gboolean c_purple_prefs_load "purple_prefs_load" () + +class Prefs(object): + """ Prefs class """ + + def __init__(self): + pass + + def purple_prefs_rename(old_name, new_name): + c_purple_prefs_rename(old_name, new_name) + + def purple_prefs_get_string(name): + return c_purple_prefs_get_string(name) + + def purple_prefs_load(): + return c_purple_prefs_load() diff --git a/core/util.pxd b/core/util.pxd index add3a38..1f2078c 100644 --- a/core/util.pxd +++ b/core/util.pxd @@ -1,2 +1,30 @@ +# +# Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia +# +# This file is part of python-purple. +# +# python-purple is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# python-purple is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + cdef extern from "libpurple/util.h": - cdef void purple_util_set_user_dir(char *dir) + cdef void c_purple_util_set_user_dir "purple_util_set_user_dir" (char *dir) + +class Utils(object): + """ Utils class """ + + def __init__(self): + pass + + def purple_util_set_user_dir(self, dir): + c_purple_util_set_user_dir(dir) diff --git a/purple.pyx b/purple.pyx index 5bd8199..6cd03b8 100644 --- a/purple.pyx +++ b/purple.pyx @@ -1,9 +1,36 @@ -#include "core/blist.pxd" -#include "core/core.pxd" -#include "core/debug.pxd" -#include "core/eventloop.pxd" -#include "core/idle.pxd" -#include "core/plugin.pxd" -#include "core/pounce.pxd" -#include "core/prefs.pxd" -#include "core/util.pxd" +# +# Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia +# +# This file is part of python-purple. +# +# python-purple is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# python-purple is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +cdef extern from "glib-2.0/glib.h": + ctypedef gboolean + +cdef extern from *: + ctypedef char* const_char_ptr "const char *" + +include "core/account.pxd" +include "core/blist.pxd" +include "core/connection.pxd" +include "core/core.pxd" +include "core/debug.pxd" +include "core/eventloop.pxd" +include "core/idle.pxd" +include "core/plugin.pxd" +include "core/pounce.pxd" +include "core/prefs.pxd" +include "core/util.pxd"