[Telepathy] [Bug 13623] New: TextChannel should not send messages with the same id more than once

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Dec 12 08:45:27 PST 2007


http://bugs.freedesktop.org/show_bug.cgi?id=13623

           Summary: TextChannel should not send messages with the same id
                    more than once
           Product: Telepathy
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: telepathy-python
        AssignedTo: telepathy at lists.freedesktop.org
        ReportedBy: alsuren at gmail.com


currently: (in telepathy-python/telepathy/server/channel.py:269)

    @dbus.service.signal(CHANNEL_TYPE_TEXT, signature='uuuuus')
    def Received(self, id, timestamp, sender, type, flags, text):
        self._pending_messages[id] = (timestamp, sender, type, flags, text)

This will always emit a signal

I suggest either:
creating a standard wrapper (so that users don't have to):

    def received(self, id, timestamp, sender, type, flags, text):
        """Wrapper around broken Received signal"""
        if id not in self._pending_messages:
            self.Received(id, timestamp, sender, type, flags, text)

or raising ValueError, to stop the signal being transmitted:

    @dbus.service.signal(CHANNEL_TYPE_TEXT, signature='uuuuus')
    def Received(self, id, timestamp, sender, type, flags, text):
        if id in self._pending_messages:
            raise ValueError("You can't receive the same message twice.")
        else:
            self._pending_messages[id] = (timestamp, sender, type, flags, text)


-- 
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


More information about the Telepathy mailing list