):
def __init__(self, connection, manager, props, contactHandle):
- self._manager = manager
- self._props = props
+ self.__manager = manager
+ self.__props = props
try:
# HACK Older python-telepathy way
telepathy.server.ChannelTypeStreamedMedia.__init__(self, connection, manager, props)
telepathy.server.ChannelInterfaceCallState.__init__(self)
telepathy.server.ChannelInterfaceGroup.__init__(self)
- self._contactHandle = contactHandle
+ self.__contactHandle = contactHandle
self._implement_property_get(
telepathy.interfaces.CHANNEL_TYPE_STREAMED_MEDIA,
{
def close(self):
telepathy.server.ChannelTypeStreamedMedia.Close(self)
- if self._manager.channel_exists(self._props):
+ if self.__manager.channel_exists(self.__props):
# HACK Older python-telepathy requires doing this manually
- self._manager.remove_channel(self)
+ self.__manager.remove_channel(self)
self.remove_from_connection()
@gtk_toolbox.log_exception(_moduleLogger)
@returns [(Stream ID, contact, stream type, stream state, stream direction, pending send flags)]
"""
contact = self._conn.handle(telepathy.constants.HANDLE_TYPE_CONTACT, contactId)
- assert self._contactHandle == contact, "%r != %r" % (self._contactHandle, contact)
+ assert self.__contactHandle == contact, "%r != %r" % (self.__contactHandle, contact)
contactId, contactNumber = handle.ContactHandle.from_handle_name(contact.name)
- self.CallStateChanged(self._contactHandle, telepathy.constants.CHANNEL_CALL_STATE_RINGING)
+ self.CallStateChanged(self.__contactHandle, telepathy.constants.CHANNEL_CALL_STATE_RINGING)
self._conn.session.backend.call(contactNumber)
- self.CallStateChanged(self._contactHandle, telepathy.constants.CHANNEL_CALL_STATE_FORWARDED)
+ self.CallStateChanged(self.__contactHandle, telepathy.constants.CHANNEL_CALL_STATE_FORWARDED)
streamId = 0
streamState = telepathy.constants.MEDIA_STREAM_STATE_DISCONNECTED
Get the current call states for all contacts involved in this call.
@returns {Contact: telepathy.constants.CHANNEL_CALL_STATE_*}
"""
- return {self._contactHandle: telepathy.constants.CHANNEL_CALL_STATE_FORWARDED}
+ return {self.__contactHandle: telepathy.constants.CHANNEL_CALL_STATE_FORWARDED}
import telepathy
-import util.go_utils as gobject_utils
import util.coroutines as coroutines
import gtk_toolbox
import handle
_moduleLogger = logging.getLogger("channel.contact_list")
-class AbstractListChannel(
+class AllContactsListChannel(
telepathy.server.ChannelTypeContactList,
telepathy.server.ChannelInterfaceGroup,
):
- "Abstract Contact List channels"
+ """
+ The group of contacts for whom you receive presence
+ """
def __init__(self, connection, manager, props, h):
- self._manager = manager
- self._props = props
-
try:
# HACK Older python-telepathy way
telepathy.server.ChannelTypeContactList.__init__(self, connection, h)
telepathy.server.ChannelTypeContactList.__init__(self, connection, manager, props)
telepathy.server.ChannelInterfaceGroup.__init__(self)
- self._session = connection.session
-
-
-class AllContactsListChannel(AbstractListChannel):
- """
- The group of contacts for whom you receive presence
- """
-
- def __init__(self, connection, manager, props, h):
- AbstractListChannel.__init__(self, connection, manager, props, h)
+ self.__manager = manager
+ self.__props = props
+ self.__session = connection.session
self._callback = coroutines.func_sink(
coroutines.expand_positional(
self._on_contacts_refreshed
)
)
- self._session.addressbook.updateSignalHandler.register_sink(
+ self.__session.addressbook.updateSignalHandler.register_sink(
self._callback
)
self.close()
def close(self):
- self._session.addressbook.updateSignalHandler.unregister_sink(
+ self.__session.addressbook.updateSignalHandler.unregister_sink(
self._callback
)
self._callback = None
telepathy.server.ChannelTypeContactList.Close(self)
- if self._manager.channel_exists(self._props):
+ if self.__manager.channel_exists(self.__props):
# HACK Older python-telepathy requires doing this manually
- self._manager.remove_channel(self)
+ self.__manager.remove_channel(self)
self.remove_from_connection()
@gtk_toolbox.log_exception(_moduleLogger)
"""
def __init__(self, connection, manager, props, contactHandle):
- self._manager = manager
- self._props = props
+ self.__manager = manager
+ self.__props = props
cmd.Cmd.__init__(self, "Debug Prompt")
self.use_rawinput = False
except TypeError:
# HACK Newer python-telepathy way
telepathy.server.ChannelTypeText.__init__(self, connection, manager, props)
- self._nextRecievedId = 0
- self._lastMessageTimestamp = datetime.datetime(1, 1, 1)
+ self.__nextRecievedId = 0
+ self.__lastMessageTimestamp = datetime.datetime(1, 1, 1)
- self._otherHandle = contactHandle
+ self.__otherHandle = contactHandle
@gtk_toolbox.log_exception(_moduleLogger)
def Send(self, messageType, text):
def close(self):
telepathy.server.ChannelTypeText.Close(self)
- if self._manager.channel_exists(self._props):
+ if self.__manager.channel_exists(self.__props):
# HACK Older python-telepathy requires doing this manually
- self._manager.remove_channel(self)
+ self.__manager.remove_channel(self)
self.remove_from_connection()
def _report_new_message(self, message):
- currentReceivedId = self._nextRecievedId
+ currentReceivedId = self.__nextRecievedId
timestamp = int(time.time())
type = telepathy.CHANNEL_TEXT_MESSAGE_TYPE_NORMAL
- self.Received(currentReceivedId, timestamp, self._otherHandle, type, 0, message.strip())
+ self.Received(currentReceivedId, timestamp, self.__otherHandle, type, 0, message.strip())
- self._nextRecievedId += 1
+ self.__nextRecievedId += 1
def do_reset_state_machine(self, args):
if args:
"""
def __init__(self, connection, manager, props, contactHandle):
- self._manager = manager
- self._props = props
+ self.__manager = manager
+ self.__props = props
try:
# HACK Older python-telepathy way
except TypeError:
# HACK Newer python-telepathy way
telepathy.server.ChannelTypeText.__init__(self, connection, manager, props)
- self._nextRecievedId = 0
- self._lastMessageTimestamp = datetime.datetime(1, 1, 1)
+ self.__nextRecievedId = 0
+ self.__lastMessageTimestamp = datetime.datetime(1, 1, 1)
- self._otherHandle = contactHandle
+ self.__otherHandle = contactHandle
- self._callback = coroutines.func_sink(
+ self.__callback = coroutines.func_sink(
coroutines.expand_positional(
self._on_conversations_updated
)
)
self._conn.session.voicemails.updateSignalHandler.register_sink(
- self._callback
+ self.__callback
)
self._conn.session.texts.updateSignalHandler.register_sink(
- self._callback
+ self.__callback
)
# The only reason there should be anything in the conversation is if
if messageType != telepathy.CHANNEL_TEXT_MESSAGE_TYPE_NORMAL:
raise telepathy.errors.NotImplemented("Unhandled message type: %r" % messageType)
- self._conn.session.backend.send_sms(self._otherHandle.phoneNumber, text)
+ self._conn.session.backend.send_sms(self.__otherHandle.phoneNumber, text)
self._conn.session.textsStateMachine.reset_timers()
self.Sent(int(time.time()), messageType, text)
def close(self):
self._conn.session.voicemails.updateSignalHandler.unregister_sink(
- self._callback
+ self.__callback
)
self._conn.session.texts.updateSignalHandler.unregister_sink(
- self._callback
+ self.__callback
)
- self._callback = None
+ self.__callback = None
telepathy.server.ChannelTypeText.Close(self)
- if self._manager.channel_exists(self._props):
+ if self.__manager.channel_exists(self.__props):
# HACK Older python-telepathy requires doing this manually
- self._manager.remove_channel(self)
+ self.__manager.remove_channel(self)
self.remove_from_connection()
@property
def _contactKey(self):
- contactKey = self._otherHandle.contactID, self._otherHandle.phoneNumber
+ contactKey = self.__otherHandle.contactID, self.__otherHandle.phoneNumber
return contactKey
@gtk_toolbox.log_exception(_moduleLogger)
"New messages for %r have already been read externally" % (self._contactKey, )
)
return
- self._lastMessageTimestamp = newConversations[-1].time
+ self.__lastMessageTimestamp = newConversations[-1].time
messages = [
newMessage
return (
conversation
for conversation in conversations
- if self._lastMessageTimestamp < conversation.time
+ if self.__lastMessageTimestamp < conversation.time
)
def _filter_out_read(self, conversations):
return " ".join(part.text.strip() for part in message.body)
def _report_new_message(self, message):
- currentReceivedId = self._nextRecievedId
+ currentReceivedId = self.__nextRecievedId
timestamp = int(time.time())
type = telepathy.CHANNEL_TEXT_MESSAGE_TYPE_NORMAL
- _moduleLogger.info("Received message from User %r" % self._otherHandle)
- self.Received(currentReceivedId, timestamp, self._otherHandle, type, 0, message)
+ _moduleLogger.info("Received message from User %r" % self.__otherHandle)
+ self.Received(currentReceivedId, timestamp, self.__otherHandle, type, 0, message)
- self._nextRecievedId += 1
+ self.__nextRecievedId += 1