InfUser

InfUser

Synopsis

enum                InfUserStatus;
enum                InfUserFlags;
                    InfUser;
struct              InfUserClass;
guint               inf_user_get_id                     (InfUser *user);
const gchar *       inf_user_get_name                   (InfUser *user);
InfUserStatus       inf_user_get_status                 (InfUser *user);
InfUserFlags        inf_user_get_flags                  (InfUser *user);
InfXmlConnection *  inf_user_get_connection             (InfUser *user);
const gchar *       inf_user_status_to_string           (InfUserStatus status);
gboolean            inf_user_status_from_string         (const gchar *string,
                                                         InfUserStatus *status,
                                                         GError **error);

Object Hierarchy

  GEnum
   +----InfUserStatus
  GFlags
   +----InfUserFlags
  GObject
   +----InfUser
         +----InfAdoptedUser

Properties

  "connection"               InfXmlConnection*     : Read / Write
  "flags"                    InfUserFlags          : Read / Write
  "id"                       guint                 : Read / Write / Construct Only
  "name"                     gchar*                : Read / Write
  "status"                   InfUserStatus         : Read / Write

Signals

  "set-status"                                     : Run Last

Description

Details

enum InfUserStatus

typedef enum {
  INF_USER_ACTIVE,
  INF_USER_INACTIVE,
  INF_USER_UNAVAILABLE
} InfUserStatus;

INF_USER_ACTIVE

INF_USER_INACTIVE

INF_USER_UNAVAILABLE


enum InfUserFlags

typedef enum {
  INF_USER_LOCAL = 1 << 0
} InfUserFlags;

INF_USER_LOCAL


InfUser

typedef struct _InfUser InfUser;


struct InfUserClass

struct InfUserClass {
  GObjectClass parent_class;

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


inf_user_get_id ()

guint               inf_user_get_id                     (InfUser *user);

Returns the ID of the given InfUser.

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.

user :

A InfUser.

Returns :

The user's name.

inf_user_get_status ()

InfUserStatus       inf_user_get_status                 (InfUser *user);

Returns the status of the given InfUser.

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.

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_UNAVAILBALE).

user :

A InfUser.

Returns :

A InfXmlConnection, or NULL.

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.

status :

A value from the InfUserStatus enumeration.

Returns :

A static string representation of status.

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.

string :

A string representation of a InfUserStatus.

status :

A pointer to a InfUserStatus value, or NULL.

error :

Location to store error information, if any.

Returns :

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

Property Details

The "connection" property

  "connection"               InfXmlConnection*     : Read / Write

Connection to the user.


The "flags" property

  "flags"                    InfUserFlags          : Read / Write

Flags the user currently has.


The "id" property

  "id"                       guint                 : Read / Write / Construct Only

A Unique User ID.

Default value: 0


The "name" property

  "name"                     gchar*                : Read / Write

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

Default value: ""


The "status" property

  "status"                   InfUserStatus         : Read / Write

Whether the user is currently available or not.

Default value: INF_USER_UNAVAILABLE

Signal Details

The "set-status" signal

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

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.

user :

The InfUser that changes status.

status :

The new user status.

user_data :

user data set when the signal handler was connected.