Infinity.ChatSession¶
- Subclasses:
None
Methods¶
- Inherited:
Infinity.Session (19), GObject.Object (37), Infinity.CommunicationObject (3)
- Structs:
class |
|
|
Virtual Methods¶
|
|
|
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w |
The file into which to store all received messages |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
This signal is emitted whenever a message has been received. |
|
This signal is emitted whenever a message is sent. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class Infinity.ChatSession(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Infinity.ChatSession
is an opaque data type. You should only access it via the public API functions.- classmethod new(manager, buffer, status, sync_group, sync_connection)¶
- Parameters:
manager (
Infinity.CommunicationManager
) – AInfinity.CommunicationManager
.buffer (
Infinity.ChatBuffer
) – TheInfinity.ChatBuffer
to use for the session.status (
Infinity.SessionStatus
) – Initial status of the session. If this isInfinity.SessionStatus.SYNCHRONIZING
orInfinity.SessionStatus.PRESYNC
, then sync_group and sync_connection need to be set.sync_group (
Infinity.CommunicationGroup
) – A group in which the session is synchronized. Ignored if status isInfinity.SessionStatus.RUNNING
.sync_connection (
Infinity.XmlConnection
) – A connection to synchronize the session from. Ignored if status isInfinity.SessionStatus.RUNNING
.
- Returns:
A new
Infinity.ChatSession
.- Return type:
Creates a new
Infinity.ChatSession
with the messages contained in buffer as initial messages. The communication manager is used to send and receive requests from subscription and synchronization.If status is
Infinity.SessionStatus.PRESYNC
orInfinity.SessionStatus.SYNCHRONIZING
, then the session will initially be synchronized, meaning an initial backlog is retrieved from sync_connection (which must not beNone
in this case). If you are subscribed to the session, set the subscription group viaInfinity.Session.set_subscription_group
().
- set_log_file(log_file)¶
- Parameters:
log_file (
str
) – A filename to store all received messages into.- Raises:
- Returns:
True
if the log file could be opened,False
otherwise (in which case error is set).- Return type:
Sets a file onto which all received messages are appended. The file is created if it does not exist. If a previous log file was set, then it is closed before opening the new file.
Backlog messages received upon synchronization are not logged.
- do_receive_message(message) virtual¶
- Parameters:
message (
Infinity.ChatBufferMessage
) –
- do_send_message(message) virtual¶
- Parameters:
message (
Infinity.ChatBufferMessage
) –
Signal Details¶
- Infinity.ChatSession.signals.receive_message(chat_session, message)¶
- Signal Name:
receive-message
- Flags:
- Parameters:
chat_session (
Infinity.ChatSession
) – The object which received the signalmessage (
Infinity.ChatBufferMessage
) – TheInfinity.ChatBufferMessage
that was received.
This signal is emitted whenever a message has been received. If the session is in
Infinity.SessionStatus.SYNCHRONIZING
state the received message was a backlog message.
- Infinity.ChatSession.signals.send_message(chat_session, message)¶
- Signal Name:
send-message
- Flags:
- Parameters:
chat_session (
Infinity.ChatSession
) – The object which received the signalmessage (
Infinity.ChatBufferMessage
) – TheInfinity.ChatBufferMessage
that is sent.
This signal is emitted whenever a message is sent. Messages can be sent by calling
Infinity.ChatBuffer.add_message
() orInfinity.ChatBuffer.add_emote_message
() on the session’sInfinity.ChatBuffer
. Messages of typeInfinity.ChatBufferMessageType.USERJOIN
orInfinity.ChatBufferMessageType.USERPART
can not be sent explicitely, so this signal will never be emitted for such messages.