InfUser

InfUser — User in a InfSession.

Stability Level

Unstable, unless otherwise indicated

Functions

Properties

InfXmlConnection * connection Read / Write
InfUserFlags flags Read / Write
guint id Read / Write / Construct Only
char * name Read / Write
InfUserStatus status Read / Write

Signals

void set-status Run Last

Types and Values

Object Hierarchy

    GEnum
    ╰── InfUserStatus
    GFlags
    ╰── InfUserFlags
    GObject
    ╰── InfUser
        ╰── InfAdoptedUser

Includes

#include <libinfinity/common/inf-user.h>

Description

InfUser represents a user in an InfSession. The InfUser object stores basic user information required in all kinds of sessions, that is the user ID, user name, its status and auxiliary flags.

Functions

inf_user_get_id ()

guint
inf_user_get_id (InfUser *user);

Returns the ID of the given InfUser.

Parameters

user

A InfUser.

 

Returns

A numerical User ID.


inf_user_get_name ()

const gchar *
inf_user_get_name (InfUser *user);

Returns the name of the given InfUser.

Parameters

user

A InfUser.

 

Returns

The user's name.

[transfer none]


inf_user_get_status ()

InfUserStatus
inf_user_get_status (InfUser *user);

Returns the status of the given InfUser.

Parameters

user

A InfUser.

 

Returns

The user's status.


inf_user_get_flags ()

InfUserFlags
inf_user_get_flags (InfUser *user);

Returns the flags for the given InfUser.

Parameters

user

A InfUser.

 

Returns

The user's flags.


inf_user_get_connection ()

InfXmlConnection *
inf_user_get_connection (InfUser *user);

Returns a connection to the given InfUser, or NULL. If a non-NULL connection is returned, then this is the connection through which records from that user come from. This means that, when this connection is closed, then the user is no longer available. However, you cannot send something to this connection expecting the user will receive it. For example, in central messaging mode, this connection is always the publisher, because all records from the user are relayed via the publisher.

If this functions returns NULL, this either means user is a local user (INF_USER_LOCAL flag set) or it is not available (status is INF_USER_UNAVAILABLE).

Parameters

user

A InfUser.

 

Returns

A InfXmlConnection, or NULL.

[transfer none][allow-none]


inf_user_status_to_string ()

const gchar *
inf_user_status_to_string (InfUserStatus status);

Returns a non-localized string identifying the given status. This is not meant to be shown to a user, but rather to serialize a user status, for example to store it in XML.

Parameters

status

A value from the InfUserStatus enumeration.

 

Returns

A static string representation of status .

[transfer none]


inf_user_status_from_string ()

gboolean
inf_user_status_from_string (const gchar *string,
                             InfUserStatus *status,
                             GError **error);

This function does the opposite of inf_user_status_to_string(). It turns the given string back to a InfUserStatus, storing the result in status if status is non-NULL. If string is invalid, then status is left untouched, error is set and FALSE is returned. Otherwise, the function returns TRUE.

Parameters

string

A string representation of a InfUserStatus.

 

status

A pointer to a InfUserStatus value, or NULL.

[out][allow-none]

error

Location to store error information, if any.

 

Returns

When an error occurred during the conversion, FALSE is returned, and TRUE otherwise.

Types and Values

enum InfUserStatus

Different possible types of status an InfUser can have.

Members

INF_USER_ACTIVE

The user is available and currently looking at this session.

 

INF_USER_INACTIVE

The user is available but currently not paying attention to this session.

 

INF_USER_UNAVAILABLE

The user is not available, i.e. not joined into the session.

 

enum InfUserFlags

Additional flags for InfUser.

Members

INF_USER_LOCAL

The user is local, i.e. joined by the local instance.

 

struct InfUser

struct InfUser;

InfUser is an opaque data type. You should only access it via the public API functions.


struct InfUserClass

struct InfUserClass {
  void (*set_status)(InfUser* user,
                     InfUserStatus status);
};

This structure contains virtual functions for the InfUser class.

Members

set_status ()

Virtual function to change the status of a user. This is a hook for user subclasses to react on status change.

 

Property Details

The “connection” property

  “connection”               InfXmlConnection *

Connection to the user.

Owner: InfUser

Flags: Read / Write


The “flags” property

  “flags”                    InfUserFlags

Flags the user currently has.

Owner: InfUser

Flags: Read / Write


The “id” property

  “id”                       guint

A Unique User ID.

Owner: InfUser

Flags: Read / Write / Construct Only

Default value: 0


The “name” property

  “name”                     char *

The Name with which a user joined a session. Most servers ensure that it is unique.

Owner: InfUser

Flags: Read / Write

Default value: ""


The “status” property

  “status”                   InfUserStatus

Whether the user is currently available or not.

Owner: InfUser

Flags: Read / Write

Default value: INF_USER_UNAVAILABLE

Signal Details

The “set-status” signal

void
user_function (InfUser      *user,
               InfUserStatus status,
               gpointer      user_data)

This signal is emitted whenever the user's status changes. This is basically the same as a notification for the “status” property, but it allows to access the previous user status when connecting before the default signal handler.

Parameters

user

The InfUser that changes status.

 

status

The new user status.

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

See Also

InfSession