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: [email protected]
        ReportedBy: [EMAIL PROTECTED]


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.
_______________________________________________
Telepathy mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/telepathy

Reply via email to