| Top |
InfChatSession represents a chat session. Normally, there is one chat
session per server, and it can be enabled via infd_directory_enable_chat().
Clients can subscribe to the chat session via
infc_browser_subscribe_chat().
InfChatSession * inf_chat_session_new (InfCommunicationManager *manager,InfChatBuffer *buffer,InfSessionStatus status,InfCommunicationGroup *sync_group,InfXmlConnection *sync_connection);
Creates a new InfChatSession 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 INF_SESSION_PRESYNC or INF_SESSION_SYNCHRONIZING, then the
session will initially be synchronized, meaning an initial backlog is
retrieved from sync_connection
(which must not be NULL in this case). If
you are subscribed to the session, set the subscription group via
inf_session_set_subscription_group().
[constructor]
manager |
||
buffer |
The InfChatBuffer to use for the session. |
|
status |
Initial status of the session. If this is
|
|
sync_group |
A group in which the session is synchronized. Ignored if
|
|
sync_connection |
A connection to synchronize the session from. Ignored if
|
gboolean inf_chat_session_set_log_file (InfChatSession *session,const gchar *log_file,GError **error);
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.
struct InfChatSession;
InfChatSession is an opaque data type. You should only access it via the public API functions.
struct InfChatSessionClass {
void (*receive_message)(InfChatSession* session,
const InfChatBufferMessage* message);
void (*send_message)(InfChatSession* session,
const InfChatBufferMessage* message);
};
This structure contains default signal handlers for InfChatSession.
Default signal handler for the “receive-message” signal. |
||
Default signal handler for the “send-message” signal. |
“receive-message” signalvoid user_function (InfChatSession *session, InfChatBufferMessage *message, gpointer user_data)
This signal is emitted whenever a message has been received. If the
session is in INF_SESSION_SYNCHRONIZING state the received message was
a backlog message.
session |
The InfChatSession that is receiving a message. |
|
message |
The InfChatBufferMessage that was received. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“send-message” signalvoid user_function (InfChatSession *session, InfChatBufferMessage *message, gpointer user_data)
This signal is emitted whenever a message is sent. Messages can be sent
by calling inf_chat_buffer_add_message() or
inf_chat_buffer_add_emote_message() on the session's InfChatBuffer.
Messages of type INF_CHAT_BUFFER_MESSAGE_USERJOIN or
INF_CHAT_BUFFER_MESSAGE_USERPART can not be sent explicitely, so this
signal will never be emitted for such messages.
session |
The InfChatSession that is sending a message. |
|
message |
The InfChatBufferMessage that is sent. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last