| libinfinity-0.4 Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Signals | ||||
#include <libinfinity/common/inf-user-table.h> void (*InfUserTableForeachUserFunc) (InfUser *user, gpointer user_data); InfUserTable; InfUserTableClass; InfUserTable * inf_user_table_new (void); void inf_user_table_add_user (InfUserTable *user_table, InfUser *user); void inf_user_table_remove_user (InfUserTable *user_table, InfUser *user); InfUser * inf_user_table_lookup_user_by_id (InfUserTable *user_table, guint id); InfUser * inf_user_table_lookup_user_by_name (InfUserTable *user_table, const gchar *name); void inf_user_table_foreach_user (InfUserTable *user_table, InfUserTableForeachUserFunc func, gpointer user_data); void inf_user_table_foreach_local_user (InfUserTable *user_table, InfUserTableForeachUserFunc func, gpointer user_data);
"add-local-user" : Run Last "add-user" : Run Last "remove-local-user" : Run Last "remove-user" : Run Last
InfUserTable manages multiple InfUser objects and provides an easy way to look up users by their ID and name. All users within a user table must have a unique ID and name. The user table is used by InfSession to store the users within the session.
void (*InfUserTableForeachUserFunc) (InfUser *user, gpointer user_data);
This callback is called for every user iterated by
inf_user_table_foreach_user() or inf_user_table_foreach_local_user().
|
The InfUser for the current iteration. |
|
The user_data passed to inf_user_table_foreach_user() or
inf_user_table_foreach_local_user().
|
typedef struct _InfUserTable InfUserTable;
InfUserTable is an opaque data type. You should only access it via the public API functions.
typedef struct {
void(*add_user)(InfUserTable* user_table,
InfUser* user);
void(*remove_user)(InfUserTable* user_table,
InfUser* user);
void(*add_local_user)(InfUserTable* user_table,
InfUser* user);
void(*remove_local_user)(InfUserTable* user_table,
InfUser* user);
} InfUserTableClass;
Signals for the InfUserTable class.
|
Default signal handler for the "add_user" signal. |
|
Default signal handler for the "remove_user" signal. |
|
Default signal handler for the "add_local_user" signal. |
|
Default signal handler for the "remove_local_user" signal. |
InfUserTable * inf_user_table_new (void);
Creates a new, empty user table.
Returns : |
A InfUserTable. |
void inf_user_table_add_user (InfUserTable *user_table, InfUser *user);
Inserts user into user_table.
|
A InfUserTable. |
|
A InfUser not already contained in user_table.
|
void inf_user_table_remove_user (InfUserTable *user_table, InfUser *user);
Removes user from uesr_table.
|
A InfUserTable. |
|
A InfUser contained in table.
|
InfUser * inf_user_table_lookup_user_by_id (InfUserTable *user_table, guint id);
Returns the InfUser with the given User ID in user_table.
|
A InfUserTable. |
|
User ID to lookup. |
Returns : |
A InfUser, or NULL.
|
InfUser * inf_user_table_lookup_user_by_name (InfUserTable *user_table, const gchar *name);
Returns an InfUser with the given name if there is one.
|
A InfUserTable. |
|
User name to lookup. |
Returns : |
A InfUser, or NULL.
|
void inf_user_table_foreach_user (InfUserTable *user_table, InfUserTableForeachUserFunc func, gpointer user_data);
Calls the given function for each user in the user_table. You should not add or remove users while this function is being executed.
|
A InfUserTable. |
|
The function to call for each user. |
|
User data to pass to the function. |
void inf_user_table_foreach_local_user (InfUserTable *user_table, InfUserTableForeachUserFunc func, gpointer user_data);
Calls the given function for each local user in the user_table. A local
user is a user that has the INF_USER_LOCAL flag set and that has not
status INF_USER_UNAVAILABLE. You should not add or remove users while this
function is being executed.
|
A InfUserTable. |
|
The function to call for each user. |
|
User data to pass to the function. |
"add-local-user" signalvoid user_function (InfUserTable *user_table, InfUser *user, gpointer user_data) : Run Last
This signal is emitted when a user is added to the user table and has the
INF_USER_LOCAL flag set. In this case, "add-user" is
emitted as well.
This signal is also emitted when an existing user receives the
INF_USER_LOCAL flag. This occurs when a user rejoins locally after
leaving the session (possibly having the INF_USER_LOCAL flag removed
during their absence). "add-user" is not emitted in this
case.
|
The InfUserTable in which user has been set as local
|
|
The InfUser that has set as local |
|
user data set when the signal handler was connected. |
"add-user" signalvoid user_function (InfUserTable *user_table, InfUser *user, gpointer user_data) : Run Last
This signal is emitted when inf_user_table_add_user() is called. Note
that this does not happen if user rejoins the session and has already
been added to user_table previously.
"add-local-user" may also be emitted at this point if
user has the INF_USER_LOCAL flag set.
|
The InfUserTable into which user has been added
|
|
The InfUser that has been added into user_table
|
|
user data set when the signal handler was connected. |
"remove-local-user" signalvoid user_function (InfUserTable *user_table, InfUser *user, gpointer user_data) : Run Last
This signal is emitted when a user is removed from the user table and
had the INF_USER_LOCAL flag set. In this case,
"remove-user" is emitted as well.
This signal is also emitted when user loses the INF_USER_LOCAL flag.
This occurs when the local user leaves the session.
"remove-user" is not emitted and the status of user is set
to INF_USER_UNAVAILABLE.
|
The InfUserTable in which user is no longer local
|
|
The InfUser that is no longer local |
|
user data set when the signal handler was connected. |
"remove-user" signalvoid user_function (InfUserTable *user_table, InfUser *user, gpointer user_data) : Run Last
This signal is emitted when inf_user_table_remove_user() is called. This
does not usually happen, as users leaving a session do not get removed
from the table.
"remove-local-user" may also be emitted at this point if
user has the INF_USER_LOCAL flag set.
|
The InfUserTable from which user has been remove
|
|
The InfUser that has been removed from user_table
|
|
user data set when the signal handler was connected. |