From cfb1c2eb0316f1d7b744f5f05c7a577a3be20e97 Mon Sep 17 00:00:00 2001 From: Ragner Magalhaes Date: Tue, 2 Dec 2008 20:17:33 +0000 Subject: [PATCH] Added majority of libpurple functions used by pidgin-carman. FIXES: - Added majority of libpurple functions used by pidgin-carman. - Fixed alias for conversation functions. - Added libpurple/signals.pxd. Signed-off-by: Bruno Abinader git-svn-id: https://garage.maemo.org/svn/carman/branches/carman-0.7-beta2/python-purple@1290 596f6dd7-e928-0410-a184-9e12fd12cf7e --- conversation.pxd | 12 ++++++------ libpurple/blist.pxd | 1 + libpurple/connection.pxd | 2 -- libpurple/conversation.pxd | 15 +++++++-------- libpurple/proxy.pxd | 3 ++- libpurple/signals.pxd | 27 +++++++++++++++++++++++++++ libpurple/util.pxd | 1 + purple.pyx | 5 +++-- 8 files changed, 47 insertions(+), 19 deletions(-) create mode 100644 libpurple/signals.pxd diff --git a/conversation.pxd b/conversation.pxd index ecb00bc..ee3b26c 100644 --- a/conversation.pxd +++ b/conversation.pxd @@ -22,10 +22,10 @@ cdef class Conversation: cdef PurpleConversation *__conv def __cinit__(self): - purple_conversations_init() + c_purple_conversations_init() def conversation_new(self, type, acc, const_char_ptr name): - self.__conv = purple_conversation_new(type, acc.__account, name) + self.__conv = c_purple_conversation_new(type, acc.__account, name) def conversation_set_ui_ops(self): cdef PurpleConversationUiOps c_conv_ui_ops @@ -45,16 +45,16 @@ cdef class Conversation: c_conv_ui_ops.custom_smiley_close = NULL c_conv_ui_ops.send_confirm = NULL - purple_conversation_set_ui_ops(self.__conv, &c_conv_ui_ops) + c_purple_conversation_set_ui_ops(self.__conv, &c_conv_ui_ops) def conversation_write(self, const_char_ptr message): - purple_conv_im_send(purple_conversation_get_im_data(self.__conv), message) + c_purple_conv_im_send(c_purple_conversation_get_im_data(self.__conv), message) def conversation_destroy(self): - purple_conversation_destroy(self.__conv) + c_purple_conversation_destroy(self.__conv) def conversation_get_handle(self): - purple_conversations_get_handle() + c_purple_conversations_get_handle() def send_message(self, buddy, const_char_ptr message): self.conversation_new(1, buddy.account, buddy.name) diff --git a/libpurple/blist.pxd b/libpurple/blist.pxd index 36077f2..8b523d1 100644 --- a/libpurple/blist.pxd +++ b/libpurple/blist.pxd @@ -27,6 +27,7 @@ cdef extern from "libpurple/blist.h": ctypedef struct PurpleBuddyList: pass + void *c_purple_blist_get_handle "purple_blist_get_handle" () void c_purple_blist_load "purple_blist_load" () PurpleBuddyList* c_purple_blist_new "purple_blist_new" () diff --git a/libpurple/connection.pxd b/libpurple/connection.pxd index 5e2c99a..d0632b3 100644 --- a/libpurple/connection.pxd +++ b/libpurple/connection.pxd @@ -20,5 +20,3 @@ cdef extern from "libpurple/connection.h": ctypedef struct PurpleConnection: pass - - void connect_to_signals_for_demonstration_purposes_only() diff --git a/libpurple/conversation.pxd b/libpurple/conversation.pxd index 8df130f..32320ee 100644 --- a/libpurple/conversation.pxd +++ b/libpurple/conversation.pxd @@ -58,11 +58,10 @@ cdef extern from "libpurple/conversation.h": void (*custom_smiley_close) (PurpleConversation *conv, const_char_ptr smile) void (*send_confirm) (PurpleConversation *conv, const_char_ptr message) - void purple_conversations_init() - PurpleConversation *purple_conversation_new(int type, PurpleAccount *account, const_char_ptr name) - void purple_conversation_set_ui_ops(PurpleConversation *conv, PurpleConversationUiOps *ops) - PurpleConvIm *purple_conversation_get_im_data(PurpleConversation *conv) - void purple_conv_im_send(PurpleConvIm *im, const_char_ptr message) - void *purple_conversations_get_handle() - void purple_conversation_destroy(PurpleConversation *conv) - + void c_purple_conversations_init "purple_conversations_init" () + void *c_purple_conversations_get_handle "purple_conversations_get_handle" () + PurpleConversation *c_purple_conversation_new "purple_conversation_new" (int type, PurpleAccount *account, const_char_ptr name) + void c_purple_conversation_set_ui_ops "purple_conversation_set_ui_ops" (PurpleConversation *conv, PurpleConversationUiOps *ops) + PurpleConvIm *c_purple_conversation_get_im_data "purple_conversation_get_im_data" (PurpleConversation *conv) + void c_purple_conv_im_send "purple_conv_im_send" (PurpleConvIm *im, const_char_ptr message) + void c_purple_conversation_destroy "purple_conversation_destroy" (PurpleConversation *conv) diff --git a/libpurple/proxy.pxd b/libpurple/proxy.pxd index faefbae..59e7e4b 100644 --- a/libpurple/proxy.pxd +++ b/libpurple/proxy.pxd @@ -21,7 +21,8 @@ cdef extern from "libpurple/proxy.h": cdef struct PurpleProxyInfo ctypedef int PurpleProxyType - PurpleProxyInfo *purple_proxy_info_new() + + PurpleProxyInfo *c_purple_proxy_info_new "purple_proxy_info_new" () void c_purple_proxy_info_set_type "purple_proxy_info_set_type" (PurpleProxyInfo *info, PurpleProxyType type) void c_purple_proxy_info_set_host "purple_proxy_info_set_host" (const_char_ptr host) void c_purple_proxy_info_set_port "purple_proxy_info_set_port" (const_char_ptr port) diff --git a/libpurple/signals.pxd b/libpurple/signals.pxd new file mode 100644 index 0000000..569f654 --- /dev/null +++ b/libpurple/signals.pxd @@ -0,0 +1,27 @@ +# +# 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/signals.h": + ctypedef void (*PurpleCallback) () + + gulong c_purple_signal_connect "purple_signal_connect" (void *instance, + const_char_ptr signal, void *handle, PurpleCallback func, + void *data) + void c_purple_signal_disconnect "purple_signal_disconnect" (void *instance, + const_char_ptr signal, void *handle, PurpleCallback func) diff --git a/libpurple/util.pxd b/libpurple/util.pxd index 612876e..7132a4d 100644 --- a/libpurple/util.pxd +++ b/libpurple/util.pxd @@ -18,4 +18,5 @@ # cdef extern from "libpurple/util.h": + void *c_purple_markup_strip_html "purple_markup_strip_html" (const_char_ptr str) void c_purple_util_set_user_dir "purple_util_set_user_dir" (char *dir) diff --git a/purple.pyx b/purple.pyx index d402e2b..35f5a09 100644 --- a/purple.pyx +++ b/purple.pyx @@ -39,13 +39,14 @@ include "libpurple/plugin.pxd" include "libpurple/pounce.pxd" include "libpurple/prefs.pxd" include "libpurple/proxy.pxd" +include "libpurple/signals.pxd" include "libpurple/status.pxd" include "libpurple/savedstatuses.pxd" include "libpurple/util.pxd" cdef extern from "c_purple.h": - guint glib_input_add(gint fd, PurpleInputCondition condition, PurpleInputFunction function, gpointer data) - void glib_main_loop() + void connect_to_signals_for_demonstration_purposes_only () + guint glib_input_add(gint fd, PurpleInputCondition condition, PurpleInputFunction function, gpointer data) import ecore -- 1.7.9.5