7 class TheOneRingChannelText(
8 telepathy.server.ChannelTypeText,
11 def __init__(self, connection, conversation):
13 self._conversation = conversation
14 self._conn_ref = weakref.ref(connection)
16 telepathy.server.ChannelTypeText.__init__(self, connection, None)
17 telepathy.server.ChannelInterfaceGroup.__init__(self)
18 telepathy.server.ChannelInterfaceChatState.__init__(self)
20 self.GroupFlagsChanged(telepathy.CHANNEL_GROUP_FLAG_CAN_ADD, 0)
21 self.__add_initial_participants()
23 def Send(self, messageType, text):
24 if messageType == telepathy.CHANNEL_TEXT_MESSAGE_TYPE_NORMAL:
25 self._conversation.send_text_message(text)
26 elif messageType == telepathy.CHANNEL_TEXT_MESSAGE_TYPE_ACTION and text == u"nudge":
27 self._conversation.send_nudge()
29 raise telepathy.NotImplemented("Unhandled message type")
30 self.Sent(int(time.time()), messageType, text)
33 self._conversation.leave()
34 telepathy.server.ChannelTypeText.Close(self)
35 self.remove_from_connection()