[tuxdroid-svn] r5578 - in software_suite_v3/software/plugin/plugin-skype/trunk/executables: . Skyp
Status: Beta
Brought to you by:
ks156
|
From: jerome <c2m...@c2...> - 2009-10-01 14:32:03
|
Author: jerome
Date: 2009-10-01 14:23:33 +0200 (Thu, 01 Oct 2009)
New Revision: 5578
Added:
software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/LICENSE
Modified:
software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/__init__.py
software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/application.py
software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/call.py
software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/callchannel.py
software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/chat.py
software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/client.py
software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/conversion.py
software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/enums.py
software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/errors.py
software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/filetransfer.py
software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/profile.py
software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/settings.py
software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/skype.py
software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/sms.py
software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/user.py
software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/utils.py
software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/voicemail.py
software_suite_v3/software/plugin/plugin-skype/trunk/executables/plugin-skype.py
Log:
* Implemented Skype4Py 28th September release (1.0.32).
* Updated the way to retrive contacts list ( real time contacts update ).
* Improved Quit gadget function.
* Fixed X11 Transport bug.
* Fixed a bug Quitting Skype application ( gadget remained opened on Linux).
Added: software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/LICENSE
===================================================================
--- software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/LICENSE (rev 0)
+++ software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/LICENSE 2009-10-01 12:23:33 UTC (rev 5578)
@@ -0,0 +1,21 @@
+Copyright (c) 2007-2009, Arkadiusz Wahlig
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ * Neither the name of Arkadiusz Wahlig nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
Modified: software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/__init__.py
===================================================================
--- software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/__init__.py 2009-10-01 12:21:30 UTC (rev 5577)
+++ software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/__init__.py 2009-10-01 12:23:33 UTC (rev 5578)
@@ -1,64 +1,118 @@
-#
-# Skype4Py
-#
-
-'''
+"""
Skype4Py is a multiplatform Skype API wrapper for Python.
- 1. Usage.
+Usage
+=====
- C{Skype4Py} is the package that you should import in your scripts to be able to access Skype.
- You won't need to import any submodules. Everything you may need will be available at the
- package level. This includes:
+ Everything that you should ever need is available as aliases in the ``Skype4Py`` package.
+ Import it using the standard form of the ``import`` statement:
+
+ .. python::
+
+ import Skype4Py
+
+ Importing the whole package into your script's namespace using ``from Skype4Py import *`` is
+ generally discouraged. You should also not access the modules in the package directly as they
+ are considered an implementation detail and may change in future versions without notice.
+
+ The package provides the following:
- - Classes
- - C{Skype4Py.Skype = L{Skype4Py.skype.ISkype}}
- - C{Skype4Py.CallChannelManager = L{Skype4Py.callchannel.ICallChannelManager}}
- - Constants
- - C{Skype4Py.* = L{Skype4Py.enums}.*}
- - Errors
- - C{Skype4Py.SkypeError = L{Skype4Py.errors.ISkypeError}}
- - C{Skype4Py.SkypeAPIError = L{Skype4Py.errors.ISkypeAPIError}}
+ - Classes
+
+ ``Skype4Py.Skype``, an alias for `Skype4Py.skype.Skype`
+
+ ``Skype4Py.CallChannelManager``, an alias for `Skype4Py.callchannel.CallChannelManager`
+
+ - Constants
+
+ Everything from the `Skype4Py.enums` module.
- The first two are the only classes that you will be instatinating directly. Calling their methods/properties
- will give you the access to instances of all other classes, you won't have to instatinate them yourself.
- The two classes are also the only ones that provide event handlers (see [3]).
+ ``platform``, either ``'windows'``, ``'posix'`` or ``'darwin'`` depending
+ on the current platform (Windows, Linux, Mac OS X).
+
+ - Errors
+
+ ``Skype4Py.SkypeError``, an alias for `Skype4Py.errors.SkypeError`
+
+ ``Skype4Py.SkypeAPIError``, an alias for `Skype4Py.errors.SkypeAPIError`
- Every Skype4Py script instatinates the C{Skype4Py.Skype} class at least once. That's what you want to do
- first in your script. Then follow the L{Skype4Py.skype.ISkype} reference to see where you can get from
- there.
+ The two classes exposed by the ``Skype4Py`` package are the only ones that are to be instantiated
+ directly. They in turn provide means of instantiating the remaining ones. They are also the only
+ classes that provide event handlers (for more information about events and how to use them, see
+ the `EventHandlingBase` class.
+
+ Every Skype4Py script instantiates at least the ``Skype4Py.Skype`` class which gives access to
+ the Skype client running currently in the system. Follow the `Skype4Py.skype.Skype` reference to
+ see what you can do with it.
- 2. Quick example.
+ **Warning!** While reading this documentation, it is important to keep in mind that everything
+ needed is in the top package level because the documentation refers to all objects in the places
+ they actually live.
- This short example connects to Skype client and prints the user's full name and the names of all the
- contacts from the contacts list::
+Quick example
+=============
- import Skype4Py
+ This short example connects to Skype client and prints the user's full name and the names of all the
+ contacts from the contacts list:
- # Create Skype instance
- skype = Skype4Py.Skype()
+ .. python::
- # Connect Skype object to Skype client
- skype.Attach()
+ import Skype4Py
- print 'Your full name:', skype.CurrentUser.FullName
- print 'Your contacts:'
- for user in skype.Friends:
- print ' ', user.FullName
+ # Create an instance of the Skype class.
+ skype = Skype4Py.Skype()
-@author: U{Arkadiusz Wahlig<ya...@no...>}
-@requires: Python 2.4 or newer
-@see: U{The Skype4Py webpage<https://developer.skype.com/wiki/Skype4Py>}
-@license: BSD License (see the accompanying LICENSE file for more information)
-@copyright: S{copy} 2007 Arkadiusz Wahlig
-'''
+ # Connect the Skype object to the Skype client.
+ skype.Attach()
-from skype import ISkype as Skype
-from callchannel import ICallChannelManager as CallChannelManager
-from errors import ISkypeError as SkypeError, ISkypeAPIError as SkypeAPIError
+ # Obtain some information from the client and print it out.
+ print 'Your full name:', skype.CurrentUser.FullName
+ print 'Your contacts:'
+ for user in skype.Friends:
+ print ' ', user.FullName
+
+Note on the naming convention
+=============================
+
+ Skype4Py uses two different naming conventions. The first one applies to interfaces derived from
+ Skype4COM_, a COM library which was an inspiration for Skype4Py. This convention uses the ``CapCase``
+ scheme for class names, properties, methods and their arguments. The constants use the ``mixedCase``
+ scheme.
+
+ The second naming convention is more "Pythonic" and is used by all other parts of the package
+ including internal objects. It uses mostly the same ``CapCase`` scheme for class names (including
+ exception names) with a small difference in abbreviations. Where the first convention would use
+ a ``SkypeApiError`` name, the second one uses ``SkypeAPIError``. Other names including properties,
+ methods, arguments, variables and module names use lowercase letters with underscores.
+
+.. _Skype4COM: https://developer.skype.com/Docs/Skype4COM
+.. |copy| unicode:: U+000A9
+
+:author: Arkadiusz Wahlig <ark...@gm...>
+:requires: Python 2.4 up until but not including 3.0.
+:see: The Skype4Py website: https://developer.skype.com/wiki/Skype4Py
+:license: BSD License (see the accompanying LICENSE file for more information)
+:copyright: |copy| 2007-2009 Arkadiusz Wahlig
+"""
+__docformat__ = 'restructuredtext en'
+
+
+from skype import Skype
+from callchannel import CallChannelManager
+from errors import SkypeError, SkypeAPIError
from enums import *
+from api import platform
+import logging
-__version__ = '1.0.29.0'
-'''The version of Skype4Py.'''
+__version__ = '1.0.32.0'
+"""The version of Skype4Py."""
+
+class NullHandler(logging.Handler):
+ def emit(self, record):
+ pass
+
+
+# Suppress the "No handlers could be found for logger (...)" message.
+logging.getLogger('Skype4Py').addHandler(NullHandler())
Modified: software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/application.py
===================================================================
--- software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/application.py 2009-10-01 12:21:30 UTC (rev 5577)
+++ software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/application.py 2009-10-01 12:23:33 UTC (rev 5578)
@@ -1,236 +1,252 @@
-'''APP2APP protocol.
-'''
+"""APP2APP protocol.
+"""
+__docformat__ = 'restructuredtext en'
+
+import threading
+
from utils import *
from user import *
-import threading
-class IApplication(Cached):
- '''Represents an application in APP2APP protocol. Use L{ISkype.Application<skype.ISkype.Application>} to instatinate.
- '''
+class Application(Cached):
+ """Represents an application in APP2APP protocol. Use `skype.Skype.Application` to instantiate.
+ """
+ _ValidateHandle = staticmethod(tounicode)
def __repr__(self):
- return '<%s with Name=%s>' % (Cached.__repr__(self)[1:-1], repr(self.Name))
+ return Cached.__repr__(self, 'Name')
def _Alter(self, AlterName, Args=None):
- return self._Skype._Alter('APPLICATION', self._Name, AlterName, Args)
+ return self._Owner._Alter('APPLICATION', self.Name, AlterName, Args)
- def _Init(self, Name, Skype):
- self._Name = unicode(Name)
- self._Skype = Skype
+ def _Init(self):
+ self._MakeOwner()
def _Property(self, PropName, Set=None):
- return self._Skype._Property('APPLICATION', self._Name, PropName, Set)
+ return self._Owner._Property('APPLICATION', self.Name, PropName, Set)
+ def _Connect_ApplicationStreams(self, App, Streams):
+ if App == self:
+ s = [x for x in Streams if x.PartnerHandle == self._Connect_Username]
+ if s:
+ self._Connect_Stream[0] = s[0]
+ self._Connect_Event.set()
+
def Connect(self, Username, WaitConnected=False):
- '''Connects application to user.
+ """Connects application to user.
- @param Username: Name of the user to connect to.
- @type Username: unicode
- @param WaitConnected: If True, causes the method to wait untill the connection is established.
- @type WaitConnected: bool
- @return: If C{WaitConnected} is True, returns the stream which can be used to send the data.
- Otherwise returns None.
- @rtype: L{IApplicationStream} or None
- '''
+ :Parameters:
+ Username : str
+ Name of the user to connect to.
+ WaitConnected : bool
+ If True, causes the method to wait until the connection is established.
+
+ :return: If ``WaitConnected`` is True, returns the stream which can be used to send the
+ data. Otherwise returns None.
+ :rtype: `ApplicationStream` or None
+ """
if WaitConnected:
- event = threading.Event()
- stream = [None]
- def app_streams(App, Streams):
- if App == self:
- s = [x for x in Streams if x.PartnerHandle == Username]
- if s:
- stream[0] = s[0]
- event.set()
- app_streams(self, self.Streams)
- self._Skype.RegisterEventHandler('ApplicationStreams', app_streams)
+ self._Connect_Event = threading.Event()
+ self._Connect_Stream = [None]
+ self._Connect_Username = Username
+ self._Connect_ApplicationStreams(self, self.Streams)
+ self._Owner.RegisterEventHandler('ApplicationStreams', self._Connect_ApplicationStreams)
self._Alter('CONNECT', Username)
- event.wait()
- self._Skype.UnregisterEventHandler('ApplicationStreams', app_streams)
- return stream[0]
+ self._Connect_Event.wait()
+ self._Owner.UnregisterEventHandler('ApplicationStreams', self._Connect_ApplicationStreams)
+ try:
+ return self._Connect_Stream[0]
+ finally:
+ del self._Connect_Stream, self._Connect_Event, self._Connect_Username
else:
self._Alter('CONNECT', Username)
def Create(self):
- '''Creates the APP2APP application in Skype client.
- '''
- self._Skype._DoCommand('CREATE APPLICATION %s' % self._Name)
+ """Creates the APP2APP application in Skype client.
+ """
+ self._Owner._DoCommand('CREATE APPLICATION %s' % self.Name)
def Delete(self):
- '''Deletes the APP2APP application in Skype client.
- '''
- self._Skype._DoCommand('DELETE APPLICATION %s' % self._Name)
+ """Deletes the APP2APP application in Skype client.
+ """
+ self._Owner._DoCommand('DELETE APPLICATION %s' % self.Name)
def SendDatagram(self, Text, Streams=None):
- '''Sends datagram to application streams.
+ """Sends datagram to application streams.
- @param Text: Text to send.
- @type Text: unicode
- @param Streams: Streams to send the datagram to or None if all currently connected streams should be used.
- @type Streams: sequence of L{IApplicationStream}
- '''
- if Streams == None:
+ :Parameters:
+ Text : unicode
+ Text to send.
+ Streams : sequence of `ApplicationStream`
+ Streams to send the datagram to or None if all currently connected streams should be
+ used.
+ """
+ if Streams is None:
Streams = self.Streams
for s in Streams:
s.SendDatagram(Text)
def _GetConnectableUsers(self):
- return tuple(IUser(x, self._Skype) for x in esplit(self._Property('CONNECTABLE')))
+ return UserCollection(self._Owner, split(self._Property('CONNECTABLE')))
ConnectableUsers = property(_GetConnectableUsers,
- doc='''All connectable users.
+ doc="""All connectible users.
- @type: tuple of L{IUser}
- ''')
+ :type: `UserCollection`
+ """)
def _GetConnectingUsers(self):
- return tuple(IUser(x, self._Skype) for x in esplit(self._Property('CONNECTING')))
+ return UserCollection(self._Owner, split(self._Property('CONNECTING')))
ConnectingUsers = property(_GetConnectingUsers,
- doc='''All users connecting at the moment.
+ doc="""All users connecting at the moment.
- @type: tuple of L{IUser}
- ''')
+ :type: `UserCollection`
+ """)
def _GetName(self):
- return self._Name
+ return self._Handle
Name = property(_GetName,
- doc='''Name of the application.
+ doc="""Name of the application.
- @type: unicode
- ''')
+ :type: unicode
+ """)
def _GetReceivedStreams(self):
- return tuple(IApplicationStream(x.split('=')[0], self) for x in esplit(self._Property('RECEIVED')))
+ return ApplicationStreamCollection(self, (x.split('=')[0] for x in split(self._Property('RECEIVED'))))
ReceivedStreams = property(_GetReceivedStreams,
- doc='''All streams that received data and can be read.
+ doc="""All streams that received data and can be read.
- @type: tuple of L{IApplicationStream}
- ''')
+ :type: `ApplicationStreamCollection`
+ """)
def _GetSendingStreams(self):
- return tuple(IApplicationStream(x.split('=')[0], self) for x in esplit(self._Property('SENDING')))
+ return ApplicationStreamCollection(self, (x.split('=')[0] for x in split(self._Property('SENDING'))))
SendingStreams = property(_GetSendingStreams,
- doc='''All streams that send data and at the moment.
+ doc="""All streams that send data and at the moment.
- @type: tuple of L{IApplicationStream}
- ''')
+ :type: `ApplicationStreamCollection`
+ """)
def _GetStreams(self):
- return tuple(IApplicationStream(x, self) for x in esplit(self._Property('STREAMS')))
+ return ApplicationStreamCollection(self, split(self._Property('STREAMS')))
Streams = property(_GetStreams,
- doc='''All currently connected application streams.
+ doc="""All currently connected application streams.
- @type: tuple of L{IApplicationStream}
- ''')
+ :type: `ApplicationStreamCollection`
+ """)
-class IApplicationStream(Cached):
- '''Represents an application stream in APP2APP protocol.
- '''
+class ApplicationStream(Cached):
+ """Represents an application stream in APP2APP protocol.
+ """
+ _ValidateHandle = str
def __len__(self):
return self.DataLength
def __repr__(self):
- return '<%s with Handle=%s, Application=%s>' % (Cached.__repr__(self)[1:-1], repr(self.Handle), repr(self.Application))
+ return Cached.__repr__(self, 'Handle')
- def _Init(self, Handle, Application):
- self._Handle = Handle
- self._Application = Application
-
def Disconnect(self):
- '''Disconnects the stream.
- '''
- self._Application._Alter('DISCONNECT', self._Handle)
+ """Disconnects the stream.
+ """
+ self.Application._Alter('DISCONNECT', self.Handle)
close = Disconnect
def Read(self):
- '''Reads data from stream.
+ """Reads data from stream.
- @return: Read data or an empty string if none were available.
- @rtype: unicode
- '''
- return self._Application._Alter('READ', self._Handle)
+ :return: Read data or an empty string if none were available.
+ :rtype: unicode
+ """
+ return self.Application._Alter('READ', self.Handle)
read = Read
def SendDatagram(self, Text):
- '''Sends datagram to stream.
+ """Sends datagram to stream.
- @param Text: Datagram to send.
- @type Text: unicode
- '''
- self._Application._Alter('DATAGRAM', '%s %s' % (self._Handle, Text))
+ :Parameters:
+ Text : unicode
+ Datagram to send.
+ """
+ self.Application._Alter('DATAGRAM', '%s %s' % (self.Handle, tounicode(Text)))
def Write(self, Text):
- '''Writes data to stream.
+ """Writes data to stream.
- @param Text: Data to send.
- @type Text: unicode
- '''
- self._Application._Alter('WRITE', '%s %s' % (self._Handle, Text))
+ :Parameters:
+ Text : unicode
+ Data to send.
+ """
+ self.Application._Alter('WRITE', '%s %s' % (self.Handle, tounicode(Text)))
write = Write
def _GetApplication(self):
- return self._Application
+ return self._Owner
Application = property(_GetApplication,
- doc='''Application this stream belongs to.
+ doc="""Application this stream belongs to.
- @type: L{IApplication}
- ''')
+ :type: `Application`
+ """)
def _GetApplicationName(self):
- return self._Application.Name
+ return self.Application.Name
ApplicationName = property(_GetApplicationName,
- doc='''Name of the application this stream belongs to. Same as C{IApplicationStream.Application.Name}.
+ doc="""Name of the application this stream belongs to. Same as ``ApplicationStream.Application.Name``.
- @type: unicode
- ''')
+ :type: unicode
+ """)
+ def _GetDataLength_GetStreamLength(self, Type):
+ for s in split(self.Application._Property(Type)):
+ h, i = s.split('=')
+ if h == self.Handle:
+ return int(i)
+
def _GetDataLength(self):
- def GetStreamLength(Type):
- for s in esplit(self._Application._Property(Type)):
- h, i = s.split('=')
- if h == self._Handle:
- return int(i)
- i = GetStreamLength('SENDING')
- if i != None:
+ i = self._GetDataLength_GetStreamLength('SENDING')
+ if i is not None:
return i
- i = GetStreamLength('RECEIVED')
- if i != None:
+ i = self._GetDataLength_GetStreamLength('RECEIVED')
+ if i is not None:
return i
return 0
DataLength = property(_GetDataLength,
- doc='''Number of bytes awaiting in the read buffer.
+ doc="""Number of bytes awaiting in the read buffer.
- @type: int
- ''')
+ :type: int
+ """)
def _GetHandle(self):
return self._Handle
Handle = property(_GetHandle,
- doc='''Stream handle in u'<Skypename>:<n>' format.
+ doc="""Stream handle in u'<Skypename>:<n>' format.
- @type: unicode
- ''')
+ :type: str
+ """)
def _GetPartnerHandle(self):
- return self._Handle.split(':')[0]
+ return self.Handle.split(':')[0]
PartnerHandle = property(_GetPartnerHandle,
- doc='''Skypename of the user this stream is connected to.
+ doc="""Skypename of the user this stream is connected to.
- @type: unicode
- ''')
+ :type: str
+ """)
+
+
+class ApplicationStreamCollection(CachedCollection):
+ _CachedType = ApplicationStream
Modified: software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/call.py
===================================================================
--- software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/call.py 2009-10-01 12:21:30 UTC (rev 5577)
+++ software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/call.py 2009-10-01 12:23:33 UTC (rev 5578)
@@ -1,644 +1,709 @@
-'''Calls, conferences.
-'''
+"""Calls, conferences.
+"""
+__docformat__ = 'restructuredtext en'
+
+from types import NoneType
+
from utils import *
from enums import *
-from errors import *
-class ICall(Cached):
- '''Represents a voice/video call.
- '''
+class DeviceMixin(object):
+ def _Device(self, Name, DeviceType=None, Set=NoneType):
+ args = args2dict(self._Property(Name, Cache=False))
+ if Set is NoneType:
+ for dev, value in args.items():
+ try:
+ args[dev] = int(value)
+ except ValueError:
+ pass
+ if DeviceType is None:
+ return args
+ return args.get(DeviceType, None)
+ elif DeviceType is None:
+ raise TypeError('DeviceType must be specified if Set is used')
+ if Set:
+ args[DeviceType] = tounicode(Set)
+ else:
+ args.pop(DeviceType, None)
+ for dev, value in args.items():
+ args[dev] = quote(value, True)
+ self._Alter('SET_%s' % Name,
+ ', '.join('%s=%s' % item for item in args.items()))
+ def CaptureMicDevice(self, DeviceType=None, Set=NoneType):
+ """Queries or sets the mic capture device.
+
+ :Parameters:
+ DeviceType : `enums`.callIoDeviceType* or None
+ Mic capture device type.
+ Set
+ Value the device should be set to or None if it should be deactivated.
+
+ Querying all active devices:
+ Devices = CaptureMicDevice()
+
+ Returns a mapping of device types to their values. Only active devices are
+ returned.
+
+ Querying a specific device:
+ Value = CaptureMicDevice(DeviceType)
+
+ Returns a device value for the given DeviceType.
+
+ Setting a device value:
+ CaptureMicDevice(DeviceType, Value)
+
+ If Value is None, the device will be deactivated.
+
+ :note: This command functions for active calls only.
+ """
+ return self._Device('CAPTURE_MIC', DeviceType, Set)
+
+ def InputDevice(self, DeviceType=None, Set=NoneType):
+ """Queries or sets the sound input device.
+
+ :Parameters:
+ DeviceType : `enums`.callIoDeviceType* or None
+ Sound input device type.
+ Set
+ Value the device should be set to or None if it should be deactivated.
+
+ Querying all active devices:
+ Devices = InputDevice()
+
+ Returns a mapping of device types to their values. Only active devices are
+ returned.
+
+ Querying a specific device:
+ Value = InputDevice(DeviceType)
+
+ Returns a device value for the given DeviceType.
+
+ Setting a device value:
+ InputDevice(DeviceType, Value)
+
+ If Value is None, the device will be deactivated.
+
+ :note: This command functions for active calls only.
+ """
+ return self._Device('INPUT', DeviceType, Set)
+
+ def OutputDevice(self, DeviceType=None, Set=NoneType):
+ """Queries or sets the sound output device.
+
+ :Parameters:
+ DeviceType : `enums`.callIoDeviceType* or None
+ Sound output device type.
+ Set
+ Value the device should be set to or None if it should be deactivated.
+
+ Querying all active devices:
+ Devices = OutputDevice()
+
+ Returns a mapping of device types to their values. Only active devices are
+ returned.
+
+ Querying a specific device:
+ Value = OutputDevice(DeviceType)
+
+ Returns a device value for the given DeviceType.
+
+ Setting a device value:
+ OutputDevice(DeviceType, Value)
+
+ If Value is None, the device will be deactivated.
+
+ :note: This command functions for active calls only.
+ """
+ return self._Device('OUTPUT', DeviceType, Set)
+
+
+class Call(Cached, DeviceMixin):
+ """Represents a voice/video call.
+ """
+ _ValidateHandle = int
+
def __repr__(self):
- return '<%s with Id=%s>' % (Cached.__repr__(self)[1:-1], repr(self.Id))
+ return Cached.__repr__(self, 'Id')
def _Alter(self, AlterName, Args=None):
- return self._Skype._Alter('CALL', self._Id, AlterName, Args)
+ return self._Owner._Alter('CALL', self.Id, AlterName, Args)
- def _Init(self, Id, Skype):
- self._Skype = Skype
- self._Id = int(Id)
+ def _Init(self):
+ self._MakeOwner()
def _Property(self, PropName, Set=None, Cache=True):
- return self._Skype._Property('CALL', self._Id, PropName, Set, Cache)
+ return self._Owner._Property('CALL', self.Id, PropName, Set, Cache)
def Answer(self):
- '''Answers the call.
- '''
- self._Property('STATUS', 'INPROGRESS')
+ """Answers the call.
+ """
+ #self._Property('STATUS', 'INPROGRESS')
+ self._Alter('ANSWER')
def CanTransfer(self, Target):
- '''Queries if a call can be transferred to a contact or phone number.
+ """Queries if a call can be transferred to a contact or phone number.
- @param Target: Skypename or phone number the call is to be transfered to.
- @type Target: unicode
- @return: True if call can be transfered, False otherwise.
- @rtype: bool
- '''
+ :Parameters:
+ Target : str
+ Skypename or phone number the call is to be transferred to.
+
+ :return: True if call can be transferred, False otherwise.
+ :rtype: bool
+ """
return self._Property('CAN_TRANSFER %s' % Target) == 'TRUE'
- def CaptureMicDevice(self, DeviceType=None, Set=None):
- '''Queries or sets the mic capture device.
-
- @param DeviceType: Mic capture device type or None.
- @type DeviceType: L{Call IO device type<enums.callIoDeviceTypeUnknown>} or None
- @param Set: Value the device should be set to or None.
- @type Set: unicode, int or None
- @return: If DeviceType and Set are None, returns a dictionary of device types and their
- values. Dictionary contains only those device types, whose values were set. If the
- DeviceType is not None but Set is None, returns the current value of the device or
- None if the device wasn't set. If Set is not None, sets a new value for the device.
- @rtype: unicode, dict or None
-
- @note: This command functions for active calls only.
- '''
- if Set == None: # get
- args = args2dict(self._Property('CAPTURE_MIC', Cache=False))
- for t in args:
- if t == callIoDeviceTypePort:
- args[t] = int(args[t])
- if DeviceType == None: # get active devices
- return args
- return args.get(DeviceType, None)
- elif DeviceType != None: # set
- self._Alter('SET_CAPTURE_MIC', '%s=%s' % (DeviceType, quote(unicode(Set), True)))
- else:
- raise TypeError('DeviceType must be specified if Set is used')
-
def Finish(self):
- '''Ends the call.
- '''
- self._Property('STATUS', 'FINISHED')
+ """Ends the call.
+ """
+ #self._Property('STATUS', 'FINISHED')
+ self._Alter('END', 'HANGUP')
def Forward(self):
- '''Forwards a call.
- '''
+ """Forwards a call.
+ """
self._Alter('END', 'FORWARD_CALL')
def Hold(self):
- '''Puts the call on hold.
- '''
- self._Property('STATUS', 'ONHOLD')
+ """Puts the call on hold.
+ """
+ #self._Property('STATUS', 'ONHOLD')
+ self._Alter('HOLD')
- def InputDevice(self, DeviceType=None, Set=None):
- '''Queries or sets the sound input device.
+ def Join(self, Id):
+ """Joins with another call to form a conference.
- @param DeviceType: Sound input device type or None.
- @type DeviceType: L{Call IO device type<enums.callIoDeviceTypeUnknown>} or None
- @param Set: Value the device should be set to or None.
- @type Set: unicode, int or None
- @return: If DeviceType and Set are None, returns a dictionary of device types and their
- values. Dictionary contains only those device types, whose values were set. If the
- DeviceType is not None but Set is None, returns the current value of the device or
- None if the device wasn't set. If Set is not None, sets a new value for the device.
- @rtype: unicode, dict or None
+ :Parameters:
+ Id : int
+ Call Id of the other call to join to the conference.
- @note: This command functions for active calls only.
- '''
- if Set == None: # get
- args = args2dict(self._Property('INPUT', Cache=False))
- for t in args:
- if t == callIoDeviceTypePort:
- args[t] = int(args[t])
- if DeviceType == None: # get active devices
- return args
- return args.get(DeviceType, None)
- elif DeviceType != None: # set
- self._Alter('SET_INPUT', '%s=%s' % (DeviceType, quote(unicode(Set), True)))
- else:
- raise TypeError('DeviceType must be specified if Set is used')
+ :return: Conference object.
+ :rtype: `Conference`
+ """
+ #self._Alter('JOIN_CONFERENCE', Id)
+ reply = self._Owner._DoCommand('SET CALL %s JOIN_CONFERENCE %s' % (self.Id, Id),
+ 'CALL %s CONF_ID' % self.Id)
+ return Conference(self._Owner, reply.split()[-1])
- def Join(self, Id):
- '''Joins with another call to form a conference.
-
- @param Id: Call Id of the other call to join to the conference.
- @type Id: int
- @return: Conference object.
- @rtype: L{IConference}
- '''
- reply = self._Skype._DoCommand('SET CALL %s JOIN_CONFERENCE %s' % (self._Id, Id),
- 'CALL %s CONF_ID' % self._Id)
- return IConference(reply.split()[-1], self._Skype)
-
def MarkAsSeen(self):
- '''Marks the call as seen.
- '''
+ """Marks the call as seen.
+ """
self.Seen = True
- def OutputDevice(self, DeviceType=None, Set=None):
- '''Queries or sets the sound output device.
-
- @param DeviceType: Sound output device type or None.
- @type DeviceType: L{Call IO device type<enums.callIoDeviceTypeUnknown>} or None
- @param Set: Value the device should be set to or None.
- @type Set: unicode, int or None
- @return: If DeviceType and Set are None, returns a dictionary of device types and their
- values. Dictionary contains only those device types, whose values were set. If the
- DeviceType is not None but Set is None, returns the current value of the device or
- None if the device wasn't set. If Set is not None, sets a new value for the device.
- @rtype: unicode, dict or None
-
- @note: This command functions for active calls only.
- '''
- if Set == None: # get
- args = args2dict(self._Property('OUTPUT', Cache=False))
- for t in args:
- if t == callIoDeviceTypePort:
- args[t] = int(args[t])
- if DeviceType == None: # get active devices
- return args
- return args.get(DeviceType, None)
- elif DeviceType != None: # set
- self._Alter('SET_OUTPUT', '%s=%s' % (DeviceType, quote(unicode(Set), True)))
- else:
- raise TypeError('DeviceType must be specified if Set is used')
-
def RedirectToVoicemail(self):
- '''Redirects a call to voicemail.
- '''
+ """Redirects a call to voicemail.
+ """
self._Alter('END', 'REDIRECT_TO_VOICEMAIL')
def Resume(self):
- '''Resumes the held call.
- '''
- self.Answer()
+ """Resumes the held call.
+ """
+ #self.Answer()
+ self._Alter('RESUME')
def StartVideoReceive(self):
- '''Starts video receive.
- '''
+ """Starts video receive.
+ """
self._Alter('START_VIDEO_RECEIVE')
def StartVideoSend(self):
- '''Starts video send.
- '''
+ """Starts video send.
+ """
self._Alter('START_VIDEO_SEND')
def StopVideoReceive(self):
- '''Stops video receive.
- '''
+ """Stops video receive.
+ """
self._Alter('STOP_VIDEO_RECEIVE')
def StopVideoSend(self):
- '''Stops video send.
- '''
+ """Stops video send.
+ """
self._Alter('STOP_VIDEO_SEND')
def Transfer(self, *Targets):
- '''Transfers a call to one or more contacts or phone numbers.
+ """Transfers a call to one or more contacts or phone numbers.
- @param Targets: one or more phone numbers or Skypenames the call is beeing transferred to.
- @type Targets: unicode
- @see: L{CanTransfer}
+ :Parameters:
+ Targets : str
+ one or more phone numbers or Skypenames the call is being transferred to.
- @note: You can transfer an incoming call to a group by specifying more than one
- target, first one of the group to answer will get the call.
- '''
+ :note: You can transfer an incoming call to a group by specifying more than one target,
+ first one of the group to answer will get the call.
+ :see: `CanTransfer`
+ """
self._Alter('TRANSFER', ', '.join(Targets))
def _GetConferenceId(self):
return int(self._Property('CONF_ID'))
ConferenceId = property(_GetConferenceId,
- doc='''ConferenceId.
+ doc="""Conference Id.
- @type: int
- ''')
+ :type: int
+ """)
def _GetDatetime(self):
from datetime import datetime
return datetime.fromtimestamp(self.Timestamp)
Datetime = property(_GetDatetime,
- doc='''Date and time of the call.
+ doc="""Date and time of the call.
- @type: datetime.datetime
- @see: L{Timestamp}
- ''')
+ :type: datetime.datetime
- def _SetDTMF(self, value):
- self._Property('DTMF', value)
+ :see: `Timestamp`
+ """)
+ def _SetDTMF(self, Value):
+ self._Alter('DTMF', Value)
+
DTMF = property(fset=_SetDTMF,
- doc='''Set this property to send DTMF codes.
+ doc="""Set this property to send DTMF codes. Permitted symbols are: [0..9, #, \*].
- @type: unicode
+ :type: str
- @note: This command functions for active calls only.
- ''')
+ :note: This command functions for active calls only.
+ """)
def _GetDuration(self):
return int(self._Property('DURATION', Cache=False))
Duration = property(_GetDuration,
- doc='''Duration of the call in seconds.
+ doc="""Duration of the call in seconds.
- @type: int
- ''')
+ :type: int
+ """)
def _GetFailureReason(self):
return int(self._Property('FAILUREREASON'))
FailureReason = property(_GetFailureReason,
- doc='''Call failure reason. Read if L{Status} == L{clsFailed<enums.clsFailed>}.
+ doc="""Call failure reason. Read if `Status` == `enums.clsFailed`.
- @type: L{Call failure reason<enums.cfrUnknown>}
- ''')
+ :type: `enums`.cfr*
+ """)
def _GetForwardedBy(self):
- return self._Property('FORWARDED_BY')
+ return str(self._Property('FORWARDED_BY'))
ForwardedBy = property(_GetForwardedBy,
- doc='''Skypename of the user who forwarded a call.
+ doc="""Skypename of the user who forwarded a call.
- @type: unicode
- ''')
+ :type: str
+ """)
def _GetId(self):
- return self._Id
+ return self._Handle
Id = property(_GetId,
- doc='''Call Id.
+ doc="""Call Id.
- @type: int
- ''')
+ :type: int
+ """)
def _GetInputStatus(self):
- return self._Property('VAA_INPUT_STATUS') == 'TRUE'
+ return (self._Property('VAA_INPUT_STATUS') == 'TRUE')
InputStatus = property(_GetInputStatus,
- doc='''True if call voice input is enabled.
+ doc="""True if call voice input is enabled.
- @type: bool
- ''')
+ :type: bool
+ """)
def _GetParticipants(self):
count = int(self._Property('CONF_PARTICIPANTS_COUNT'))
- return tuple(IParticipant((self._Id, x), self._Skype) for x in xrange(count))
+ return ParticipantCollection(self, xrange(count))
Participants = property(_GetParticipants,
- doc='''Participants of a conference call not hosted by the user.
+ doc="""Participants of a conference call not hosted by the user.
- @type: tuple of L{IParticipant}
- ''')
+ :type: `ParticipantCollection`
+ """)
def _GetPartnerDisplayName(self):
return self._Property('PARTNER_DISPNAME')
PartnerDisplayName = property(_GetPartnerDisplayName,
- doc='''The DisplayName of the remote caller.
+ doc="""The DisplayName of the remote caller.
- @type: unicode
- ''')
+ :type: unicode
+ """)
def _GetPartnerHandle(self):
- return self._Property('PARTNER_HANDLE')
+ return str(self._Property('PARTNER_HANDLE'))
PartnerHandle = property(_GetPartnerHandle,
- doc='''The Skypename of the remote caller.
+ doc="""The Skypename of the remote caller.
- @type: unicode
- ''')
+ :type: str
+ """)
def _GetPstnNumber(self):
- return self._Property('PSTN_NUMBER')
+ return str(self._Property('PSTN_NUMBER'))
PstnNumber = property(_GetPstnNumber,
- doc='''PSTN number of the call.
+ doc="""PSTN number of the call.
- @type: unicode
- ''')
+ :type: str
+ """)
def _GetPstnStatus(self):
return self._Property('PSTN_STATUS')
PstnStatus = property(_GetPstnStatus,
- doc='''PSTN number status.
+ doc="""PSTN number status.
- @type: unicode
- ''')
+ :type: unicode
+ """)
def _GetRate(self):
return int(self._Property('RATE'))
Rate = property(_GetRate,
- doc='''Call rate. Expressed using L{RatePrecision}. If you're just interested in the call rate
- expressed in current currency, use L{RateValue} instead.
+ doc="""Call rate. Expressed using `RatePrecision`. If you're just interested in the call rate
+ expressed in current currency, use `RateValue` instead.
- @type: int
- @see: L{RateCurrency}, L{RatePrecision}, L{RateToText}, L{RateValue}
- ''')
+ :type: int
+ :see: `RateCurrency`, `RatePrecision`, `RateToText`, `RateValue`
+ """)
+
def _GetRateCurrency(self):
return self._Property('RATE_CURRENCY')
RateCurrency = property(_GetRateCurrency,
- doc='''Call rate currency.
+ doc="""Call rate currency.
- @type: unicode
- @see: L{Rate}, L{RatePrecision}, L{RateToText}, L{RateValue}
- ''')
+ :type: unicode
+ :see: `Rate`, `RatePrecision`, `RateToText`, `RateValue`
+ """)
+
def _GetRatePrecision(self):
return int(self._Property('RATE_PRECISION'))
RatePrecision = property(_GetRatePrecision,
- doc='''Call rate precision. Expressed as a number of times the call rate has to be divided by 10.
+ doc="""Call rate precision. Expressed as a number of times the call rate has to be divided by 10.
- @type: int
- @see: L{Rate}, L{RateCurrency}, L{RateToText}, L{RateValue}
- ''')
+ :type: int
+ :see: `Rate`, `RateCurrency`, `RateToText`, `RateValue`
+ """)
+
def _GetRateToText(self):
return (u'%s %.3f' % (self.RateCurrency, self.RateValue)).strip()
RateToText = property(_GetRateToText,
- doc='''Returns the call rate as a text with currency and properly formatted value.
+ doc="""Returns the call rate as a text with currency and properly formatted value.
- @type: unicode
- @see: L{Rate}, L{RateCurrency}, L{RatePrecision}, L{RateValue}
- ''')
+ :type: unicode
+ :see: `Rate`, `RateCurrency`, `RatePrecision`, `RateValue`
+ """)
+
def _GetRateValue(self):
if self.Rate < 0:
return 0.0
return float(self.Rate) / (10 ** self.RatePrecision)
RateValue = property(_GetRateValue,
- doc='''Call rate value. Expressed in current currency.
+ doc="""Call rate value. Expressed in current currency.
- @type: float
- @see: L{Rate}, L{RateCurrency}, L{RatePrecision}, L{RateToText}
- ''')
+ :type: float
+ :see: `Rate`, `RateCurrency`, `RatePrecision`, `RateToText`
+ """)
+
def _GetSeen(self):
- return self._Property('SEEN') == 'TRUE'
+ return (self._Property('SEEN') == 'TRUE')
- def _SetSeen(self, value):
- self._Property('SEEN', cndexp(value, 'TRUE', 'FALSE'))
+ def _SetSeen(self, Value):
+ self._Property('SEEN', cndexp(Value, 'TRUE', 'FALSE'))
Seen = property(_GetSeen, _SetSeen,
- doc='''Queries/sets the seen status of the call. True if the call was seen, False otherwise.
+ doc="""Queries/sets the seen status of the call. True if the call was seen, False otherwise.
- @type: bool
-
- @note: You cannot alter the call seen status from seen to unseen.
- ''')
+ :type: bool
+ :note: You cannot alter the call seen status from seen to unseen.
+ """)
+
def _GetStatus(self):
- return self._Property('STATUS')
+ return str(self._Property('STATUS'))
- def _SetStatus(self, value):
- self._Property('STATUS', str(value))
+ def _SetStatus(self, Value):
+ self._Property('STATUS', str(Value))
Status = property(_GetStatus, _SetStatus,
- doc='''The call status.
+ doc="""The call status.
- @type: L{Call status<enums.clsUnknown>}
- ''')
+ :type: `enums`.cls*
+ """)
def _GetSubject(self):
return self._Property('SUBJECT')
Subject = property(_GetSubject,
- doc='''Call subject.
+ doc="""Call subject.
- @type: unicode
- ''')
+ :type: unicode
+ """)
- def _GetTargetIdentify(self):
- return self._Property('TARGET_IDENTIFY')
+ def _GetTargetIdentity(self):
+ return str(self._Property('TARGET_IDENTITY'))
- TargetIdentify = property(_GetTargetIdentify,
- doc='''Target number for incoming SkypeIn calls.
+ TargetIdentity = property(_GetTargetIdentity,
+ doc="""Target number for incoming SkypeIn calls.
- @type: unicode
- ''')
+ :type: str
+ """)
def _GetTimestamp(self):
return float(self._Property('TIMESTAMP'))
Timestamp = property(_GetTimestamp,
- doc='''Call date and time expressed as a timestamp.
+ doc="""Call date and time expressed as a timestamp.
- @type: float
- @see: L{Datetime}
- ''')
+ :type: float
+ :see: `Datetime`
+ """)
+
def _GetTransferActive(self):
return self._Property('TRANSFER_ACTIVE') == 'TRUE'
TransferActive = property(_GetTransferActive,
- doc='''Returns True if the call has been transfered.
+ doc="""Returns True if the call has been transferred.
- @type: bool
- ''')
+ :type: bool
+ """)
def _GetTransferredBy(self):
- return self._Property('TRANSFERRED_BY')
+ return str(self._Property('TRANSFERRED_BY'))
TransferredBy = property(_GetTransferredBy,
- doc='''Returns the Skypename of the user who transferred the call.
+ doc="""Returns the Skypename of the user who transferred the call.
- @type: unicode
- ''')
+ :type: str
+ """)
def _GetTransferredTo(self):
- return self._Property('TRANSFERRED_TO')
+ return str(self._Property('TRANSFERRED_TO'))
TransferredTo = property(_GetTransferredTo,
- doc='''Returns the Skypename of the user or phone number the call has been transferred to.
+ doc="""Returns the Skypename of the user or phone number the call has been transferred to.
- @type: unicode
- ''')
+ :type: str
+ """)
def _GetTransferStatus(self):
- return self._Property('TRANSFER_STATUS')
+ return str(self._Property('TRANSFER_STATUS'))
TransferStatus = property(_GetTransferStatus,
- doc='''Returns the call transfer status.
+ doc="""Returns the call transfer status.
- @type: L{Call status<enums.clsUnknown>}
- ''')
+ :type: `enums`.cls*
+ """)
def _GetType(self):
- return self._Property('TYPE')
+ return str(self._Property('TYPE'))
Type = property(_GetType,
- doc='''Call type.
+ doc="""Call type.
- @type: L{Call type<enums.cltUnknown>}
- ''')
+ :type: `enums`.clt*
+ """)
def _GetVideoReceiveStatus(self):
- return self._Property('VIDEO_RECEIVE_STATUS')
+ return str(self._Property('VIDEO_RECEIVE_STATUS'))
VideoReceiveStatus = property(_GetVideoReceiveStatus,
- doc='''Call video receive status.
+ doc="""Call video receive status.
- @type: L{Call video send status<enums.vssUnknown>}
- ''')
+ :type: `enums`.vss*
+ """)
def _GetVideoSendStatus(self):
- return self._Property('VIDEO_SEND_STATUS')
+ return str(self._Property('VIDEO_SEND_STATUS'))
VideoSendStatus = property(_GetVideoSendStatus,
- doc='''Call video send status.
+ doc="""Call video send status.
- @type: L{Call video send status<enums.vssUnknown>}
- ''')
+ :type: `enums`.vss*
+ """)
def _GetVideoStatus(self):
- return self._Property('VIDEO_STATUS')
+ return str(self._Property('VIDEO_STATUS'))
VideoStatus = property(_GetVideoStatus,
- doc='''Call video status.
+ doc="""Call video status.
- @type: L{Call video status<enums.cvsUnknown>}
- ''')
+ :type: `enums`.cvs*
+ """)
def _GetVmAllowedDuration(self):
return int(self._Property('VM_ALLOWED_DURATION'))
VmAllowedDuration = property(_GetVmAllowedDuration,
- doc='''Returns the permitted duration of a voicemail in seconds.
+ doc="""Returns the permitted duration of a voicemail in seconds.
- @type: int
- ''')
+ :type: int
+ """)
def _GetVmDuration(self):
return int(self._Property('VM_DURATION'))
VmDuration = property(_GetVmDuration,
- doc='''Returns the duration of a voicemail.
+ doc="""Returns the duration of a voicemail.
- @type: int
- ''')
+ :type: int
+ """)
-class IParticipant(Cached):
- '''Represents a conference call participant.
- '''
+class CallCollection(CachedCollection):
+ _CachedType = Call
+
+class Participant(Cached):
+ """Represents a conference call participant.
+ """
+ _ValidateHandle = int
+
def __repr__(self):
- return '<%s with Id=%s, Idx=%s, Handle=%s>' % (Cached.__repr__(self)[1:-1], repr(self.Id), repr(self.Idx), repr(self.Handle))
+ return Cached.__repr__(self, 'Id', 'Idx', 'Handle')
- def _Init(self, (Id, Idx), Skype):
- self._Skype = Skype
- self._Id = int(Id)
- self._Idx = int(Idx)
-
def _Property(self, Prop):
- reply = self._Skype._Property('CALL', self._Id, 'CONF_PARTICIPANT %d' % self._Idx)
+ # Prop: 0 = user name, 1 = call type, 2 = call status, 3 = display name
+ reply = self._Owner._Property('CONF_PARTICIPANT %d' % self.Idx)
return chop(reply, 3)[Prop]
+ def _GetCall(self):
+ return self._Owner
+
+ Call = property(_GetCall,
+ doc="""Call object.
+
+ :type: `Call`
+ """)
+
def _GetCallStatus(self):
- return self._Property(2)
+ return str(self._Property(2))
CallStatus = property(_GetCallStatus,
- doc='''Call status of a participant in a conference call.
+ doc="""Call status of a participant in a conference call.
- @type: L{Call status<enums.clsUnknown>}
- ''')
+ :type: `enums`.cls*
+ """)
def _GetCallType(self):
- return self._Property(1)
+ return str(self._Property(1))
CallType = property(_GetCallType,
- doc='''Call type in a conference call.
+ doc="""Call type in a conference call.
- @type: L{Call type<enums.cltUnknown>}
- ''')
+ :type: `enums`.clt*
+ """)
def _GetDisplayName(self):
return self._Property(3)
DisplayName = property(_GetDisplayName,
- doc='''DisplayName of a participant in a conference call.
+ doc="""DisplayName of a participant in a conference call.
- @type: unicode
- ''')
+ :type: unicode
+ """)
def _GetHandle(self):
- return self._Property(0)
+ return str(self._Property(0))
Handle = property(_GetHandle,
- doc='''Skypename of a participant in a conference call.
+ doc="""Skypename of a participant in a conference call.
- @type: unicode
- ''')
+ :type: str
+ """)
def _GetId(self):
- return self._Id
+ return self._Owner.Id
Id = property(_GetId,
- doc='''Call Id.
+ doc="""Call Id.
- @type: int
- ''')
+ :type: int
+ """)
def _GetIdx(self):
- return self._Idx
+ return self._Handle
Idx = property(_GetIdx,
- doc='''Call participant index.
+ doc="""Call participant index.
- @type: int
- ''')
+ :type: int
+ """)
-class IConference(Cached):
- '''Represents a conference call.
- '''
+class ParticipantCollection(CachedCollection):
+ _CachedType = Participant
+
+class Conference(Cached):
+ """Represents a conference call.
+ """
+ _ValidateHandle = int
+
def __repr__(self):
- return '<%s with Id=%s>' % (Cached.__repr__(self)[1:-1], repr(self.Id))
+ return Cached.__repr__(self, 'Id')
- def _Init(self, Id, Skype):
- self._Skype = Skype
- self._Id = int(Id)
-
def Finish(self):
- '''Finishes a conference so all active calls have the status L{clsFinished<enums.clsFinished>}.
- '''
+ """Finishes a conference so all active calls have the status
+ `enums.clsFinished`.
+ """
for c in self._GetCalls():
c.Finish()
def Hold(self):
- '''Places all calls in a conference on hold so all active calls have the status L{clsLocalHold<enums.clsLocalHold>}.
- '''
+ """Places all calls in a conference on hold so all active calls
+ have the status `enums.clsLocalHold`.
+ """
for c in self._GetCalls():
c.Hold()
def Resume(self):
- '''Resumes a conference that was placed on hold so all active calls have the status L{clsInProgress<enums.clsInProgress>}.
- '''
+ """Resumes a conference that was placed on hold so all active calls
+ have the status `enums.clsInProgress`.
+ """
for c in self._GetCalls():
c.Resume()
def _GetActiveCalls(self):
- return tuple(x for x in self._Skype.ActiveCalls if x.ConferenceId == self._Id)
+ return CallCollection(self._Owner, (x.Id for x in self._Owner.ActiveCalls if x.ConferenceId == self.Id))
ActiveCalls = property(_GetActiveCalls,
- doc='''Active calls with the same conference ID.
+ doc="""Active calls with the same conference ID.
- @type: tuple of L{ICall}
- ''')
+ :type: `CallCollection`
+ """)
def _GetCalls(self):
- return tuple(x for x in self._Skype.Calls() if x.ConferenceId == self._Id)
+ return CallCollection(self._Owner, (x.Id for x in self._Owner.Calls() if x.ConferenceId == self.Id))
Calls = property(_GetCalls,
- doc='''Calls with the same conference ID.
+ doc="""Calls with the same conference ID.
- @type: tuple of L{ICall}
- ''')
+ :type: `CallCollection`
+ """)
def _GetId(self):
- return self._Id
+ return self._Handle
Id = property(_GetId,
- doc='''Id of a conference.
+ doc="""Id of a conference.
- @type: int
- ''')
+ :type: int
+ """)
+
+
+class ConferenceCollection(CachedCollection):
+ _CachedType = Conference
Modified: software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/callchannel.py
===================================================================
--- software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/callchannel.py 2009-10-01 12:21:30 UTC (rev 5577)
+++ software_suite_v3/software/plugin/plugin-skype/trunk/executables/Skype4Py/callchannel.py 2009-10-01 12:23:33 UTC (rev 5578)
@@ -1,327 +1,322 @@
-'''Data channels for calls.
-'''
+"""Data channels for calls.
+"""
+__docformat__ = 'restructuredtext en'
+
+import time
+from copy import copy
+
from utils import *
from enums import *
-from errors import *
-import time
+from errors import SkypeError
-class ICallChannel(object):
- '''Represents a call channel.
- '''
+class CallChannelManager(EventHandlingBase):
+ """Instantiate this class to create a call channel manager. A call channel manager will
+ automatically create a data channel (based on the APP2APP protocol) for voice calls.
- def __init__(self, Manager, Call, Stream, Type):
- '''__init__.
+ Usage
+ =====
- @param Manager: Manager
- @type Manager: L{ICallChannelManager}
- @param Call: Call
- @type Call: L{ICall}
- @param Stream: Stream
- @type Stream: L{IApplicationStream}
- @param Type: Type
- @type Type: L{Call channel type<enums.cctUnknown>}
- '''
- self._Manager = Manager
- self._Call = Call
- self._Stream = Stream
- self._Type = Type
+ You should access this class using the alias at the package level:
+
+ .. python::
- def __repr__(self):
- return '<%s with Manager=%s, Call=%s, Stream=%s>' % (object.__repr__(self)[1:-1], repr(self.Manager), repr(self.Call), repr(self.Stream))
+ import Skype4Py
- def SendTextMessage(self, Text):
- '''Sends text message over channel.
+ skype = Skype4Py.Skype()
- @param Text: Text
- @type Text: unicode
- '''
- if self._Type == cctReliable:
- self._Stream.Write(Text)
- elif self._Type == cctDatagram:
- self._Stream.SendDatagram(Text)
- else:
- raise ISkypeError(0, 'Cannot send using %s channel type' & repr(self._Type))
+ ccm = Skype4Py.CallChannelManager()
+ ccm.Connect(skype)
- def _GetCall(self):
- return self._Call
+ Read the constructor (`CallChannelManager.__init__`) documentation for a list of
+ accepted arguments.
- Call = property(_GetCall,
- doc='''Call.
+ Events
+ ======
- @type: L{ICall}
- ''')
+ This class provides events.
- def _GetManager(self):
- return self._Manager
+ The events names and their arguments lists can be found in the
+ `CallChannelManagerEvents` class in this module.
- Manager = property(_GetManager,
- doc='''Manager.
+ The use of events is explained in `EventHandlingBase` class which
+ is a superclass of this class.
+ """
- @type: L{ICallChannelManager}
- ''')
-
- def _GetStream(self):
- return self._Stream
-
- Stream = property(_GetStream,
- doc='''Stream.
-
- @type: L{IApplicationStream}
- ''')
-
- def _GetType(self):
- return self._Type
-
- Type = property(_GetType,
- doc='''Type.
-
- @type: L{Call channel type<enums.cctUnknown>}
- ''')
-
-
-class ICallChannelManager(EventHandlingBase):
- '''Instatinate this class to create a call channel manager. A call channel manager will
- automatically create a data channel for voice calls base...
[truncated message content] |