Minor cleanup
authorEd Page <eopage@byu.net>
Sat, 2 Oct 2010 15:51:13 +0000 (10:51 -0500)
committerEd Page <eopage@byu.net>
Sat, 2 Oct 2010 15:51:13 +0000 (10:51 -0500)
src/channel/contact_list.py
src/channel/debug_log.py
src/connection.py
www/telepathy-theonering.deb

index 598368a..d8e2a4c 100644 (file)
@@ -145,7 +145,7 @@ _LIST_TO_FACTORY = {
        # The group of contacts for whom you receive presence
        'subscribe': AllContactsListChannel,
        # The group of contacts who may receive your presence
-       'publish': AllContactsListChannel,
+       'publish': None,
        # A group of contacts who are on the publish list but are temporarily
        # disallowed from receiving your presence
        # This doesn't make sense to support
@@ -157,7 +157,7 @@ _LIST_TO_FACTORY = {
        'deny': DenyContactsListChannel,
        # On protocols where the user's contacts are stored, this contact list
        # contains all stored contacts regardless of subscription status.
-       'stored': AllContactsListChannel,
+       'stored': None,
 }
 
 
index a85bf30..5448a33 100644 (file)
@@ -34,13 +34,17 @@ class DebugLogChannel(tp.ChannelTypeFileTransfer):
                                'State': self.get_state,
                                "ContentType": self.get_content_type,
                                "Filename": self.get_filename,
-                               "Size": self.get_state,
+                               "Size": self.get_size,
                                "Description": self.get_description,
                                "AvailableSocketTypes": self.get_available_socket_types,
                                "TransferredBytes": self.get_transferred_bytes,
                                "InitialOffset": self.get_initial_offset,
                        },
                )
+               self._add_immutables({
+                       'Filename': dbus_interface,
+                       'Size': dbus_interface,
+               })
 
                # grab a snapshot of the log so that we are always in a consistent
                # state between calls
@@ -49,15 +53,25 @@ class DebugLogChannel(tp.ChannelTypeFileTransfer):
                        self._log = "".join(logLines)
                self._transferredBytes = 0
 
-               self._state = telepathy.constants.FILE_TRANSFER_STATE_PENDING
-               self.FileTransferStateChanged(
-                       self._state,
-                       telepathy.constants.FILE_TRANSFER_STATE_CHANGE_REASON_NONE,
+               self._state = 0
+               self.set_state(
+                       telepathy.constants.FILE_TRANSFER_STATE_PENDING,
+                       telepathy.constants.FILE_TRANSFER_STATE_CHANGE_REASON_REQUESTED,
                )
 
        def get_state(self):
                return self._state
 
+       def set_state(self, state, reason):
+               if self._state == state:
+                       return
+               self._state = state
+
+               self.FileTransferStateChanged(
+                       self._state,
+                       reason,
+               )
+
        def get_content_type(self):
                return "application/octet-stream"
 
@@ -115,8 +129,15 @@ class DebugLogChannel(tp.ChannelTypeFileTransfer):
 
        def close(self):
                _moduleLogger.debug("Closing log")
+               if self._state != telepathy.FILE_TRANSFER_STATE_COMPLETED:
+                       self.set_state(
+                               telepathy.FILE_TRANSFER_STATE_CANCELLED,
+                               telepathy.FILE_TRANSFER_STATE_CHANGE_REASON_LOCAL_STOPPED
+                       )
+
                if self.__socket is not None:
                        self.__socket.close()
+
                tp.ChannelTypeFileTransfer.Close(self)
                self.remove_from_connection()
 
index 0f40b21..c967215 100644 (file)
@@ -254,9 +254,6 @@ class TheOneRingConnection(
                        subscribeHandle = self.get_handle_by_name(telepathy.HANDLE_TYPE_LIST, "subscribe")
                        subscribeProps = self.generate_props(telepathy.CHANNEL_TYPE_CONTACT_LIST, subscribeHandle, False)
                        self.__channelManager.channel_for_props(subscribeProps, signal=True)
-                       publishHandle = self.get_handle_by_name(telepathy.HANDLE_TYPE_LIST, "publish")
-                       publishProps = self.generate_props(telepathy.CHANNEL_TYPE_CONTACT_LIST, publishHandle, False)
-                       self.__channelManager.channel_for_props(publishProps, signal=True)
                except Exception:
                        _moduleLogger.exception("Setup failed")
                        self.disconnect(telepathy.CONNECTION_STATUS_REASON_AUTHENTICATION_FAILED)
index cb81407..5a4ab66 100644 (file)
Binary files a/www/telepathy-theonering.deb and b/www/telepathy-theonering.deb differ