clarify whether Approvers are called for channels with no Handler
Submitted by Simon McVittie
Assigned to Telepathy bugs list
Description
+++ This bug was initially created as a clone of Bug #29022 +++
By inspection of the source code, if a dispatch operation has no PossibleHandlers, MC doesn't seem to dispatch it to observers or to approvers.
test/twisted/dispatcher/undispatchable.py should create a Text Observer and a Text Approver, and assert whether their methods are called. However, it doesn't.
I think Observers should be invoked for undispatchable operations (rationale: implementing ObserveChannels should be like listening for NewChannels). I'm not so sure about Approvers.
In favour of running Approvers if there's no Handler:
-
consistent with observers
-
maybe the Approver can arrange for a non-service-activatable Handler to be started out-of-band
-
maybe the Approver knows out-of-band that an existing Handler can secretly handle the channel, even though its filter says otherwise (symmetry with the PreferredHandler overriding filters)
Against running Approvers if there's no Handler:
-
until now, if the Approver calls HandleChannels("") and gets an error, it's always an error from the Handler; now, HandleChannels("") has to be able to return a specified error that means "actually, I can't do that"
-
if the Approver blindly calls HandleChannels(Possible_Handlers[0]), it'll crash itself ("don't do that then" is a reasonable answer)
-
Approvers are for interactive approval: is it really appropriate for an interactive approver to pop up if approval is impossible anyway? If you have some UI for "smcv is sending you a file [Save] [Reject]", would it ever make sense for it to pop up to say "smcv is sending you a file but you can't receive it [OK]", and would Approver authors actually deal with this correctly anyway?
(It would be rubbish UI to have a popup that says "smcv is sending you a file [Save] [Reject]", and then when you click Save, have an error message "you can't receive files".)
One possible solution is to let Approvers set a flag for whether they want to be nagged about undispatchable channels, with the default being FALSE (because that's the one that doesn't need the Approver author to take any other special action).
Version: git master