Package Skype4Py :: Module skype
[frames] | no frames]

Source Code for Module Skype4Py.skype

   1  """Main Skype interface. 
   2  """ 
   3  __docformat__ = 'restructuredtext en' 
   4   
   5   
   6  import threading 
   7  import weakref 
   8  import logging 
   9   
  10  from api import * 
  11  from errors import * 
  12  from enums import * 
  13  from utils import * 
  14  from conversion import * 
  15  from client import * 
  16  from user import * 
  17  from call import * 
  18  from profile import * 
  19  from settings import * 
  20  from chat import * 
  21  from application import * 
  22  from voicemail import * 
  23  from sms import * 
  24  from filetransfer import * 
  25   
  26   
27 -class APINotifier(SkypeAPINotifier):
28 - def __init__(self, skype):
29 self.skype = weakref.proxy(skype)
30
31 - def attachment_changed(self, status):
32 try: 33 self.skype._CallEventHandler('AttachmentStatus', status) 34 if status == apiAttachRefused: 35 raise SkypeAPIError('Skype connection refused') 36 except weakref.ReferenceError: 37 pass
38
39 - def notification_received(self, notification):
40 try: 41 skype = self.skype 42 skype._CallEventHandler('Notify', notification) 43 a, b = chop(notification) 44 object_type = None 45 # if..elif handling cache and most event handlers 46 if a in ('CALL', 'USER', 'GROUP', 'CHAT', 'CHATMESSAGE', 'CHATMEMBER', 'VOICEMAIL', 'APPLICATION', 'SMS', 'FILETRANSFER'): 47 object_type, object_id, prop_name, value = [a] + chop(b, 2) 48 skype._CacheDict[str(object_type), str(object_id), str(prop_name)] = value 49 if object_type == 'USER': 50 o = User(skype, object_id) 51 if prop_name == 'ONLINESTATUS': 52 skype._CallEventHandler('OnlineStatus', o, str(value)) 53 elif prop_name == 'MOOD_TEXT' or prop_name == 'RICH_MOOD_TEXT': 54 skype._CallEventHandler('UserMood', o, value) 55 elif prop_name == 'RECEIVEDAUTHREQUEST': 56 skype._CallEventHandler('UserAuthorizationRequestReceived', o) 57 elif object_type == 'CALL': 58 o = Call(skype, object_id) 59 if prop_name == 'STATUS': 60 skype._CallEventHandler('CallStatus', o, str(value)) 61 elif prop_name == 'SEEN': 62 skype._CallEventHandler('CallSeenStatusChanged', o, (value == 'TRUE')) 63 elif prop_name == 'VAA_INPUT_STATUS': 64 skype._CallEventHandler('CallInputStatusChanged', o, (value == 'TRUE')) 65 elif prop_name == 'TRANSFER_STATUS': 66 skype._CallEventHandler('CallTransferStatusChanged', o, str(value)) 67 elif prop_name == 'DTMF': 68 skype._CallEventHandler('CallDtmfReceived', o, str(value)) 69 elif prop_name == 'VIDEO_STATUS': 70 skype._CallEventHandler('CallVideoStatusChanged', o, str(value)) 71 elif prop_name == 'VIDEO_SEND_STATUS': 72 skype._CallEventHandler('CallVideoSendStatusChanged', o, str(value)) 73 elif prop_name == 'VIDEO_RECEIVE_STATUS': 74 skype._CallEventHandler('CallVideoReceiveStatusChanged', o, str(value)) 75 elif object_type == 'CHAT': 76 o = Chat(skype, object_id) 77 if prop_name == 'MEMBERS': 78 skype._CallEventHandler('ChatMembersChanged', o, UserCollection(skype, split(value))) 79 if prop_name in ('OPENED', 'CLOSED'): 80 skype._CallEventHandler('ChatWindowState', o, (prop_name == 'OPENED')) 81 elif object_type == 'CHATMEMBER': 82 o = ChatMember(skype, object_id) 83 if prop_name == 'ROLE': 84 skype._CallEventHandler('ChatMemberRoleChanged', o, str(value)) 85 elif object_type == 'CHATMESSAGE': 86 o = ChatMessage(skype, object_id) 87 if prop_name == 'STATUS': 88 skype._CallEventHandler('MessageStatus', o, str(value)) 89 elif object_type == 'APPLICATION': 90 o = Application(skype, object_id) 91 if prop_name == 'CONNECTING': 92 skype._CallEventHandler('ApplicationConnecting', o, UserCollection(skype, split(value))) 93 elif prop_name == 'STREAMS': 94 skype._CallEventHandler('ApplicationStreams', o, ApplicationStreamCollection(o, split(value))) 95 elif prop_name == 'DATAGRAM': 96 handle, text = chop(value) 97 skype._CallEventHandler('ApplicationDatagram', o, ApplicationStream(o, handle), text) 98 elif prop_name == 'SENDING': 99 skype._CallEventHandler('ApplicationSending', o, ApplicationStreamCollection(o, (x.split('=')[0] for x in split(value)))) 100 elif prop_name == 'RECEIVED': 101 skype._CallEventHandler('ApplicationReceiving', o, ApplicationStreamCollection(o, (x.split('=')[0] for x in split(value)))) 102 elif object_type == 'GROUP': 103 o = Group(skype, object_id) 104 if prop_name == 'VISIBLE': 105 skype._CallEventHandler('GroupVisible', o, (value == 'TRUE')) 106 elif prop_name == 'EXPANDED': 107 skype._CallEventHandler('GroupExpanded', o, (value == 'TRUE')) 108 elif prop_name == 'NROFUSERS': 109 skype._CallEventHandler('GroupUsers', o, int(value)) 110 elif object_type == 'SMS': 111 o = SmsMessage(skype, object_id) 112 if prop_name == 'STATUS': 113 skype._CallEventHandler('SmsMessageStatusChanged', o, str(value)) 114 elif prop_name == 'TARGET_STATUSES': 115 for t in split(value, ', '): 116 number, status = t.split('=') 117 skype._CallEventHandler('SmsTargetStatusChanged', SmsTarget(o, number), str(status)) 118 elif object_type == 'FILETRANSFER': 119 o = FileTransfer(skype, object_id) 120 if prop_name == 'STATUS': 121 skype._CallEventHandler('FileTransferStatusChanged', o, str(value)) 122 elif object_type == 'VOICEMAIL': 123 o = Voicemail(skype, object_id) 124 if prop_name == 'STATUS': 125 skype._CallEventHandler('VoicemailStatus', o, str(value)) 126 elif a in ('PROFILE', 'PRIVILEGE'): 127 object_type, object_id, prop_name, value = [a, ''] + chop(b) 128 skype._CacheDict[str(object_type), str(object_id), str(prop_name)] = value 129 elif a in ('CURRENTUSERHANDLE', 'USERSTATUS', 'CONNSTATUS', 'PREDICTIVE_DIALER_COUNTRY', 'SILENT_MODE', 'AUDIO_IN', 'AUDIO_OUT', 'RINGER', 'MUTE', 'AUTOAWAY', 'WINDOWSTATE'): 130 object_type, object_id, prop_name, value = [a, '', '', b] 131 skype._CacheDict[str(object_type), str(object_id), str(prop_name)] = value 132 if object_type == 'MUTE': 133 skype._CallEventHandler('Mute', value == 'TRUE') 134 elif object_type == 'CONNSTATUS': 135 skype._CallEventHandler('ConnectionStatus', str(value)) 136 elif object_type == 'USERSTATUS': 137 skype._CallEventHandler('UserStatus', str(value)) 138 elif object_type == 'AUTOAWAY': 139 skype._CallEventHandler('AutoAway', (value == 'ON')) 140 elif object_type == 'WINDOWSTATE': 141 skype._CallEventHandler('ClientWindowState', str(value)) 142 elif object_type == 'SILENT_MODE': 143 skype._CallEventHandler('SilentModeStatusChanged', (value == 'ON')) 144 elif a == 'CALLHISTORYCHANGED': 145 skype._CallEventHandler('CallHistory') 146 elif a == 'IMHISTORYCHANGED': 147 skype._CallEventHandler('MessageHistory', '') # XXX: Arg is Skypename, which one? 148 elif a == 'CONTACTS': 149 prop_name, value = chop(b) 150 if prop_name == 'FOCUSED': 151 skype._CallEventHandler('ContactsFocused', str(value)) 152 elif a == 'DELETED': 153 prop_name, value = chop(b) 154 if prop_name == 'GROUP': 155 skype._CallEventHandler('GroupDeleted', int(value)) 156 elif a == 'EVENT': 157 object_id, prop_name, value = chop(b, 2) 158 if prop_name == 'CLICKED': 159 skype._CallEventHandler('PluginEventClicked', PluginEvent(skype, object_id)) 160 elif a == 'MENU_ITEM': 161 object_id, prop_name, value = chop(b, 2) 162 if prop_name == 'CLICKED': 163 i = value.rfind('CONTEXT ') 164 if i >= 0: 165 context = chop(value[i+8:])[0] 166 users = () 167 context_id = u'' 168 if context in (pluginContextContact, pluginContextCall, pluginContextChat): 169 users = UserCollection(skype, split(value[:i-1], ', ')) 170 if context in (pluginContextCall, pluginContextChat): 171 j = value.rfind('CONTEXT_ID ') 172 if j >= 0: 173 context_id = str(chop(value[j+11:])[0]) 174 if context == pluginContextCall: 175 context_id = int(context_id) 176 skype._CallEventHandler('PluginMenuItemClicked', PluginMenuItem(skype, object_id), users, str(context), context_id) 177 elif a == 'WALLPAPER': 178 skype._CallEventHandler('WallpaperChanged', unicode2path(b)) 179 except weakref.ReferenceError: 180 pass
181
182 - def sending_command(self, command):
183 try: 184 self.skype._CallEventHandler('Command', command) 185 except weakref.ReferenceError: 186 pass
187
188 - def reply_received(self, command):
189 try: 190 self.skype._CallEventHandler('Reply', command) 191 except weakref.ReferenceError: 192 pass
193 194
195 -class Skype(EventHandlingBase):
196 """The main class which you have to instantiate to get access to the Skype client 197 running currently in the background. 198 199 Usage 200 ===== 201 202 You should access this class using the alias at the package level: 203 204 .. python:: 205 206 import Skype4Py 207 208 skype = Skype4Py.Skype() 209 210 Read the constructor (`Skype.__init__`) documentation for a list of accepted 211 arguments. 212 213 Events 214 ====== 215 216 This class provides events. 217 218 The events names and their arguments lists can be found in the `SkypeEvents` 219 class in this module. 220 221 The use of events is explained in the `EventHandlingBase` class 222 which is a superclass of this class. 223 """ 224
225 - def __init__(self, Events=None, **Options):
226 """Initializes the object. 227 228 :Parameters: 229 Events 230 An optional object with event handlers. See `Skype4Py.utils.EventHandlingBase` 231 for more information on events. 232 Options 233 Additional options for low-level API handler. See the `Skype4Py.api` 234 subpackage for supported options. Available options may depend on the 235 current platform. Note that the current platform can be queried using 236 `Skype4Py.platform` variable. 237 """ 238 self._Logger = logging.getLogger('Skype4Py.skype.Skype') 239 self._Logger.info('object created') 240 241 EventHandlingBase.__init__(self) 242 if Events: 243 self._SetEventHandlerObj(Events) 244 245 try: 246 self._Api = Options.pop('Api') 247 if Options: 248 raise TypeError('No options supported with custom API objects.') 249 except KeyError: 250 self._Api = SkypeAPI(Options) 251 self._Api.set_notifier(APINotifier(self)) 252 253 Cached._CreateOwner(self) 254 255 self._Cache = True 256 self.ResetCache() 257 258 from api import DEFAULT_TIMEOUT 259 self._Timeout = DEFAULT_TIMEOUT 260 261 self._Convert = Conversion(self) 262 self._Client = Client(self) 263 self._Settings = Settings(self) 264 self._Profile = Profile(self)
265
266 - def __del__(self):
267 """Frees all resources. 268 """ 269 if hasattr(self, '_Api'): 270 self._Api.close() 271 272 self._Logger.info('object destroyed')
273
274 - def _DoCommand(self, Cmd, ExpectedReply=''):
275 command = Command(Cmd, ExpectedReply, True, self.Timeout) 276 self.SendCommand(command) 277 a, b = chop(command.Reply) 278 if a == 'ERROR': 279 errnum, errstr = chop(b) 280 self._CallEventHandler('Error', command, int(errnum), errstr) 281 raise SkypeError(int(errnum), errstr) 282 if not command.Reply.startswith(command.Expected): 283 raise SkypeError(0, 'Unexpected reply from Skype, got [%s], expected [%s (...)]' % \ 284 (command.Reply, command.Expected)) 285 return command.Reply
286
287 - def _Property(self, ObjectType, ObjectId, PropName, Set=None, Cache=True):
288 h = (str(ObjectType), str(ObjectId), str(PropName)) 289 arg = ('%s %s %s' % h).split() 290 while '' in arg: 291 arg.remove('') 292 jarg = ' '.join(arg) 293 if Set is None: # Get 294 if Cache and self._Cache and h in self._CacheDict: 295 return self._CacheDict[h] 296 value = self._DoCommand('GET %s' % jarg, jarg) 297 while arg: 298 try: 299 a, b = chop(value) 300 except ValueError: 301 break 302 if a.lower() != arg[0].lower(): 303 break 304 del arg[0] 305 value = b 306 if Cache and self._Cache: 307 self._CacheDict[h] = value 308 return value 309 else: # Set 310 value = unicode(Set) 311 self._DoCommand('SET %s %s' % (jarg, value), jarg) 312 if Cache and self._Cache: 313 self._CacheDict[h] = value
314
315 - def _Alter(self, ObjectType, ObjectId, AlterName, Args=None, Reply=None):
316 cmd = 'ALTER %s %s %s' % (str(ObjectType), str(ObjectId), str(AlterName)) 317 if Reply is None: 318 Reply = cmd 319 if Args is not None: 320 cmd = '%s %s' % (cmd, tounicode(Args)) 321 reply = self._DoCommand(cmd, Reply) 322 arg = cmd.split() 323 while arg: 324 try: 325 a, b = chop(reply) 326 except ValueError: 327 break 328 if a.lower() != arg[0].lower(): 329 break 330 del arg[0] 331 reply = b 332 return reply
333
334 - def _Search(self, ObjectType, Args=None):
335 cmd = 'SEARCH %s' % ObjectType 336 if Args is not None: 337 cmd = '%s %s' % (cmd, Args) 338 # It is safe to do str() as none of the searchable objects use non-ascii chars. 339 return split(chop(str(self._DoCommand(cmd)))[-1], ', ')
340
341 - def ApiSecurityContextEnabled(self, Context):
342 """Queries if an API security context for Internet Explorer is enabled. 343 344 :Parameters: 345 Context : unicode 346 API security context to check. 347 348 :return: True if the API security for the given context is enabled, False otherwise. 349 :rtype: bool 350 351 :warning: This functionality isn't supported by Skype4Py. 352 """ 353 self._Api.security_context_enabled(Context)
354
355 - def Application(self, Name):
356 """Queries an application object. 357 358 :Parameters: 359 Name : unicode 360 Application name. 361 362 :return: The application object. 363 :rtype: `application.Application` 364 """ 365 return Application(self, Name)
366
367 - def _AsyncSearchUsersReplyHandler(self, Command):
368 if Command in self._AsyncSearchUsersCommands: 369 self._AsyncSearchUsersCommands.remove(Command) 370 self._CallEventHandler('AsyncSearchUsersFinished', Command.Id, 371 UserCollection(self, split(chop(Command.Reply)[-1], ', '))) 372 if len(self._AsyncSearchUsersCommands) == 0: 373 self.UnregisterEventHandler('Reply', self._AsyncSearchUsersReplyHandler) 374 del self._AsyncSearchUsersCommands
375
376 - def AsyncSearchUsers(self, Target):
377 """Asynchronously searches for Skype users. 378 379 :Parameters: 380 Target : unicode 381 Search target (name or email address). 382 383 :return: A search identifier. It will be passed along with the results to the 384 `SkypeEvents.AsyncSearchUsersFinished` event after the search is completed. 385 :rtype: int 386 """ 387 if not hasattr(self, '_AsyncSearchUsersCommands'): 388 self._AsyncSearchUsersCommands = [] 389 self.RegisterEventHandler('Reply', self._AsyncSearchUsersReplyHandler) 390 command = Command('SEARCH USERS %s' % tounicode(Target), 'USERS', False, self.Timeout) 391 self._AsyncSearchUsersCommands.append(command) 392 self.SendCommand(command) 393 # return pCookie - search identifier 394 return command.Id
395
396 - def Attach(self, Protocol=5, Wait=True):
397 """Establishes a connection to Skype. 398 399 :Parameters: 400 Protocol : int 401 Minimal Skype protocol version. 402 Wait : bool 403 If set to False, blocks forever until the connection is established. Otherwise, timeouts 404 after the `Timeout`. 405 """ 406 try: 407 self._Api.protocol = Protocol 408 self._Api.attach(self.Timeout, Wait) 409 except SkypeAPIError: 410 self.ResetCache() 411 raise
412
413 - def Call(self, Id=0):
414 """Queries a call object. 415 416 :Parameters: 417 Id : int 418 Call identifier. 419 420 :return: Call object. 421 :rtype: `call.Call` 422 """ 423 o = Call(self, Id) 424 o.Status # Test if such a call exists. 425 return o
426
427 - def Calls(self, Target=''):
428 """Queries calls in call history. 429 430 :Parameters: 431 Target : str 432 Call target. 433 434 :return: Call objects. 435 :rtype: `CallCollection` 436 """ 437 return CallCollection(self, self._Search('CALLS', Target))
438
439 - def _ChangeUserStatus_UserStatus(self, Status):
440 if Status.upper() == self._ChangeUserStatus_Status: 441 self._ChangeUserStatus_Event.set()
442
443 - def ChangeUserStatus(self, Status):
444 """Changes the online status for the current user. 445 446 :Parameters: 447 Status : `enums`.cus* 448 New online status for the user. 449 450 :note: This function waits until the online status changes. Alternatively, use the 451 `CurrentUserStatus` property to perform an immediate change of status. 452 """ 453 if self.CurrentUserStatus.upper() == Status.upper(): 454 return 455 self._ChangeUserStatus_Event = threading.Event() 456 self._ChangeUserStatus_Status = Status.upper() 457 self.RegisterEventHandler('UserStatus', self._ChangeUserStatus_UserStatus) 458 self.CurrentUserStatus = Status 459 self._ChangeUserStatus_Event.wait() 460 self.UnregisterEventHandler('UserStatus', self._ChangeUserStatus_UserStatus) 461 del self._ChangeUserStatus_Event, self._ChangeUserStatus_Status
462
463 - def Chat(self, Name=''):
464 """Queries a chat object. 465 466 :Parameters: 467 Name : str 468 Chat name. 469 470 :return: A chat object. 471 :rtype: `chat.Chat` 472 """ 473 o = Chat(self, Name) 474 o.Status # Tests if such a chat really exists. 475 return o
476
477 - def ClearCallHistory(self, Username='ALL', Type=chsAllCalls):
478 """Clears the call history. 479 480 :Parameters: 481 Username : str 482 Skypename of the user. A special value of 'ALL' means that entries of all users should 483 be removed. 484 Type : `enums`.clt* 485 Call type. 486 """ 487 cmd = 'CLEAR CALLHISTORY %s %s' % (str(Type), Username) 488 self._DoCommand(cmd, cmd)
489
490 - def ClearChatHistory(self):
491 """Clears the chat history. 492 """ 493 cmd = 'CLEAR CHATHISTORY' 494 self._DoCommand(cmd, cmd)
495
496 - def ClearVoicemailHistory(self):
497 """Clears the voicemail history. 498 """ 499 self._DoCommand('CLEAR VOICEMAILHISTORY')
500
501 - def Command(self, Command, Reply=u'', Block=False, Timeout=30000, Id=-1):
502 """Creates an API command object. 503 504 :Parameters: 505 Command : unicode 506 Command string. 507 Reply : unicode 508 Expected reply. By default any reply is accepted (except errors which raise an 509 `SkypeError` exception). 510 Block : bool 511 If set to True, `SendCommand` method waits for a response from Skype API before 512 returning. 513 Timeout : float, int or long 514 Timeout. Used if Block == True. Timeout may be expressed in milliseconds if the type 515 is int or long or in seconds (or fractions thereof) if the type is float. 516 Id : int 517 Command Id. The default (-1) means it will be assigned automatically as soon as the 518 command is sent. 519 520 :return: A command object. 521 :rtype: `Command` 522 523 :see: `SendCommand` 524 """ 525 from api import Command as CommandClass 526 return CommandClass(Command, Reply, Block, Timeout, Id)
527
528 - def Conference(self, Id=0):
529 """Queries a call conference object. 530 531 :Parameters: 532 Id : int 533 Conference Id. 534 535 :return: A conference object. 536 :rtype: `Conference` 537 """ 538 o = Conference(self, Id) 539 if Id <= 0 or not o.Calls: 540 raise SkypeError(0, 'Unknown conference') 541 return o
542
543 - def CreateChatUsingBlob(self, Blob):
544 """Returns existing or joins a new chat using given blob. 545 546 :Parameters: 547 Blob : str 548 A blob identifying the chat. 549 550 :return: A chat object 551 :rtype: `chat.Chat` 552 """ 553 return Chat(self, chop(self._DoCommand('CHAT CREATEUSINGBLOB %s' % Blob), 2)[1])
554
555 - def CreateChatWith(self, *Usernames):
556 """Creates a chat with one or more users. 557 558 :Parameters: 559 Usernames : str 560 One or more Skypenames of the users. 561 562 :return: A chat object 563 :rtype: `Chat` 564 565 :see: `Chat.AddMembers` 566 """ 567 return Chat(self, chop(self._DoCommand('CHAT CREATE %s' % ', '.join(Usernames)), 2)[1])
568
569 - def CreateGroup(self, GroupName):
570 """Creates a custom contact group. 571 572 :Parameters: 573 GroupName : unicode 574 Group name. 575 576 :return: A group object. 577 :rtype: `Group` 578 579 :see: `DeleteGroup` 580 """ 581 groups = self.CustomGroups 582 self._DoCommand('CREATE GROUP %s' % tounicode(GroupName)) 583 for g in self.CustomGroups: 584 if g not in groups and g.DisplayName == GroupName: 585 return g 586 raise SkypeError(0, 'Group creating failed')
587
588 - def CreateSms(self, MessageType, *TargetNumbers):
589 """Creates an SMS message. 590 591 :Parameters: 592 MessageType : `enums`.smsMessageType* 593 Message type. 594 TargetNumbers : str 595 One or more target SMS numbers. 596 597 :return: An sms message object. 598 :rtype: `SmsMessage` 599 """ 600 return SmsMessage(self, chop(self._DoCommand('CREATE SMS %s %s' % (MessageType, ', '.join(TargetNumbers))), 2)[1])
601
602 - def DeleteGroup(self, GroupId):
603 """Deletes a custom contact group. 604 605 Users in the contact group are moved to the All Contacts (hardwired) contact group. 606 607 :Parameters: 608 GroupId : int 609 Group identifier. Get it from `Group.Id`. 610 611 :see: `CreateGroup` 612 """ 613 self._DoCommand('DELETE GROUP %s' % GroupId)
614
615 - def EnableApiSecurityContext(self, Context):
616 """Enables an API security context for Internet Explorer scripts. 617 618 :Parameters: 619 Context : unicode 620 combination of API security context values. 621 622 :warning: This functionality isn't supported by Skype4Py. 623 """ 624 self._Api.enable_security_context(Context)
625
626 - def FindChatUsingBlob(self, Blob):
627 """Returns existing chat using given blob. 628 629 :Parameters: 630 Blob : str 631 A blob identifying the chat. 632 633 :return: A chat object 634 :rtype: `chat.Chat` 635 """ 636 return Chat(self, chop(self._DoCommand('CHAT FINDUSINGBLOB %s' % Blob), 2)[1])
637
638 - def Greeting(self, Username=''):
639 """Queries the greeting used as voicemail. 640 641 :Parameters: 642 Username : str 643 Skypename of the user. 644 645 :return: A voicemail object. 646 :rtype: `Voicemail` 647 """ 648 for v in self.Voicemails: 649 if Username and v.PartnerHandle != Username: 650 continue 651 if v.Type in (vmtDefaultGreeting, vmtCustomGreeting): 652 return v
653
654 - def Message(self, Id=0):
655 """Queries a chat message object. 656 657 :Parameters: 658 Id : int 659 Message Id. 660 661 :return: A chat message object. 662 :rtype: `ChatMessage` 663 """ 664 o = ChatMessage(self, Id) 665 o.Status # Test if such an id is known. 666 return o
667
668 - def Messages(self, Target=''):
669 """Queries chat messages which were sent/received by the user. 670 671 :Parameters: 672 Target : str 673 Message sender. 674 675 :return: Chat message objects. 676 :rtype: `ChatMessageCollection` 677 """ 678 return ChatMessageCollection(self, self._Search('CHATMESSAGES', Target))
679
680 - def PlaceCall(self, *Targets):
681 """Places a call to a single user or creates a conference call. 682 683 :Parameters: 684 Targets : str 685 One or more call targets. If multiple targets are specified, a conference call is 686 created. The call target can be a Skypename, phone number, or speed dial code. 687 688 :return: A call object. 689 :rtype: `call.Call` 690 """ 691 calls = self.ActiveCalls 692 reply = self._DoCommand('CALL %s' % ', '.join(Targets)) 693 # Skype for Windows returns the call status which gives us the call Id; 694 if reply.startswith('CALL '): 695 return Call(self, chop(reply, 2)[1]) 696 # On linux we get 'OK' as reply so we search for the new call on 697 # list of active calls. 698 for c in self.ActiveCalls: 699 if c not in calls: 700 return c 701 raise SkypeError(0, 'Placing call failed')
702
703 - def Privilege(self, Name):
704 """Queries the Skype services (privileges) enabled for the Skype client. 705 706 :Parameters: 707 Name : str 708 Privilege name, currently one of 'SKYPEOUT', 'SKYPEIN', 'VOICEMAIL'. 709 710 :return: True if the privilege is available, False otherwise. 711 :rtype: bool 712 """ 713 return (self._Property('PRIVILEGE', '', Name.upper()) == 'TRUE')
714
715 - def Profile(self, Property, Set=None):
716 """Queries/sets user profile properties. 717 718 :Parameters: 719 Property : str 720 Property name, currently one of 'PSTN_BALANCE', 'PSTN_BALANCE_CURRENCY', 'FULLNAME', 721 'BIRTHDAY', 'SEX', 'LANGUAGES', 'COUNTRY', 'PROVINCE', 'CITY', 'PHONE_HOME', 722 'PHONE_OFFICE', 'PHONE_MOBILE', 'HOMEPAGE', 'ABOUT'. 723 Set : unicode or None 724 Value the property should be set to or None if the value should be queried. 725 726 :return: Property value if Set=None, None otherwise. 727 :rtype: unicode or None 728 """ 729 return self._Property('PROFILE', '', Property, Set)
730
731 - def Property(self, ObjectType, ObjectId, PropName, Set=None):
732 """Queries/sets the properties of an object. 733 734 :Parameters: 735 ObjectType : str 736 Object type ('USER', 'CALL', 'CHAT', 'CHATMESSAGE', ...). 737 ObjectId : str 738 Object Id, depends on the object type. 739 PropName : str 740 Name of the property to access. 741 Set : unicode or None 742 Value the property should be set to or None if the value should be queried. 743 744 :return: Property value if Set=None, None otherwise. 745 :rtype: unicode or None 746 """ 747 return self._Property(ObjectType, ObjectId, PropName, Set)
748
749 - def ResetCache(self):
750 """Deletes all command cache entries. 751 752 This method clears the Skype4Py's internal command cache which means that all objects will forget 753 their property values and querying them will trigger a code to get them from Skype client (and 754 cache them again). 755 """ 756 self._CacheDict = {}
757
758 - def SearchForUsers(self, Target):
759 """Searches for users. 760 761 :Parameters: 762 Target : unicode 763 Search target (name or email address). 764 765 :return: Found users. 766 :rtype: `UserCollection` 767 """ 768 return UserCollection(self, self._Search('USERS', tounicode(Target)))
769
770 - def SendCommand(self, Command):
771 """Sends an API command. 772 773 :Parameters: 774 Command : `Command` 775 Command to send. Use `Command` method to create a command. 776 """ 777 try: 778 self._Api.send_command(Command) 779 except SkypeAPIError: 780 self.ResetCache() 781 raise
782
783 - def SendMessage(self, Username, Text):
784 """Sends a chat message. 785 786 :Parameters: 787 Username : str 788 Skypename of the user. 789 Text : unicode 790 Body of the message. 791 792 :return: A chat message object. 793 :rtype: `ChatMessage` 794 """ 795 return self.CreateChatWith(Username).SendMessage(Text)
796
797 - def SendSms(self, *TargetNumbers, **Properties):
798 """Creates and sends an SMS message. 799 800 :Parameters: 801 TargetNumbers : str 802 One or more target SMS numbers. 803 Properties 804 Message properties. Properties available are same as `SmsMessage` object properties. 805 806 :return: An sms message object. The message is already sent at this point. 807 :rtype: `SmsMessage` 808 """ 809 sms = self.CreateSms(smsMessageTypeOutgoing, *TargetNumbers) 810 for name, value in Properties.items(): 811 if isinstance(getattr(sms.__class__, name, None), property): 812 setattr(sms, name, value) 813 else: 814 raise TypeError('Unknown property: %s' % prop) 815 sms.Send() 816 return sms
817
818 - def SendVoicemail(self, Username):
819 """Sends a voicemail to a specified user. 820 821 :Parameters: 822 Username : str 823 Skypename of the user. 824 825 :note: Should return a `Voicemail` object. This is not implemented yet. 826 """ 827 if self._Api.protocol >= 6: 828 self._DoCommand('CALLVOICEMAIL %s' % Username) 829 else: 830 self._DoCommand('VOICEMAIL %s' % Username)
831
832 - def User(self, Username=''):
833 """Queries a user object. 834 835 :Parameters: 836 Username : str 837 Skypename of the user. 838 839 :return: A user object. 840 :rtype: `user.User` 841 """ 842 if not Username: 843 Username = self.CurrentUserHandle 844 o = User(self, Username) 845 o.OnlineStatus # Test if such a user exists. 846 return o
847
848 - def Variable(self, Name, Set=None):
849 """Queries/sets Skype general parameters. 850 851 :Parameters: 852 Name : str 853 Variable name. 854 Set : unicode or None 855 Value the variable should be set to or None if the value should be queried. 856 857 :return: Variable value if Set=None, None otherwise. 858 :rtype: unicode or None 859 """ 860 return self._Property(Name, '', '', Set)
861
862 - def Voicemail(self, Id):
863 """Queries the voicemail object. 864 865 :Parameters: 866 Id : int 867 Voicemail Id. 868 869 :return: A voicemail object. 870 :rtype: `Voicemail` 871 """ 872 o = Voicemail(self, Id) 873 o.Type # Test if such a voicemail exists. 874 return o
875
876 - def _GetActiveCalls(self):
877 return CallCollection(self, self._Search('ACTIVECALLS'))
878 879 ActiveCalls = property(_GetActiveCalls, 880 doc="""Queries a list of active calls. 881 882 :type: `CallCollection` 883 """) 884
885 - def _GetActiveChats(self):
886 return ChatCollection(self, self._Search('ACTIVECHATS'))
887 888 ActiveChats = property(_GetActiveChats, 889 doc="""Queries a list of active chats. 890 891 :type: `ChatCollection` 892 """) 893
894 - def _GetActiveFileTransfers(self):
895 return FileTransferCollection(self, self._Search('ACTIVEFILETRANSFERS'))
896 897 ActiveFileTransfers = property(_GetActiveFileTransfers, 898 doc="""Queries currently active file transfers. 899 900 :type: `FileTransferCollection` 901 """) 902
903 - def _GetApiWrapperVersion(self):
904 from Skype4Py import __version__ 905 return __version__
906 907 ApiWrapperVersion = property(_GetApiWrapperVersion, 908 doc="""Returns Skype4Py version. 909 910 :type: str 911 """) 912
913 - def _GetAttachmentStatus(self):
914 return self._Api.attachment_status
915 916 AttachmentStatus = property(_GetAttachmentStatus, 917 doc="""Queries the attachment status of the Skype client. 918 919 :type: `enums`.apiAttach* 920 """) 921
922 - def _GetBookmarkedChats(self):
923 return ChatCollection(self, self._Search('BOOKMARKEDCHATS'))
924 925 BookmarkedChats = property(_GetBookmarkedChats, 926 doc="""Queries a list of bookmarked chats. 927 928 :type: `ChatCollection` 929 """) 930
931 - def _GetCache(self):
932 return self._Cache
933
934 - def _SetCache(self, Value):
935 self._Cache = bool(Value)
936 937 Cache = property(_GetCache, _SetCache, 938 doc="""Queries/sets the status of internal cache. The internal API cache is used 939 to cache Skype object properties and global parameters. 940 941 :type: bool 942 """) 943
944 - def _GetChats(self):
945 return ChatCollection(self, self._Search('CHATS'))
946 947 Chats = property(_GetChats, 948 doc="""Queries a list of chats. 949 950 :type: `ChatCollection` 951 """) 952
953 - def _GetClient(self):
954 return self._Client
955 956 Client = property(_GetClient, 957 doc="""Queries the user interface control object. 958 959 :type: `Client` 960 """) 961
962 - def _GetCommandId(self):
963 return True
964
965 - def _SetCommandId(self, Value):
966 if not Value: 967 raise SkypeError(0, 'CommandId may not be False')
968 969 CommandId = property(_GetCommandId, _SetCommandId, 970 doc="""Queries/sets the status of automatic command identifiers. 971 972 :type: bool 973 974 :note: Currently the only supported value is True. 975 """) 976
977 - def _GetConferences(self):
978 cids = [] 979 for c in self.Calls(): 980 cid = c.ConferenceId 981 if cid > 0 and cid not in cids: 982 cids.append(cid) 983 return ConferenceCollection(self, cids)
984 985 Conferences = property(_GetConferences, 986 doc="""Queries a list of call conferences. 987 988 :type: `ConferenceCollection` 989 """) 990
991 - def _GetConnectionStatus(self):
992 return str(self.Variable('CONNSTATUS'))
993 994 ConnectionStatus = property(_GetConnectionStatus, 995 doc="""Queries the connection status of the Skype client. 996 997 :type: `enums`.con* 998 """) 999
1000 - def _GetConvert(self):
1001 return self._Convert
1002 1003 Convert = property(_GetConvert, 1004 doc="""Queries the conversion object. 1005 1006 :type: `Conversion` 1007 """) 1008
1009 - def _GetCurrentUser(self):
1010 return User(self, self.CurrentUserHandle)
1011 1012 CurrentUser = property(_GetCurrentUser, 1013 doc="""Queries the current user object. 1014 1015 :type: `user.User` 1016 """) 1017
1018 - def _GetCurrentUserHandle(self):
1019 return str(self.Variable('CURRENTUSERHANDLE'))
1020 1021 CurrentUserHandle = property(_GetCurrentUserHandle, 1022 doc="""Queries the Skypename of the current user. 1023 1024 :type: str 1025 """) 1026
1027 - def _GetCurrentUserProfile(self):
1028 return self._Profile
1029 1030 CurrentUserProfile = property(_GetCurrentUserProfile, 1031 doc="""Queries the user profile object. 1032 1033 :type: `Profile` 1034 """) 1035
1036 - def _GetCurrentUserStatus(self):
1037 return str(self.Variable('USERSTATUS'))
1038
1039 - def _SetCurrentUserStatus(self, Value):
1040 self.Variable('USERSTATUS', str(Value))
1041 1042 CurrentUserStatus = property(_GetCurrentUserStatus, _SetCurrentUserStatus, 1043 doc="""Queries/sets the online status of the current user. 1044 1045 :type: `enums`.ols* 1046 """) 1047
1048 - def _GetCustomGroups(self):
1049 return GroupCollection(self, self._Search('GROUPS', 'CUSTOM'))
1050 1051 CustomGroups = property(_GetCustomGroups, 1052 doc="""Queries the list of custom contact groups. Custom groups are contact groups defined by the user. 1053 1054 :type: `GroupCollection` 1055 """) 1056
1057 - def _GetFileTransfers(self):
1058 return FileTransferCollection(self, self._Search('FILETRANSFERS'))
1059 1060 FileTransfers = property(_GetFileTransfers, 1061 doc="""Queries all file transfers. 1062 1063 :type: `FileTransferCollection` 1064 """) 1065
1066 - def _GetFocusedContacts(self):
1067 # we have to use _DoCommand() directly because for unknown reason the API returns 1068 # "CONTACTS FOCUSED" instead of "CONTACTS_FOCUSED" (note the space instead of "_") 1069 return UserCollection(self, split(chop(self._DoCommand('GET CONTACTS_FOCUSED', 'CONTACTS FOCUSED'), 2)[-1]))
1070 1071 FocusedContacts = property(_GetFocusedContacts, 1072 doc="""Queries a list of contacts selected in the contacts list. 1073 1074 :type: `UserCollection` 1075 """) 1076
1077 - def _GetFriendlyName(self):
1078 return self._Api.friendly_name
1079
1080 - def _SetFriendlyName(self, Value):
1081 self._Api.set_friendly_name(tounicode(Value))
1082 1083 FriendlyName = property(_GetFriendlyName, _SetFriendlyName, 1084 doc="""Queries/sets a "friendly" name for an application. 1085 1086 :type: unicode 1087 """) 1088
1089 - def _GetFriends(self):
1090 return UserCollection(self, self._Search('FRIENDS'))
1091 1092 Friends = property(_GetFriends, 1093 doc="""Queries the users in a contact list. 1094 1095 :type: `UserCollection` 1096 """) 1097
1098 - def _GetGroups(self):
1099 return GroupCollection(self, self._Search('GROUPS', 'ALL'))
1100 1101 Groups = property(_GetGroups, 1102 doc="""Queries the list of all contact groups. 1103 1104 :type: `GroupCollection` 1105 """) 1106
1107 - def _GetHardwiredGroups(self):
1108 return GroupCollection(self, self._Search('GROUPS', 'HARDWIRED'))
1109 1110 HardwiredGroups = property(_GetHardwiredGroups, 1111 doc="""Queries the list of hardwired contact groups. Hardwired groups are "smart" contact groups, 1112 defined by Skype, that cannot be removed. 1113 1114 :type: `GroupCollection` 1115 """) 1116
1117 - def _GetMissedCalls(self):
1118 return CallCollection(self, self._Search('MISSEDCALLS'))
1119 1120 MissedCalls = property(_GetMissedCalls, 1121 doc="""Queries a list of missed calls. 1122 1123 :type: `CallCollection` 1124 """) 1125
1126 - def _GetMissedChats(self):
1127 return ChatCollection(self, self._Search('MISSEDCHATS'))
1128 1129 MissedChats = property(_GetMissedChats, 1130 doc="""Queries a list of missed chats. 1131 1132 :type: `ChatCollection` 1133 """) 1134
1135 - def _GetMissedMessages(self):
1136 return ChatMessageCollection(self, self._Search('MISSEDCHATMESSAGES'))
1137 1138 MissedMessages = property(_GetMissedMessages, 1139 doc="""Queries a list of missed chat messages. 1140 1141 :type: `ChatMessageCollection` 1142 """) 1143
1144 - def _GetMissedSmss(self):
1145 return SmsMessageCollection(self, self._Search('MISSEDSMSS'))
1146 1147 MissedSmss = property(_GetMissedSmss, 1148 doc="""Requests a list of all missed SMS messages. 1149 1150 :type: `SmsMessageCollection` 1151 """) 1152
1153 - def _GetMissedVoicemails(self):
1154 return VoicemailCollection(self, self._Search('MISSEDVOICEMAILS'))
1155 1156 MissedVoicemails = property(_GetMissedVoicemails, 1157 doc="""Requests a list of missed voicemails. 1158 1159 :type: `VoicemailCollection` 1160 """) 1161
1162 - def _GetMute(self):
1163 return self.Variable('MUTE') == 'ON'
1164
1165 - def _SetMute(self, Value):
1166 self.Variable('MUTE', cndexp(Value, 'ON', 'OFF'))
1167 1168 Mute = property(_GetMute, _SetMute, 1169 doc="""Queries/sets the mute status of the Skype client. 1170 1171 Type: bool 1172 Note: This value can be set only when there is an active call. 1173 1174 :type: bool 1175 """) 1176
1178 return str(self.Variable('PREDICTIVE_DIALER_COUNTRY'))
1179 1180 PredictiveDialerCountry = property(_GetPredictiveDialerCountry, 1181 doc="""Returns predictive dialler country as an ISO code. 1182 1183 :type: str 1184 """) 1185
1186 - def _GetProtocol(self):
1187 return self._Api.protocol
1188
1189 - def _SetProtocol(self, Value):
1190 self._DoCommand('PROTOCOL %s' % Value) 1191 self._Api.protocol = int(Value)
1192 1193 Protocol = property(_GetProtocol, _SetProtocol, 1194 doc="""Queries/sets the protocol version used by the Skype client. 1195 1196 :type: int 1197 """) 1198
1199 - def _GetRecentChats(self):
1200 return ChatCollection(self, self._Search('RECENTCHATS'))
1201 1202 RecentChats = property(_GetRecentChats, 1203 doc="""Queries a list of recent chats. 1204 1205 :type: `ChatCollection` 1206 """) 1207
1208 - def _GetSettings(self):
1209 return self._Settings
1210 1211 Settings = property(_GetSettings, 1212 doc="""Queries the settings for Skype general parameters. 1213 1214 :type: `Settings` 1215 """) 1216
1217 - def _GetSilentMode(self):
1218 return self._Property('SILENT_MODE', '', '', Cache=False) == 'ON'
1219
1220 - def _SetSilentMode(self, Value):
1221 self._Property('SILENT_MODE', '', '', cndexp(Value, 'ON', 'OFF'), Cache=False)
1222 1223 SilentMode = property(_GetSilentMode, _SetSilentMode, 1224 doc="""Returns/sets Skype silent mode status. 1225 1226 :type: bool 1227 """) 1228
1229 - def _GetSmss(self):
1230 return SmsMessageCollection(self, self._Search('SMSS'))
1231 1232 Smss = property(_GetSmss, 1233 doc="""Requests a list of all SMS messages. 1234 1235 :type: `SmsMessageCollection` 1236 """) 1237
1238 - def _GetTimeout(self):
1239 return self._Timeout
1240
1241 - def _SetTimeout(self, Value):
1242 if not isinstance(Value, (int, long, float)): 1243 raise TypeError('%s: wrong type, expected float (seconds), int or long (milliseconds)' % 1244 repr(type(Value))) 1245 self._Timeout = Value
1246 1247 Timeout = property(_GetTimeout, _SetTimeout, 1248 doc="""Queries/sets the wait timeout value. This timeout value applies to every command sent 1249 to the Skype API and to attachment requests (see `Attach`). If a response is not received 1250 during the timeout period, an `SkypeAPIError` exception is raised. 1251 1252 The units depend on the type. For float it is the number of seconds (or fractions thereof), 1253 for int or long it is the number of milliseconds. Floats are commonly used in Python modules 1254 to express timeouts (time.sleep() for example). Milliseconds are supported because that's 1255 what the Skype4COM library uses. Skype4Py support for real float timeouts was introduced 1256 in version 1.0.31.1. 1257 1258 The default value is 30000 milliseconds (int). 1259 1260 :type: float, int or long 1261 """) 1262
1264 return UserCollection(self, self._Search('USERSWAITINGMYAUTHORIZATION'))
1265 1266 UsersWaitingAuthorization = property(_GetUsersWaitingAuthorization, 1267 doc="""Queries the list of users waiting for authorization. 1268 1269 :type: `UserCollection` 1270 """) 1271
1272 - def _GetVersion(self):
1273 return str(self.Variable('SKYPEVERSION'))
1274 1275 Version = property(_GetVersion, 1276 doc="""Queries the application version of the Skype client. 1277 1278 :type: str 1279 """) 1280
1281 - def _GetVoicemails(self):
1282 return VoicemailCollection(self, self._Search('VOICEMAILS'))
1283 1284 Voicemails = property(_GetVoicemails, 1285 doc="""Queries a list of voicemails. 1286 1287 :type: `VoicemailCollection` 1288 """)
1289 1290
1291 -class SkypeEvents(object):
1292 """Events defined in `Skype`. 1293 1294 See `EventHandlingBase` for more information on events. 1295 """ 1296
1297 - def ApplicationConnecting(self, App, Users):
1298 """This event is triggered when list of users connecting to an application changes. 1299 1300 :Parameters: 1301 App : `Application` 1302 Application object. 1303 Users : `UserCollection` 1304 Connecting users. 1305 """
1306
1307 - def ApplicationDatagram(self, App, Stream, Text):
1308 """This event is caused by the arrival of an application datagram. 1309 1310 :Parameters: 1311 App : `Application` 1312 Application object. 1313 Stream : `ApplicationStream` 1314 Application stream that received the datagram. 1315 Text : unicode 1316 The datagram text. 1317 """
1318
1319 - def ApplicationReceiving(self, App, Streams):
1320 """This event is triggered when list of application receiving streams changes. 1321 1322 :Parameters: 1323 App : `Application` 1324 Application object. 1325 Streams : `ApplicationStreamCollection` 1326 Application receiving streams. 1327 """
1328
1329 - def ApplicationSending(self, App, Streams):
1330 """This event is triggered when list of application sending streams changes. 1331 1332 :Parameters: 1333 App : `Application` 1334 Application object. 1335 Streams : `ApplicationStreamCollection` 1336 Application sending streams. 1337 """
1338
1339 - def ApplicationStreams(self, App, Streams):
1340 """This event is triggered when list of application streams changes. 1341 1342 :Parameters: 1343 App : `Application` 1344 Application object. 1345 Streams : `ApplicationStreamCollection` 1346 Application streams. 1347 """
1348
1349 - def AsyncSearchUsersFinished(self, Cookie, Users):
1350 """This event occurs when an asynchronous search is completed. 1351 1352 :Parameters: 1353 Cookie : int 1354 Search identifier as returned by `Skype.AsyncSearchUsers`. 1355 Users : `UserCollection` 1356 Found users. 1357 1358 :see: `Skype.AsyncSearchUsers` 1359 """
1360
1361 - def AttachmentStatus(self, Status):
1362 """This event is caused by a change in the status of an attachment to the Skype API. 1363 1364 :Parameters: 1365 Status : `enums`.apiAttach* 1366 New attachment status. 1367 """
1368
1369 - def AutoAway(self, Automatic):
1370 """This event is caused by a change of auto away status. 1371 1372 :Parameters: 1373 Automatic : bool 1374 New auto away status. 1375 """
1376
1377 - def CallDtmfReceived(self, Call, Code):
1378 """This event is caused by a call DTMF event. 1379 1380 :Parameters: 1381 Call : `Call` 1382 Call object. 1383 Code : str 1384 Received DTMF code. 1385 """
1386
1387 - def CallHistory(self):
1388 """This event is caused by a change in call history. 1389 """
1390
1391 - def CallInputStatusChanged(self, Call, Active):
1392 """This event is caused by a change in the Call voice input status change. 1393 1394 :Parameters: 1395 Call : `Call` 1396 Call object. 1397 Active : bool 1398 New voice input status (active when True). 1399 """
1400
1401 - def CallSeenStatusChanged(self, Call, Seen):
1402 """This event occurs when the seen status of a call changes. 1403 1404 :Parameters: 1405 Call : `Call` 1406 Call object. 1407 Seen : bool 1408 True if call was seen. 1409 1410 :see: `Call.Seen` 1411 """
1412
1413 - def CallStatus(self, Call, Status):
1414 """This event is caused by a change in call status. 1415 1416 :Parameters: 1417 Call : `Call` 1418 Call object. 1419 Status : `enums`.cls* 1420 New status of the call. 1421 """
1422
1423 - def CallTransferStatusChanged(self, Call, Status):
1424 """This event occurs when a call transfer status changes. 1425 1426 :Parameters: 1427 Call : `Call` 1428 Call object. 1429 Status : `enums`.cls* 1430 New status of the call transfer. 1431 """
1432
1433 - def CallVideoReceiveStatusChanged(self, Call, Status):
1434 """This event occurs when a call video receive status changes. 1435 1436 :Parameters: 1437 Call : `Call` 1438 Call object. 1439 Status : `enums`.vss* 1440 New video receive status of the call. 1441 """
1442
1443 - def CallVideoSendStatusChanged(self, Call, Status):
1444 """This event occurs when a call video send status changes. 1445 1446 :Parameters: 1447 Call : `Call` 1448 Call object. 1449 Status : `enums`.vss* 1450 New video send status of the call. 1451 """
1452
1453 - def CallVideoStatusChanged(self, Call, Status):
1454 """This event occurs when a call video status changes. 1455 1456 :Parameters: 1457 Call : `Call` 1458 Call object. 1459 Status : `enums`.cvs* 1460 New video status of the call. 1461 """
1462
1463 - def ChatMemberRoleChanged(self, Member, Role):
1464 """This event occurs when a chat member role changes. 1465 1466 :Parameters: 1467 Member : `ChatMember` 1468 Chat member object. 1469 Role : `enums`.chatMemberRole* 1470 New member role. 1471 """
1472
1473 - def ChatMembersChanged(self, Chat, Members):
1474 """This event occurs when a list of chat members change. 1475 1476 :Parameters: 1477 Chat : `Chat` 1478 Chat object. 1479 Members : `UserCollection` 1480 Chat members. 1481 """
1482
1483 - def ChatWindowState(self, Chat, State):
1484 """This event occurs when chat window is opened or closed. 1485 1486 :Parameters: 1487 Chat : `Chat` 1488 Chat object. 1489 State : bool 1490 True if the window was opened or False if closed. 1491 """
1492
1493 - def ClientWindowState(self, State):
1494 """This event occurs when the state of the client window changes. 1495 1496 :Parameters: 1497 State : `enums`.wnd* 1498 New window state. 1499 """
1500
1501 - def Command(self, command):
1502 """This event is triggered when a command is sent to the Skype API. 1503 1504 :Parameters: 1505 command : `Command` 1506 Command object. 1507 """
1508
1509 - def ConnectionStatus(self, Status):
1510 """This event is caused by a connection status change. 1511 1512 :Parameters: 1513 Status : `enums`.con* 1514 New connection status. 1515 """
1516
1517 - def ContactsFocused(self, Username):
1518 """This event is caused by a change in contacts focus. 1519 1520 :Parameters: 1521 Username : str 1522 Name of the user that was focused or empty string if focus was lost. 1523 """
1524
1525 - def Error(self, command, Number, Description):
1526 """This event is triggered when an error occurs during execution of an API command. 1527 1528 :Parameters: 1529 command : `Command` 1530 Command object that caused the error. 1531 Number : int 1532 Error number returned by the Skype API. 1533 Description : unicode 1534 Description of the error. 1535 """
1536
1537 - def FileTransferStatusChanged(self, Transfer, Status):
1538 """This event occurs when a file transfer status changes. 1539 1540 :Parameters: 1541 Transfer : `FileTransfer` 1542 File transfer object. 1543 Status : `enums`.fileTransferStatus* 1544 New status of the file transfer. 1545 """
1546
1547 - def GroupDeleted(self, GroupId):
1548 """This event is caused by a user deleting a custom contact group. 1549 1550 :Parameters: 1551 GroupId : int 1552 Id of the deleted group. 1553 """
1554
1555 - def GroupExpanded(self, Group, Expanded):
1556 """This event is caused by a user expanding or collapsing a group in the contacts tab. 1557 1558 :Parameters: 1559 Group : `Group` 1560 Group object. 1561 Expanded : bool 1562 Tells if the group is expanded (True) or collapsed (False). 1563 """
1564
1565 - def GroupUsers(self, Group, Count):
1566 """This event is caused by a change in a contact group members. 1567 1568 :Parameters: 1569 Group : `Group` 1570 Group object. 1571 Count : int 1572 Number of group members. 1573 1574 :note: This event is different from its Skype4COM equivalent in that the second 1575 parameter is number of users instead of `UserCollection` object. This 1576 object may be obtained using ``Group.Users`` property. 1577 """
1578
1579 - def GroupVisible(self, Group, Visible):
1580 """This event is caused by a user hiding/showing a group in the contacts tab. 1581 1582 :Parameters: 1583 Group : `Group` 1584 Group object. 1585 Visible : bool 1586 Tells if the group is visible or not. 1587 """
1588
1589 - def MessageHistory(self, Username):
1590 """This event is caused by a change in message history. 1591 1592 :Parameters: 1593 Username : str 1594 Name of the user whose message history changed. 1595 """
1596
1597 - def MessageStatus(self, Message, Status):
1598 """This event is caused by a change in chat message status. 1599 1600 :Parameters: 1601 Message : `ChatMessage` 1602 Chat message object. 1603 Status : `enums`.cms* 1604 New status of the chat message. 1605 """
1606
1607 - def Mute(self, Mute):
1608 """This event is caused by a change in mute status. 1609 1610 :Parameters: 1611 Mute : bool 1612 New mute status. 1613 """
1614
1615 - def Notify(self, Notification):
1616 """This event is triggered whenever Skype client sends a notification. 1617 1618 :Parameters: 1619 Notification : unicode 1620 Notification string. 1621 1622 :note: Use this event only if there is no dedicated one. 1623 """
1624
1625 - def OnlineStatus(self, User, Status):
1626 """This event is caused by a change in the online status of a user. 1627 1628 :Parameters: 1629 User : `User` 1630 User object. 1631 Status : `enums`.ols* 1632 New online status of the user. 1633 """
1634
1635 - def PluginEventClicked(self, Event):
1636 """This event occurs when a user clicks on a plug-in event. 1637 1638 :Parameters: 1639 Event : `PluginEvent` 1640 Plugin event object. 1641 """
1642
1643 - def PluginMenuItemClicked(self, MenuItem, Users, PluginContext, ContextId):
1644 """This event occurs when a user clicks on a plug-in menu item. 1645 1646 :Parameters: 1647 MenuItem : `PluginMenuItem` 1648 Menu item object. 1649 Users : `UserCollection` 1650 Users this item refers to. 1651 PluginContext : unicode 1652 Plug-in context. 1653 ContextId : str or int 1654 Context Id. Chat name for chat context or Call ID for call context. 1655 1656 :see: `PluginMenuItem` 1657 """
1658
1659 - def Reply(self, command):
1660 """This event is triggered when the API replies to a command object. 1661 1662 :Parameters: 1663 command : `Command` 1664 Command object. 1665 """
1666
1667 - def SilentModeStatusChanged(self, Silent):
1668 """This event occurs when a silent mode is switched off. 1669 1670 :Parameters: 1671 Silent : bool 1672 Skype client silent status. 1673 """
1674
1675 - def SmsMessageStatusChanged(self, Message, Status):
1676 """This event is caused by a change in the SMS message status. 1677 1678 :Parameters: 1679 Message : `SmsMessage` 1680 SMS message object. 1681 Status : `enums`.smsMessageStatus* 1682 New status of the SMS message. 1683 """
1684
1685 - def SmsTargetStatusChanged(self, Target, Status):
1686 """This event is caused by a change in the SMS target status. 1687 1688 :Parameters: 1689 Target : `SmsTarget` 1690 SMS target object. 1691 Status : `enums`.smsTargetStatus* 1692 New status of the SMS target. 1693 """
1694
1695 - def UserAuthorizationRequestReceived(self, User):
1696 """This event occurs when user sends you an authorization request. 1697 1698 :Parameters: 1699 User : `User` 1700 User object. 1701 """
1702
1703 - def UserMood(self, User, MoodText):
1704 """This event is caused by a change in the mood text of the user. 1705 1706 :Parameters: 1707 User : `User` 1708 User object. 1709 MoodText : unicode 1710 New mood text. 1711 """
1712
1713 - def UserStatus(self, Status):
1714 """This event is caused by a user status change. 1715 1716 :Parameters: 1717 Status : `enums`.cus* 1718 New user status. 1719 """
1720
1721 - def VoicemailStatus(self, Mail, Status):
1722 """This event is caused by a change in voicemail status. 1723 1724 :Parameters: 1725 Mail : `Voicemail` 1726 Voicemail object. 1727 Status : `enums`.vms* 1728 New status of the voicemail. 1729 """
1730
1731 - def WallpaperChanged(self, Path):
1732 """This event occurs when client wallpaper changes. 1733 1734 :Parameters: 1735 Path : str 1736 Path to new wallpaper bitmap. 1737 """
1738 1739 1740 Skype._AddEvents(SkypeEvents) 1741