Infinity.ChatBuffer¶
| Subclasses: | None | 
|---|
Methods¶
| Inherited: | GObject.Object (37), Infinity.Buffer (2) | 
|---|---|
| Structs: | GObject.ObjectClass (5) | 
| class | new(size) | 
| add_emote_message(by, message, time, flags) | |
| add_message(by, message, time, flags) | |
| add_userjoin_message(user, time, flags) | |
| add_userpart_message(user, time, flags) | |
| get_message(n) | |
| get_n_messages() | |
| get_size() | 
Properties¶
| Inherited: | Infinity.Buffer (1) | 
|---|
| Name | Type | Flags | Short Description | 
|---|---|---|---|
| size | int | r/w/co | The maxmimum number of messages saved | 
Signals¶
| Inherited: | GObject.Object (1) | 
|---|
| Name | Short Description | 
|---|---|
| add-message | This signal is emitted whenever a message has been added to buffer. | 
Class Details¶
- 
class Infinity.ChatBuffer(**kwargs)¶
- Bases: - GObject.Object,- Infinity.Buffer- Abstract: - No - Structure: - Infinity.ChatBufferClass- Infinity.ChatBufferis an opaque data type. You should only access it via the public API functions.- 
classmethod new(size)¶
- Parameters: - size ( - int) – The number of messages to store.- Returns: - A new - Infinity.ChatBuffer.- Return type: - Infinity.ChatBuffer- Creates a new - Infinity.ChatBufferwhich contains no initial messages. size specifies how many messages to store before dropping old messages.
 - 
add_emote_message(by, message, time, flags)¶
- Parameters: - by (Infinity.User) – AInfinity.Userwho wrote the message.
- message ([str]) – The message text.
- time (int) – The time at which the user has written the message.
- flags (Infinity.ChatBufferMessageFlags) – Flags to set for the message to add.
 - Adds a new emote message to the chat buffer. If the buffer is full (meaning the number of messages in the buffer equals its size), then an old message will get discarded. If the message to be added is older than all other messages in the buffer, then it will not be added at all. 
- by (
 - 
add_message(by, message, time, flags)¶
- Parameters: - by (Infinity.User) – AInfinity.Userwho wrote the message.
- message ([str]) – The message text.
- time (int) – The time at which the user has written the message.
- flags (Infinity.ChatBufferMessageFlags) – Flags to set for the message to add.
 - Adds a new message to the chat buffer. If the buffer is full (meaning the number of messages in the buffer equals its size), then an old message will get discarded. If the message to be added is older than all other messages in the buffer, then it will not be added at all. 
- by (
 - 
add_userjoin_message(user, time, flags)¶
- Parameters: - user (Infinity.User) – AInfinity.Userwho wrote the message.
- time (int) – The time at which the user has written the message.
- flags (Infinity.ChatBufferMessageFlags) – Flags to set for the message to add.
 - Adds a new userjoin message to the chat buffer. If the buffer is full (meaning the number of messages in the buffer equals its size), then an old message will get discarded. If the message to be added is older than all other messages in the buffer, then it will not be added at all. 
- user (
 - 
add_userpart_message(user, time, flags)¶
- Parameters: - user (Infinity.User) – AInfinity.Userwho wrote the message.
- time (int) – The time at which the user has written the message.
- flags (Infinity.ChatBufferMessageFlags) – Flags to set for the message to add.
 - Adds a new userpart message to the chat buffer. If the buffer is full (meaning the number of messages in the buffer equals its size), then an old message will get discarded. If the message to be added is older than all other messages in the buffer, then it will not be added at all. 
- user (
 - 
get_message(n)¶
- Parameters: - n ( - int) – The index of the message to obtain.- Returns: - The - Infinity.ChatBufferMessagewith the given index.- Return type: - Infinity.ChatBufferMessage- Returns the message with the given index from the buffer. The oldest message in the buffer has index 0, and the most recent one has index - Infinity.ChatBuffer.get_n_messages() - 1.
 - 
get_n_messages()¶
- Returns: - The number of messages in the buffer. - Return type: - int- Returns the number of messages in the buffer. 
 - 
get_size()¶
- Returns: - The number of messages in the chat buffer. - Return type: - int- Returns the size of the chat buffer, which is the maximum number of messages that can be stored in the buffer. 
 - 
do_add_message(message) virtual¶
- Parameters: - message ( - Infinity.ChatBufferMessage) –
 
- 
classmethod 
Signal Details¶
- 
Infinity.ChatBuffer.signals.add_message(chat_buffer, message)¶
- Signal Name: - add-message- Flags: - Parameters: - chat_buffer (Infinity.ChatBuffer) – The object which received the signal
- message (Infinity.ChatBufferMessage) – TheInfinity.ChatBufferMessagethat was received.
 - This signal is emitted whenever a message has been added to buffer. 
- chat_buffer (