From: Ed Page Date: Sat, 27 Feb 2010 18:19:47 +0000 (-0600) Subject: Implementing the Hold interface to not block incoming calls X-Git-Url: http://git.maemo.org/git/?p=theonering;a=commitdiff_plain;h=f0ea094f455611ca2edebc3ff859fc67f8d1d5c0 Implementing the Hold interface to not block incoming calls --- diff --git a/src/channel/call.py b/src/channel/call.py index 865e55d..fefece3 100644 --- a/src/channel/call.py +++ b/src/channel/call.py @@ -13,8 +13,9 @@ _moduleLogger = logging.getLogger(__name__) class CallChannel( tp.ChannelTypeStreamedMedia, - tp.ChannelInterfaceCallState, tp.ChannelInterfaceGroup, + tp.ChannelInterfaceCallState, + tp.ChannelInterfaceHold, ): def __init__(self, connection, manager, props, contactHandle): @@ -42,8 +43,9 @@ class CallChannel( self._initiator = connection.GetSelfHandle() tp.ChannelTypeStreamedMedia.__init__(self, connection, manager, props) - tp.ChannelInterfaceCallState.__init__(self) tp.ChannelInterfaceGroup.__init__(self) + tp.ChannelInterfaceCallState.__init__(self) + tp.ChannelInterfaceHold.__init__(self) self.__contactHandle = contactHandle self.__calledNumer = None @@ -180,6 +182,30 @@ class CallChannel( return {self.__contactHandle: telepathy.constants.CHANNEL_CALL_STATE_FORWARDED} @misc_utils.log_exception(_moduleLogger) + def GetHoldState(self): + """ + For org.freedesktop.Telepathy.Channel.Interface.Hold + + Get the current hold state + @returns (HoldState, Reason) + """ + return ( + telepathy.constants.LOCAL_HOLD_STATE_UNHELD, + telepathy.constants.LOCAL_HOLD_STATE_REASON_NONE, + ) + + @misc_utils.log_exception(_moduleLogger) + def RequestHold(self, Hold): + """ + For org.freedesktop.Telepathy.Channel.Interface.Hold + """ + if not Hold: + return + _moduleLogger.debug("Closing without cancel to get out of users way") + self.__calledNumer = None + self.close() + + @misc_utils.log_exception(_moduleLogger) def _on_close_requested(self, *args): _moduleLogger.debug("Cancel now disallowed") self.__calledNumer = None