Bug 25073 - Need some way for handlers to know that a Channel was approved by the user
Summary: Need some way for handlers to know that a Channel was approved by the user
Status: RESOLVED MOVED
Alias: None
Product: Telepathy
Classification: Unclassified
Component: tp-spec (show other bugs)
Version: unspecified
Hardware: Other All
: medium enhancement
Assignee: Simon McVittie
QA Contact: Telepathy bugs list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-13 07:44 UTC by Sjoerd Simons
Modified: 2019-12-03 20:20 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Sjoerd Simons 2009-11-13 07:44:52 UTC
The current ChannelDispatcher behaviour is that when there are now approvers (or the approver crashes) for a channel, it gets dispatched immediately to the handler. This is obviously desirable, what is less desirable is that a handler can't know the channel it was asked to handle was approved by something (either a user or some auto-acceptor).

While this is ok in some cases, e.g. text channels where it would just cause a chat window popping up, it's less desirable in other cases, e.g. on an incoming audio/video call which pops up a call ui and starts sending a/v.. 

A solution for this would be to put information in the HandlerInfo to state that this channel has been approved. Handlers for channels where skipping approval is a problem can then check this flag (if it's not set they can either pop up some dodgy UI, or more likely, kill the channel)
Comment 1 Simon McVittie 2010-08-25 03:41:44 UTC
Fixing this would also make the telepathy-glib documentation somewhat clearer, by making Handler_Info and TpHandleChannelsContext less hypothetical.

I have a proof-of-concept MC branch which adds { "approved-by": ":1.42" } to the Handler_Info if process :1.42 called HandleWith or HandleWithTime, which would solve this.

Specifying who approved it (rather than just that someone did) may seem rather over-engineered - in practice, clients will probably just check for it being non-empty - but it's easy to implement and is perhaps less ambiguous than a boolean, and if nothing else it'll be useful debug information.

One possible alternative would be to set an explicit "all-approvers-failed" flag, but I don't think this is actually the information the handler wants, in some corner cases. If an observer called HandleWith, it doesn't matter if all approvers failed - someone still approved the channel.

Ways in which MC can currently finish dispatching channels:

* calling into a Handler that has BypassApproval
  - "approved-by" omitted, unless someone (an Observer?) called HandleWith
    very fast
  - I don't think this counts as being approved: handlers with BypassApproval
    should have their own logic to deal with channels
  - "all-approvers-failed" would not be set: the approvers haven't even been
    run yet

* they were requested, so they don't need approval
  - MC internally considers requested channels to be "pre-approved", but I
    don't think it would be right to set an "approved" flag
  - the handler can look at the channels' Requested property
  - "all-approvers-failed" would not be set: the approvers aren't going to
    be run

* someone called HandleWith or HandleWithTime
  - my branch will set approved-by
  - "all-approvers-failed" would (probably) not be set
  - corner case: if an Observer called HandleWith and then there were no
    approvers, we *do* want to count the channels as approved [1]

* all channels were lost
  - HandleChannels is not called, so this case is not interesting

* someone called Claim
  - HandleChannels is not called, so this case is not interesting

* no approver returned success from AddDispatchOperation
  (probably because there are no approvers!)
  - "approved-by" is not set
  - this is the only case where "all-approvers-failed" would be set
Comment 2 Simon McVittie 2010-08-25 04:03:03 UTC
MC branch, with some quick tests:

http://git.collabora.co.uk/?p=user/smcv/telepathy-mission-control-smcv.git;a=shortlog;h=refs/heads/approved-by

If people like the general idea, I'll write it up in the spec and add convenience API in telepathy-glib.
Comment 3 GitLab Migration User 2019-12-03 20:20:25 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/telepathy/telepathy-spec/issues/50.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.