woob.capabilities.messages

exception woob.capabilities.messages.CantSendMessage

Bases: woob.capabilities.base.UserError

Raised when a message can’t be send.

class woob.capabilities.messages.CapMessages

Bases: woob.capabilities.base.Capability

Capability to read messages.

get_thread(id)

Get a specific thread.

Return type

Thread

iter_threads()

Iterates on threads, from newers to olders.

Return type

iter[Thread]

iter_unread_messages()

Iterates on messages which hasn’t been marked as read.

Return type

iter[Message]

set_message_read(message)

Set a message as read.

Parameters

message (Message or str) – message read (or ID)

class woob.capabilities.messages.CapMessagesPost

Bases: woob.capabilities.base.Capability

This capability allow user to send a message.

post_message(message)

Post a message.

Parameters

message (Message) – message to send

Raises

CantSendMessage

class woob.capabilities.messages.Message(thread=NotLoaded, id=NotLoaded, title=NotLoaded, sender=NotLoaded, receivers=NotLoaded, date=None, parent=NotLoaded, content=NotLoaded, signature=NotLoaded, children=NotLoaded, flags=0, url=None)

Bases: woob.capabilities.base.BaseObject

Represents a message read or to send.

Variables
  • thread – (Thread) Reference to the thread

  • title – (str) Title of message

  • sender – (str) Author of this message

  • receivers – (list) Receivers of the message

  • date – (date, datetime) Date when the message has been sent

  • content – (str) Body of message

  • signature – (str) Optional signature

  • parent – (Message) Parent message

  • children – (list) Children fields

  • flags – (int, int) Flags (IS_* constants) (default: 0)

IS_HTML = 1

The content is HTML formatted

IS_NOT_RECEIVED = 8

The receiver hass not read this message

IS_RECEIVED = 4

The receiver has read this message

IS_UNREAD = 2

The message is unread

property date_int

Date of message as an integer.

property full_id

Full ID of message (in form ‘THREAD_ID.MESSAGE_ID’)

property full_parent_id

Get the full ID of the parent message (in form ‘THREAD_ID.MESSAGE_ID’).

class woob.capabilities.messages.Thread(id='', url=NotLoaded, backend=None)

Bases: woob.capabilities.base.BaseObject

Thread containing messages.

Variables
  • root – (Message) Root message

  • title – (str) Title of thread

  • date – (date, datetime) Date of thread

  • flags – (int, int) Flags (IS_* constants) (default: 1)

IS_DISCUSSION = 2
IS_THREADS = 1
iter_all_messages()

Iter all messages of the thread.

Return type

iter[Message]