+ 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)
+
+ def __get_name(self):
+ if self.__exists:
+ return <char *> conversation.purple_conversation_get_name( \
+ self._get_structure())
+ else:
+ return None
+ name = property(__get_name)
+
+ def new(self):
+ """
+ Creates a new conversation.
+
+ @return True if successful, False if conversation already exists
+ """
+ if self.__exists:
+ return False
+ else:
+ conversation.purple_conversation_new(self.__type, \
+ account.purple_accounts_find(self.__account.username, \
+ self.__account.protocol.id), self.__name)
+ self.__exists = True
+ return True
+
+ def destroy(self):
+ """
+ Destroys a conversation.
+
+ @return True if successful, False if conversation doesn't exists
+ """
+ if self.__exists:
+ conversation.purple_conversation_destroy(self._get_structure())
+ self.__exists = False
+ return True
+ else:
+ return False
+
+ def set_ui_ops(self, cbs):
+ """
+ Sets UI operations for a conversation.
+
+ @return True if sucessful, False otherwise
+ """
+ # FIXME: We may need to create c-functions for each of these?