[docs]@SkypeUtils.initAttrsclassSkypeEvent(SkypeObj):""" The base Skype event. Pulls out common identifier, time and type parameters. Attributes: id (int): Unique identifier of the event, usually starting from ``1000``. type (str): Raw message type, as specified by the Skype API. time (datetime.datetime): Time at which the event occurred. """attrs=("id","type","time")
[docs]defack(self):""" Acknowledge receipt of an event, if a response is required. """url=self.raw.get("resource",{}).get("ackrequired")ifurl:self.skype.conn("POST",url,auth=SkypeConnection.Auth.RegToken)
[docs]@SkypeUtils.initAttrs@SkypeUtils.convertIds("user")classSkypePresenceEvent(SkypeEvent):""" An event for contacts changing status or presence. Attributes: user (:class:`.SkypeUser`): User whose presence changed. online (bool): Whether the user is now connected. status (:class:`.Status`): Chosen availability status. capabilities (str list): Features currently available from this user, across all endpoints. """attrs=SkypeEvent.attrs+("userId","online","status","capabilities")
[docs]@SkypeUtils.initAttrs@SkypeUtils.convertIds("user")classSkypeEndpointEvent(SkypeEvent):""" An event for changes to individual contact endpoints. Attributes: user (:class:`.SkypeUser`): User whose endpoint emitted an event. name (str): Name of the device connected with this endpoint. capabilities (str list): Features available on the device. type (str): Numeric type of client that the device identifies as. version (str): Software version of the client. """attrs=SkypeEvent.attrs+("userId","name","capabilities","type","version")
[docs]@SkypeUtils.initAttrs@SkypeUtils.convertIds("user","chat")classSkypeTypingEvent(SkypeEvent):""" An event for users starting or stopping typing in a conversation. Attributes: user (:class:`.SkypeUser`): User whose typing status changed. chat (:class:`.SkypeChat`): Conversation where the user was seen typing. active (bool): Whether the user has just started typing. """attrs=SkypeEvent.attrs+("userId","chatId","active")
[docs]@SkypeUtils.initAttrsclassSkypeMessageEvent(SkypeEvent):""" The base message event, when a message is received in a conversation. Attributes: msg (:class:`.SkypeMsg`): Message received in the conversation. """attrs=SkypeEvent.attrs+("msgId",)
[docs]@SkypeUtils.initAttrsclassSkypeNewMessageEvent(SkypeMessageEvent):""" An event for a new message being received in a conversation. """
[docs]@SkypeUtils.initAttrsclassSkypeEditMessageEvent(SkypeMessageEvent):""" An event for the update of an existing message in a conversation. """
[docs]@SkypeUtils.initAttrsclassSkypeCallEvent(SkypeMessageEvent):""" An event for incoming or missed Skype calls. """
[docs]@SkypeUtils.initAttrs@SkypeUtils.convertIds("chat")classSkypeChatUpdateEvent(SkypeEvent):""" An event triggered by various conversation changes or messages. Attributes: chat (:class:`.SkypeChat`): Conversation that emitted an update. horizon (str): Updated horizon string, in the form ``<id>,<timestamp>,<id>``. """attrs=SkypeEvent.attrs+("chatId","horizon")
[docs]defconsume(self):""" Use the consumption horizon to mark the conversation as up-to-date. """self.skype.conn("PUT","{0}/users/ME/conversations/{1}/properties".format(self.skype.conn.msgsHost,self.chatId),auth=SkypeConnection.Auth.RegToken,params={"name":"consumptionhorizon"},json={"consumptionhorizon":self.horizon})
[docs]@SkypeUtils.initAttrs@SkypeUtils.convertIds("users","chat")classSkypeChatMemberEvent(SkypeEvent):""" An event triggered when someone is added to or removed from a conversation. Attributes: users (:class:`.SkypeUser` list): List of users affected by the update. chat (:class:`.SkypeChat`): Conversation where the change occurred. """attrs=SkypeEvent.attrs+("userIds","chatId")