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 __get_account(self):
35 def __set_account(self, acc):
37 account = property(__get_account, __set_account)
41 def __set_name(self, name):
43 name = property(__get_name, __set_name)
45 def initialize(self, acc, type, char *name):
51 conversation.c_purple_conversation_new(conversation.PURPLE_CONV_TYPE_UNKNOWN,\
52 <account.PurpleAccount*>self.__acc.c_account, self.__name)
55 conversation.c_purple_conversation_new(conversation.PURPLE_CONV_TYPE_IM,\
56 <account.PurpleAccount*>self.__acc.c_account, self.__name)
59 conversation.c_purple_conversation_new(conversation.PURPLE_CONV_TYPE_CHAT,\
60 <account.PurpleAccount*>self.__acc.c_account, self.__name)
63 conversation.c_purple_conversation_new(conversation.PURPLE_CONV_TYPE_MISC,\
64 <account.PurpleAccount*>self.__acc.c_account, self.__name)
67 conversation.c_purple_conversation_new(conversation.PURPLE_CONV_TYPE_ANY,\
68 <account.PurpleAccount*>self.__acc.c_account, self.__name)
70 def conversation_set_ui_ops(self):
71 cdef conversation.PurpleConversationUiOps c_conv_ui_ops
72 c_conv_ui_ops.create_conversation = NULL
73 c_conv_ui_ops.destroy_conversation = NULL
74 c_conv_ui_ops.write_chat = NULL
75 c_conv_ui_ops.write_im = NULL
76 c_conv_ui_ops.write_conv = NULL
77 c_conv_ui_ops.chat_add_users = NULL
78 c_conv_ui_ops.chat_rename_user = NULL
79 c_conv_ui_ops.chat_remove_users = NULL
80 c_conv_ui_ops.chat_update_user = NULL
81 c_conv_ui_ops.present = NULL
82 c_conv_ui_ops.has_focus = NULL
83 c_conv_ui_ops.custom_smiley_add = NULL
84 c_conv_ui_ops.custom_smiley_write = NULL
85 c_conv_ui_ops.custom_smiley_close = NULL
86 c_conv_ui_ops.send_confirm = NULL
88 conversation.c_purple_conversation_set_ui_ops(self.__conv, &c_conv_ui_ops)
90 def write(self, char *message):
91 conversation.c_purple_conv_im_send(conversation.c_purple_conversation_get_im_data(self.__conv), message)
94 conversation.c_purple_conversations_get_handle()
97 print "[DEBUG]: Destroy conversation: %s" % self.__name
98 conversation.c_purple_conversation_destroy(self.__conv)