+ """
+ Conversation class
+ @param type UNKNOWN, IM, CHAT, MISC, ANY
+ @param account Your account
+ @param name Buddy name
+ """
+
+ cdef object __account
+ cdef object __name
+ cdef object __type
+ cdef object __exists
+
+ def __init__(self, type, account, name):
+ self.__type = {
+ "UNKNOWN": conversation.PURPLE_CONV_TYPE_UNKNOWN,
+ "IM": conversation.PURPLE_CONV_TYPE_IM,
+ "CHAT": conversation.PURPLE_CONV_TYPE_CHAT,
+ "MISC": conversation.PURPLE_CONV_TYPE_MISC,
+ "ANY": conversation.PURPLE_CONV_TYPE_ANY }[type]
+ self.__account = account
+ self.__name = name
+
+ if self._get_structure() != NULL:
+ self.__exists = True
+ else:
+ self.__exists = False
+
+ cdef conversation.PurpleConversation *_get_structure(self):
+ return conversation.purple_find_conversation_with_account( \
+ self.__type, self.__name, account.purple_accounts_find( \
+ self.__account.username, self.__account.protocol.id))
+
+ def __get_exists(self):
+ return self.__exists
+ exists = property(__get_exists)
+
+ def __get_account(self):
+ if self.__exists:
+ return self.__account
+ else:
+ return None
+ account = property(__get_account)