Requests Mixin doesn't create Handles on demand
Submitted by Ed Page
Assigned to Telepathy bugs list
Description
Version: 0.15.13-1
Reproduction Steps:
- In a telepathy client (tested in RTComm) the user selects "Send IM To"
- The user enters the contact identifier for someone not on the contact list (so no previous handles created)
Expected Outcome:
- Clients will call ConnectionInterfaceRequests.CreateChannels with TargetHandleId set as the contact name.
- CreateChannels (through _alter_properties) calls an internal equivalent of RequestHandles to get a TargetHandle for the TargetHandleId, creating a new handle if needed.
Actual Outcome:
- Clients will call ConnectionInterfaceRequests.CreateChannels with TargetHandleId set as the contact name.
- CreateChannels (through _alter_properties) searches among existing handles, checking if the "get_name() == TargetHandleId"
- The handle has not previously been created and an exception is raised
Notes:
This puts on the requirement that the handle had to already exist which makes calling without a TargetHandle pointless. Handle.get_name() is checked directly against user input, not allowing CM implementers to normalize the names that come in When constructing the exception that gets thrown for an invalid contact, the string formatting is setup incorrectly and a different exception will be thrown instead.
Fix:
I've branched the latest Master of telepathy-python. I extracted code from the default implementation of RequestHandles and made it a function called "get_handle_by_name". I then made the requests interface call that. As a parallel function, I also implemented "get_handle_by_id" which is a simplistic function that clients are expected to implement for the Channel mixins (previously the channel mixins called it "handle" which I found quite an ambiguous name). git://github.com/epage/telepathy-python.git
Version: git master