2 # Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia
4 # This file is part of python-purple.
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.
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.
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/>.
22 cdef class Conversation:
23 """ Conversation class """
24 cdef conversation.PurpleConversation *__conv
30 conversation.c_purple_conversations_init()
33 def initialize(self, acc, type, char *name):
37 conversation.c_purple_conversation_new(conversation.PURPLE_CONV_TYPE_UNKNOWN,\
38 <account.PurpleAccount*>self.__acc.c_account, name)
41 conversation.c_purple_conversation_new(conversation.PURPLE_CONV_TYPE_IM,\
42 <account.PurpleAccount*>self.__acc.c_account, name)
45 conversation.c_purple_conversation_new(conversation.PURPLE_CONV_TYPE_CHAT,\
46 <account.PurpleAccount*>self.__acc.c_account, name)
49 conversation.c_purple_conversation_new(conversation.PURPLE_CONV_TYPE_MISC,\
50 <account.PurpleAccount*>self.__acc.c_account, name)
53 conversation.c_purple_conversation_new(conversation.PURPLE_CONV_TYPE_ANY,\
54 <account.PurpleAccount*>self.__acc.c_account, name)
57 def conversation_set_ui_ops(self):
58 cdef conversation.PurpleConversationUiOps c_conv_ui_ops
59 c_conv_ui_ops.create_conversation = NULL
60 c_conv_ui_ops.destroy_conversation = NULL
61 c_conv_ui_ops.write_chat = NULL
62 c_conv_ui_ops.write_im = NULL
63 c_conv_ui_ops.write_conv = NULL
64 c_conv_ui_ops.chat_add_users = NULL
65 c_conv_ui_ops.chat_rename_user = NULL
66 c_conv_ui_ops.chat_remove_users = NULL
67 c_conv_ui_ops.chat_update_user = NULL
68 c_conv_ui_ops.present = NULL
69 c_conv_ui_ops.has_focus = NULL
70 c_conv_ui_ops.custom_smiley_add = NULL
71 c_conv_ui_ops.custom_smiley_write = NULL
72 c_conv_ui_ops.custom_smiley_close = NULL
73 c_conv_ui_ops.send_confirm = NULL
75 conversation.c_purple_conversation_set_ui_ops(self.__conv, &c_conv_ui_ops)
77 def write(self, char *message):
78 conversation.c_purple_conv_im_send(conversation.c_purple_conversation_get_im_data(self.__conv), message)
81 conversation.c_purple_conversations_get_handle()
84 print "[DEBUG]: Destroy conversation: %s" % self.name
85 conversation.c_purple_conversation_destroy(self.__conv)