pidgin: status.h File Reference

pidgin 2.14.4

Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations
status.h File Reference
libpurple

Status API. More...

`#include "account.h"`
`#include "blist.h"`
`#include "conversation.h"`
`#include "value.h"`

Go to the source code of this file.

## Data Structures
struct | _PurpleMood

## Macros
#define | PURPLE_TUNE_ARTIST "tune_artist"
#define | PURPLE_TUNE_TITLE "tune_title"
#define | PURPLE_TUNE_ALBUM "tune_album"
#define | PURPLE_TUNE_GENRE "tune_genre"
#define | PURPLE_TUNE_COMMENT "tune_comment"
#define | PURPLE_TUNE_TRACK "tune_track"
#define | PURPLE_TUNE_TIME "tune_time"
#define | PURPLE_TUNE_YEAR "tune_year"
#define | PURPLE_TUNE_URL "tune_url"
#define | PURPLE_TUNE_FULL "tune_full"
#define | PURPLE_MOOD_NAME "mood"
#define | PURPLE_MOOD_COMMENT "moodtext"

## Typedefs
typedef struct _PurpleStatusType | PurpleStatusType
| PurpleStatusType's are created by each PRPL.
typedef struct _PurpleStatusAttr | PurpleStatusAttr
typedef struct _PurplePresence | PurplePresence
typedef struct _PurpleStatus | PurpleStatus
typedef struct _PurpleMood | PurpleMood

## Enumerations
enum | PurplePresenceContext { PURPLE_PRESENCE_CONTEXT_UNSET = 0 , PURPLE_PRESENCE_CONTEXT_ACCOUNT , PURPLE_PRESENCE_CONTEXT_CONV , PURPLE_PRESENCE_CONTEXT_BUDDY }
| A context for a presence. More...
enum | PurpleStatusPrimitive { PURPLE_STATUS_UNSET = 0 , PURPLE_STATUS_OFFLINE , PURPLE_STATUS_AVAILABLE , PURPLE_STATUS_UNAVAILABLE , PURPLE_STATUS_INVISIBLE , PURPLE_STATUS_AWAY , PURPLE_STATUS_EXTENDED_AWAY , PURPLE_STATUS_MOBILE , PURPLE_STATUS_TUNE , PURPLE_STATUS_MOOD , PURPLE_STATUS_NUM_PRIMITIVES }
| A primitive defining the basic structure of a status type. More...

## Functions
PurpleStatusPrimitive API <br>
const char * | purple_primitive_get_id_from_type (PurpleStatusPrimitive type)
| Lookup the id of a primitive status type based on the type.
const char * | purple_primitive_get_name_from_type (PurpleStatusPrimitive type)
| Lookup the name of a primitive status type based on the type.
PurpleStatusPrimitive | purple_primitive_get_type_from_id (const char *id)
| Lookup the value of a primitive status type based on the id.
PurpleStatusType API <br>
PurpleStatusType * | purple_status_type_new_full (PurpleStatusPrimitive primitive, const char *id, const char *name, gboolean saveable, gboolean user_settable, gboolean independent)
| Creates a new status type.
PurpleStatusType * | purple_status_type_new (PurpleStatusPrimitive primitive, const char *id, const char *name, gboolean user_settable)
| Creates a new status type with some default values ( saveable and not independent).
PurpleStatusType * | purple_status_type_new_with_attrs (PurpleStatusPrimitive primitive, const char *id, const char *name, gboolean saveable, gboolean user_settable, gboolean independent, const char *attr_id, const char *attr_name, PurpleValue *attr_value,...) G_GNUC_NULL_TERMINATED
| Creates a new status type with attributes.
void | purple_status_type_destroy (PurpleStatusType *status_type)
| Destroys a status type.
void | purple_status_type_set_primary_attr (PurpleStatusType *status_type, const char *attr_id)
| Sets a status type's primary attribute.
void | purple_status_type_add_attr (PurpleStatusType *status_type, const char *id, const char *name, PurpleValue *value)
| Adds an attribute to a status type.
void | purple_status_type_add_attrs (PurpleStatusType *status_type, const char *id, const char *name, PurpleValue *value,...) G_GNUC_NULL_TERMINATED
| Adds multiple attributes to a status type.
void | purple_status_type_add_attrs_vargs (PurpleStatusType *status_type, va_list args)
| Adds multiple attributes to a status type using a va_list.
PurpleStatusPrimitive | purple_status_type_get_primitive (const PurpleStatusType *status_type)
| Returns the primitive type of a status type.
const char * | purple_status_type_get_id (const PurpleStatusType *status_type)
| Returns the ID of a status type.
const char * | purple_status_type_get_name (const PurpleStatusType *status_type)
| Returns the name of a status type.
gboolean | purple_status_type_is_saveable (const PurpleStatusType *status_type)
| Returns whether or not the status type is saveable.
gboolean | purple_status_type_is_user_settable (const PurpleStatusType *status_type)
| Returns whether or not the status type can be set or modified by the user.
gboolean | purple_status_type_is_independent (const PurpleStatusType *status_type)
| Returns whether or not the status type is independent.
gboolean | purple_status_type_is_exclusive (const PurpleStatusType *status_type)
| Returns whether the status type is exclusive.
gboolean | purple_status_type_is_available (const PurpleStatusType *status_type)
| Returns whether or not a status type is available.
const char * | purple_status_type_get_primary_attr (const PurpleStatusType *type)
| Returns a status type's primary attribute ID.
PurpleStatusAttr * | purple_status_type_get_attr (const PurpleStatusType *status_type, const char *id)
| Returns the attribute with the specified ID.
GList * | purple_status_type_get_attrs (const PurpleStatusType *status_type)
| Returns a list of all attributes in a status type.
const PurpleStatusType * | purple_status_type_find_with_id (GList *status_types, const char *id)
| Find the PurpleStatusType with the given id.
PurpleStatusAttr API <br>
PurpleStatusAttr * | purple_status_attr_new (const char *id, const char *name, PurpleValue *value_type)
| Creates a new status attribute.
void | purple_status_attr_destroy (PurpleStatusAttr *attr)
| Destroys a status attribute.
const char * | purple_status_attr_get_id (const PurpleStatusAttr *attr)
| Returns the ID of a status attribute.
const char * | purple_status_attr_get_name (const PurpleStatusAttr *attr)
| Returns the name of a status attribute.
PurpleValue * | purple_status_attr_get_value (const PurpleStatusAttr *attr)
| Returns the value of a status attribute.
PurpleStatus API <br>
PurpleStatus * | purple_status_new (PurpleStatusType *status_type, PurplePresence *presence)
| Creates a new status.
void | purple_status_destroy (PurpleStatus *status)
| Destroys a status.
void | purple_status_set_active (PurpleStatus *status, gboolean active)
| Sets whether or not a status is active.
void | purple_status_set_active_with_attrs (PurpleStatus *status, gboolean active, va_list args)
| Sets whether or not a status is active.
void | purple_status_set_active_with_attrs_list (PurpleStatus *status, gboolean active, GList *attrs)
| Sets whether or not a status is active.
void | purple_status_set_attr_boolean (PurpleStatus *status, const char *id, gboolean value)
| Sets the boolean value of an attribute in a status with the specified ID.
void | purple_status_set_attr_int (PurpleStatus *status, const char *id, int value)
| Sets the integer value of an attribute in a status with the specified ID.
void | purple_status_set_attr_string (PurpleStatus *status, const char *id, const char *value)
| Sets the string value of an attribute in a status with the specified ID.
PurpleStatusType * | purple_status_get_type (const PurpleStatus *status)
| Returns the status's type.
PurplePresence * | purple_status_get_presence (const PurpleStatus *status)
| Returns the status's presence.
const char * | purple_status_get_id (const PurpleStatus *status)
| Returns the status's type ID.
const char * | purple_status_get_name (const PurpleStatus *status)
| Returns the status's name.
gboolean | purple_status_is_independent (const PurpleStatus *status)
| Returns whether or not a status is independent.
gboolean | purple_status_is_exclusive (const PurpleStatus *status)
| Returns whether or not a status is exclusive.
gboolean | purple_status_is_available (const PurpleStatus *status)
| Returns whether or not a status is available.
gboolean | purple_status_is_active (const PurpleStatus *status)
| Returns the active state of a status.
gboolean | purple_status_is_online (const PurpleStatus *status)
| Returns whether or not a status is considered 'online'.
PurpleValue * | purple_status_get_attr_value (const PurpleStatus *status, const char *id)
| Returns the value of an attribute in a status with the specified ID.
gboolean | purple_status_get_attr_boolean (const PurpleStatus *status, const char *id)
| Returns the boolean value of an attribute in a status with the specified ID.
int | purple_status_get_attr_int (const PurpleStatus *status, const char *id)
| Returns the integer value of an attribute in a status with the specified ID.
const char * | purple_status_get_attr_string (const PurpleStatus *status, const char *id)
| Returns the string value of an attribute in a status with the specified ID.
gint | purple_status_compare (const PurpleStatus *status1, const PurpleStatus *status2)
| Compares two statuses for availability.
PurplePresence API <br>
PurplePresence * | purple_presence_new (PurplePresenceContext context)
| Creates a new presence.
PurplePresence * | purple_presence_new_for_account (PurpleAccount *account)
| Creates a presence for an account.
PurplePresence * | purple_presence_new_for_conv (PurpleConversation *conv)
| Creates a presence for a conversation.
PurplePresence * | purple_presence_new_for_buddy (PurpleBuddy *buddy)
| Creates a presence for a buddy.
void | purple_presence_destroy (PurplePresence *presence)
| Destroys a presence.
void | purple_presence_add_status (PurplePresence *presence, PurpleStatus *status)
| Adds a status to a presence.
void | purple_presence_add_list (PurplePresence *presence, GList *source_list)
| Adds a list of statuses to the presence.
void | purple_presence_set_status_active (PurplePresence *presence, const char *status_id, gboolean active)
| Sets the active state of a status in a presence.
void | purple_presence_switch_status (PurplePresence *presence, const char *status_id)
| Switches the active status in a presence.
void | purple_presence_set_idle (PurplePresence *presence, gboolean idle, time_t idle_time)
| Sets the idle state and time on a presence.
void | purple_presence_set_login_time (PurplePresence *presence, time_t login_time)
| Sets the login time on a presence.
PurplePresenceContext | purple_presence_get_context (const PurplePresence *presence)
| Returns the presence's context.
PurpleAccount * | purple_presence_get_account (const PurplePresence *presence)
| Returns a presence's account.
PurpleConversation * | purple_presence_get_conversation (const PurplePresence *presence)
| Returns a presence's conversation.
const char * | purple_presence_get_chat_user (const PurplePresence *presence)
| Returns a presence's chat user.
PurpleBuddy * | purple_presence_get_buddy (const PurplePresence *presence)
| Returns the presence's buddy.
GList * | purple_presence_get_statuses (const PurplePresence *presence)
| Returns all the statuses in a presence.
PurpleStatus * | purple_presence_get_status (const PurplePresence *presence, const char *status_id)
| Returns the status with the specified ID from a presence.
PurpleStatus * | purple_presence_get_active_status (const PurplePresence *presence)
| Returns the active exclusive status from a presence.
gboolean | purple_presence_is_available (const PurplePresence *presence)
| Returns whether or not a presence is available.
gboolean | purple_presence_is_online (const PurplePresence *presence)
| Returns whether or not a presence is online.
gboolean | purple_presence_is_status_active (const PurplePresence *presence, const char *status_id)
| Returns whether or not a status in a presence is active.
gboolean | purple_presence_is_status_primitive_active (const PurplePresence *presence, PurpleStatusPrimitive primitive)
| Returns whether or not a status with the specified primitive type in a presence is active.
gboolean | purple_presence_is_idle (const PurplePresence *presence)
| Returns whether or not a presence is idle.
time_t | purple_presence_get_idle_time (const PurplePresence *presence)
| Returns the presence's idle time.
time_t | purple_presence_get_login_time (const PurplePresence *presence)
| Returns the presence's login time.
gint | purple_presence_compare (const PurplePresence *presence1, const PurplePresence *presence2)
| Compares two presences for availability.
Status subsystem <br>
void * | purple_status_get_handle (void)
| Get the handle for the status subsystem.
void | purple_status_init (void)
| Initializes the status subsystem.
void | purple_status_uninit (void)
| Uninitializes the status subsystem.

## Detailed Description

Status API.

A brief explanation of the status API:

PurpleStatusType's are created by each PRPL. They outline the available statuses of the protocol. AIM, for example, supports an available state with an optional available message, an away state with a mandatory message, and an invisible state (which is technically "independent" of the other two, but we'll get into that later). PurpleStatusTypes are very permanent. They are hardcoded in each PRPL and will not change often. And because they are hardcoded, they do not need to be saved to any XML file.

A PurpleStatus can be thought of as an "instance" of a PurpleStatusType. If you're familiar with object-oriented programming languages then this should be immediately clear. Say, for example, that one of your AIM buddies has set himself as "away." You have a PurpleBuddy node for this person in your buddy list. Purple wants to mark this buddy as "away," so it creates a new PurpleStatus. The PurpleStatus has its PurpleStatusType set to the "away" state for the oscar PRPL. The PurpleStatus also contains the buddy's away message. PurpleStatuses are sometimes saved, depending on the context. The current PurpleStatuses associated with each of your accounts are saved so that the next time you start Purple, your accounts will be set to their last known statuses. There is also a list of saved statuses that are written to the status.xml file. Also, each PurpleStatus has a "saveable" boolean. If "saveable" is set to FALSE then the status is NEVER saved. All PurpleStatuses should be inside a PurplePresence.

A PurpleStatus is either "independent" or "exclusive." Independent statuses can be active or inactive and they don't affect anything else. However, you can only have one exclusive status per PurplePresence. If you activate one exclusive status, then the previous exclusive status is automatically deactivated.

A PurplePresence is like a collection of PurpleStatuses (plus some other random info). For any buddy, or for any one of your accounts, or for any person with which you're chatting, you may know various amounts of information. This information is all contained in one PurplePresence. If one of your buddies is away and idle, then the presence contains the PurpleStatus for their awayness, and it contains their current idle time. PurplePresences are never saved to disk. The information they contain is only relevant for the current PurpleSession.

Definition in file status.h.

## Macro Definition Documentation

## ◆ PURPLE_MOOD_COMMENT

#define PURPLE_MOOD_COMMENT "moodtext"

Definition at line 149 of file status.h.

## ◆ PURPLE_MOOD_NAME

#define PURPLE_MOOD_NAME "mood"

Definition at line 148 of file status.h.

## ◆ PURPLE_TUNE_ALBUM

#define PURPLE_TUNE_ALBUM "tune_album"

Definition at line 139 of file status.h.

## ◆ PURPLE_TUNE_ARTIST

#define PURPLE_TUNE_ARTIST "tune_artist"

Definition at line 137 of file status.h.

## ◆ PURPLE_TUNE_COMMENT

#define PURPLE_TUNE_COMMENT "tune_comment"

Definition at line 141 of file status.h.

## ◆ PURPLE_TUNE_FULL

#define PURPLE_TUNE_FULL "tune_full"

Definition at line 146 of file status.h.

## ◆ PURPLE_TUNE_GENRE

#define PURPLE_TUNE_GENRE "tune_genre"

Definition at line 140 of file status.h.

## ◆ PURPLE_TUNE_TIME

#define PURPLE_TUNE_TIME "tune_time"

Definition at line 143 of file status.h.

## ◆ PURPLE_TUNE_TITLE

#define PURPLE_TUNE_TITLE "tune_title"

Definition at line 138 of file status.h.

## ◆ PURPLE_TUNE_TRACK

#define PURPLE_TUNE_TRACK "tune_track"

Definition at line 142 of file status.h.

## ◆ PURPLE_TUNE_URL

#define PURPLE_TUNE_URL "tune_url"

Definition at line 145 of file status.h.

## ◆ PURPLE_TUNE_YEAR

#define PURPLE_TUNE_YEAR "tune_year"

Definition at line 144 of file status.h.

## Typedef Documentation

## ◆ PurplePresence

typedef struct _PurplePresence PurplePresence

Definition at line 87 of file status.h.

## ◆ PurpleStatus

typedef struct _PurpleStatus PurpleStatus

Definition at line 88 of file status.h.

## ◆ PurpleStatusAttr

typedef struct _PurpleStatusAttr PurpleStatusAttr

Definition at line 86 of file status.h.

## ◆ PurpleStatusType

typedef struct _PurpleStatusType PurpleStatusType

PurpleStatusType's are created by each PRPL.

They outline the available statuses of the protocol. AIM, for example, supports an available state with an optional available message, an away state with a mandatory message, and an invisible state (which is technically "independent" of the other two, but we'll get into that later). PurpleStatusTypes are very permanent. They are hardcoded in each PRPL and will not change often. And because they are hardcoded, they do not need to be saved to any XML file.

Definition at line 85 of file status.h.

## Enumeration Type Documentation

## ◆ PurplePresenceContext

enum PurplePresenceContext

A context for a presence.

The context indicates to what the presence applies.

Definition at line 101 of file status.h.

## ◆ PurpleStatusPrimitive

enum PurpleStatusPrimitive

A primitive defining the basic structure of a status type.

Definition at line 117 of file status.h.

## Function Documentation

## ◆ purple_presence_add_list()

void purple_presence_add_list | ( | PurplePresence * | presence,
|  | GList * | source_list
| ) |  |

Adds a list of statuses to the presence.

Parameters

  presence | The presence.
  source_list | The source list of statuses to add, which is not modified or freed by this function.

Deprecated:
  This function isn't used and should be removed in 3.0.0.

## ◆ purple_presence_add_status()

void purple_presence_add_status | ( | PurplePresence * | presence,
|  | PurpleStatus * | status
| ) |  |

Adds a status to a presence.

Parameters

  presence | The presence.
  status | The status to add.

Deprecated:
  This function is only used by purple_presence_add_list, and both should be removed in 3.0.0.

## ◆ purple_presence_compare()

gint purple_presence_compare | ( | const PurplePresence * | presence1,
|  | const PurplePresence * | presence2
| ) |  |

Compares two presences for availability.

Parameters

  presence1 | The first presence.
  presence2 | The second presence.

Returns
  -1 if presence1 is more available than presence2. 0 if presence1 is equal to presence2. 1 if presence1 is less available than presence2.

## ◆ purple_presence_destroy()

void purple_presence_destroy | ( | PurplePresence * | presence | ) |

Destroys a presence.

All statuses added to this list will be destroyed along with the presence.

Parameters

  presence | The presence to destroy.

## ◆ purple_presence_get_account()

PurpleAccount * purple_presence_get_account | ( | const PurplePresence * | presence | ) |

Returns a presence's account.

Parameters

  presence | The presence.

Returns
  The presence's account.

## ◆ purple_presence_get_active_status()

PurpleStatus * purple_presence_get_active_status | ( | const PurplePresence * | presence | ) |

Returns the active exclusive status from a presence.

Parameters

  presence | The presence.

Returns
  The active exclusive status.

## ◆ purple_presence_get_buddy()

PurpleBuddy * purple_presence_get_buddy | ( | const PurplePresence * | presence | ) |

Returns the presence's buddy.

Parameters

  presence | The presence.

Returns
  The presence's buddy.

## ◆ purple_presence_get_chat_user()

const char * purple_presence_get_chat_user | ( | const PurplePresence * | presence | ) |

Returns a presence's chat user.

Parameters

  presence | The presence.

Returns
  The chat's user.

## ◆ purple_presence_get_context()

PurplePresenceContext purple_presence_get_context | ( | const PurplePresence * | presence | ) |

Returns the presence's context.

Parameters

  presence | The presence.

Returns
  The presence's context.

## ◆ purple_presence_get_conversation()

PurpleConversation * purple_presence_get_conversation | ( | const PurplePresence * | presence | ) |

Returns a presence's conversation.

Parameters

  presence | The presence.

Returns
  The presence's conversation.

## ◆ purple_presence_get_idle_time()

time_t purple_presence_get_idle_time | ( | const PurplePresence * | presence | ) |

Returns the presence's idle time.

Parameters

  presence | The presence.

Returns
  The presence's idle time.

## ◆ purple_presence_get_login_time()

time_t purple_presence_get_login_time | ( | const PurplePresence * | presence | ) |

Returns the presence's login time.

Parameters

  presence | The presence.

Returns
  The presence's login time.

## ◆ purple_presence_get_status()

PurpleStatus * purple_presence_get_status | ( | const PurplePresence * | presence,
|  | const char * | status_id
| ) |  |

Returns the status with the specified ID from a presence.

Parameters

  presence | The presence.
  status_id | The ID of the status.

Returns
  The status if found, or NULL.

## ◆ purple_presence_get_statuses()

GList * purple_presence_get_statuses | ( | const PurplePresence * | presence | ) |

Returns all the statuses in a presence.

Parameters

  presence | The presence.

Note
  The return value of this function must not be modified or freed.

Returns
  The statuses.

## ◆ purple_presence_is_available()

gboolean purple_presence_is_available | ( | const PurplePresence * | presence | ) |

Returns whether or not a presence is available.

Available presences are online and possibly invisible, but not away or idle.

Parameters

  presence | The presence.

Returns
  TRUE if the presence is available, or FALSE otherwise.

## ◆ purple_presence_is_idle()

gboolean purple_presence_is_idle | ( | const PurplePresence * | presence | ) |

Returns whether or not a presence is idle.

Parameters

  presence | The presence.

Returns
  TRUE if the presence is idle, or FALSE otherwise. If the presence is offline (purple_presence_is_online() returns FALSE) then FALSE is returned.

## ◆ purple_presence_is_online()

gboolean purple_presence_is_online | ( | const PurplePresence * | presence | ) |

Returns whether or not a presence is online.

Parameters

  presence | The presence.

Returns
  TRUE if the presence is online, or FALSE otherwise.

## ◆ purple_presence_is_status_active()

gboolean purple_presence_is_status_active | ( | const PurplePresence * | presence,
|  | const char * | status_id
| ) |  |

Returns whether or not a status in a presence is active.

A status is active if itself or any of its sub-statuses are active.

Parameters

  presence | The presence.
  status_id | The ID of the status.

Returns
  TRUE if the status is active, or FALSE.

## ◆ purple_presence_is_status_primitive_active()

gboolean purple_presence_is_status_primitive_active | ( | const PurplePresence * | presence,
|  | PurpleStatusPrimitive | primitive
| ) |  |

Returns whether or not a status with the specified primitive type in a presence is active.

A status is active if itself or any of its sub-statuses are active.

Parameters

  presence | The presence.
  primitive | The status primitive.

Returns
  TRUE if the status is active, or FALSE.

## ◆ purple_presence_new()

PurplePresence * purple_presence_new | ( | PurplePresenceContext | context | ) |

Creates a new presence.

Parameters

  context | The presence context.

Returns
  A new presence.

## ◆ purple_presence_new_for_account()

PurplePresence * purple_presence_new_for_account | ( | PurpleAccount * | account | ) |

Creates a presence for an account.

Parameters

  account | The account.

Returns
  The new presence.

## ◆ purple_presence_new_for_buddy()

PurplePresence * purple_presence_new_for_buddy | ( | PurpleBuddy * | buddy | ) |

Creates a presence for a buddy.

Parameters

  buddy | The buddy.

Returns
  The new presence.

## ◆ purple_presence_new_for_conv()

PurplePresence * purple_presence_new_for_conv | ( | PurpleConversation * | conv | ) |

Creates a presence for a conversation.

Parameters

  conv | The conversation.

Returns
  The new presence.

## ◆ purple_presence_set_idle()

void purple_presence_set_idle | ( | PurplePresence * | presence,
|  | gboolean | idle,
|  | time_t | idle_time
| ) |  |

Sets the idle state and time on a presence.

Parameters

  presence | The presence.
  idle | The idle state.
  idle_time | The idle time, if idle is TRUE. This is the time at which the user became idle, in seconds since the epoch. If this value is unknown then 0 should be used.

## ◆ purple_presence_set_login_time()

void purple_presence_set_login_time | ( | PurplePresence * | presence,
|  | time_t | login_time
| ) |  |

Sets the login time on a presence.

Parameters

  presence | The presence.
  login_time | The login time.

## ◆ purple_presence_set_status_active()

void purple_presence_set_status_active | ( | PurplePresence * | presence,
|  | const char * | status_id,
|  | gboolean | active
| ) |  |

Sets the active state of a status in a presence.

Only independent statuses can be set unactive. Normal statuses can only be set active, so if you wish to disable a status, set another non-independent status to active, or use purple_presence_switch_status().

Parameters

  presence | The presence.
  status_id | The ID of the status.
  active | The active state.

## ◆ purple_presence_switch_status()

void purple_presence_switch_status | ( | PurplePresence * | presence,
|  | const char * | status_id
| ) |  |

Switches the active status in a presence.

This is similar to purple_presence_set_status_active(), except it won't activate independent statuses.

Parameters

  presence | The presence.
  status_id | The status ID to switch to.

## ◆ purple_primitive_get_id_from_type()

const char * purple_primitive_get_id_from_type | ( | PurpleStatusPrimitive | type | ) |

Lookup the id of a primitive status type based on the type.

This ID is a unique plain-text name of the status, without spaces.

Parameters

  type | A primitive status type.

Returns
  The unique ID for this type.

## ◆ purple_primitive_get_name_from_type()

const char * purple_primitive_get_name_from_type | ( | PurpleStatusPrimitive | type | ) |

Lookup the name of a primitive status type based on the type.

This name is the plain-English name of the status type. It is usually one or two words.

Parameters

  type | A primitive status type.

Returns
  The name of this type, suitable for users to see.

## ◆ purple_primitive_get_type_from_id()

PurpleStatusPrimitive purple_primitive_get_type_from_id | ( | const char * | id | ) |

Lookup the value of a primitive status type based on the id.

The ID is a unique plain-text name of the status, without spaces.

Parameters

  id | The unique ID of a primitive status type.

Returns
  The PurpleStatusPrimitive value.

## ◆ purple_status_attr_destroy()

void purple_status_attr_destroy | ( | PurpleStatusAttr * | attr | ) |

Destroys a status attribute.

Parameters

  attr | The status attribute to destroy.

## ◆ purple_status_attr_get_id()

const char * purple_status_attr_get_id | ( | const PurpleStatusAttr * | attr | ) |

Returns the ID of a status attribute.

Parameters

  attr | The status attribute.

Returns
  The status attribute's ID.

## ◆ purple_status_attr_get_name()

const char * purple_status_attr_get_name | ( | const PurpleStatusAttr * | attr | ) |

Returns the name of a status attribute.

Parameters

  attr | The status attribute.

Returns
  The status attribute's name.

## ◆ purple_status_attr_get_value()

PurpleValue * purple_status_attr_get_value | ( | const PurpleStatusAttr * | attr | ) |

Returns the value of a status attribute.

Parameters

  attr | The status attribute.

Returns
  The status attribute's value.

## ◆ purple_status_attr_new()

PurpleStatusAttr * purple_status_attr_new | ( | const char * | id,
|  | const char * | name,
|  | PurpleValue * | value_type
| ) |  |

Creates a new status attribute.

Parameters

  id | The ID of the attribute.
  name | The name presented to the user.
  value_type | The type of data contained in the attribute.

Returns
  A new status attribute.

## ◆ purple_status_compare()

gint purple_status_compare | ( | const PurpleStatus * | status1,
|  | const PurpleStatus * | status2
| ) |  |

Compares two statuses for availability.

Parameters

  status1 | The first status.
  status2 | The second status.

Returns
  -1 if status1 is more available than status2. 0 if status1 is equal to status2. 1 if status2 is more available than status1.

## ◆ purple_status_destroy()

void purple_status_destroy | ( | PurpleStatus * | status | ) |

Destroys a status.

Parameters

  status | The status to destroy.

## ◆ purple_status_get_attr_boolean()

gboolean purple_status_get_attr_boolean | ( | const PurpleStatus * | status,
|  | const char * | id
| ) |  |

Returns the boolean value of an attribute in a status with the specified ID.

Parameters

  status | The status.
  id | The attribute ID.

Returns
  The boolean value of the attribute.

## ◆ purple_status_get_attr_int()

int purple_status_get_attr_int | ( | const PurpleStatus * | status,
|  | const char * | id
| ) |  |

Returns the integer value of an attribute in a status with the specified ID.

Parameters

  status | The status.
  id | The attribute ID.

Returns
  The integer value of the attribute.

## ◆ purple_status_get_attr_string()

const char * purple_status_get_attr_string | ( | const PurpleStatus * | status,
|  | const char * | id
| ) |  |

Returns the string value of an attribute in a status with the specified ID.

Parameters

  status | The status.
  id | The attribute ID.

Returns
  The string value of the attribute.

## ◆ purple_status_get_attr_value()

PurpleValue * purple_status_get_attr_value | ( | const PurpleStatus * | status,
|  | const char * | id
| ) |  |

Returns the value of an attribute in a status with the specified ID.

Parameters

  status | The status.
  id | The attribute ID.

Returns
  The value of the attribute.

## ◆ purple_status_get_handle()

void * purple_status_get_handle | ( | void |  | ) |

Get the handle for the status subsystem.

Returns
  the handle to the status subsystem

## ◆ purple_status_get_id()

const char * purple_status_get_id | ( | const PurpleStatus * | status | ) |

Returns the status's type ID.

This is a convenience method for purple_status_type_get_id(purple_status_get_type(status)).

Parameters

  status | The status.

Returns
  The status's ID.

## ◆ purple_status_get_name()

const char * purple_status_get_name | ( | const PurpleStatus * | status | ) |

Returns the status's name.

This is a convenience method for purple_status_type_get_name(purple_status_get_type(status)).

Parameters

  status | The status.

Returns
  The status's name.

## ◆ purple_status_get_presence()

PurplePresence * purple_status_get_presence | ( | const PurpleStatus * | status | ) |

Returns the status's presence.

Parameters

  status | The status.

Returns
  The status's presence.

## ◆ purple_status_get_type()

PurpleStatusType * purple_status_get_type | ( | const PurpleStatus * | status | ) |

Returns the status's type.

Parameters

  status | The status.

Returns
  The status's type.

## ◆ purple_status_is_active()

gboolean purple_status_is_active | ( | const PurpleStatus * | status | ) |

Returns the active state of a status.

Parameters

  status | The status.

Returns
  The active state of the status.

## ◆ purple_status_is_available()

gboolean purple_status_is_available | ( | const PurpleStatus * | status | ) |

Returns whether or not a status is available.

Available statuses are online and possibly invisible, but not away or idle.

This is a convenience method for purple_status_type_is_available(purple_status_get_type(status)).

Parameters

  status | The status.

Returns
  TRUE if the status is available, or FALSE otherwise.

## ◆ purple_status_is_exclusive()

gboolean purple_status_is_exclusive | ( | const PurpleStatus * | status | ) |

Returns whether or not a status is exclusive.

This is a convenience method for purple_status_type_is_exclusive(purple_status_get_type(status)).

Parameters

  status | The status.

Returns
  TRUE if the status is exclusive, FALSE otherwise.

## ◆ purple_status_is_independent()

gboolean purple_status_is_independent | ( | const PurpleStatus * | status | ) |

Returns whether or not a status is independent.

This is a convenience method for purple_status_type_is_independent(purple_status_get_type(status)).

Parameters

  status | The status.

Returns
  TRUE if the status is independent, or FALSE otherwise.

## ◆ purple_status_is_online()

gboolean purple_status_is_online | ( | const PurpleStatus * | status | ) |

Returns whether or not a status is considered 'online'.

Parameters

  status | The status.

Returns
  TRUE if the status is considered online, FALSE otherwise

## ◆ purple_status_new()

PurpleStatus * purple_status_new | ( | PurpleStatusType * | status_type,
|  | PurplePresence * | presence
| ) |  |

Creates a new status.

Parameters

  status_type | The type of status.
  presence | The parent presence.

Returns
  The new status.

## ◆ purple_status_set_active()

void purple_status_set_active | ( | PurpleStatus * | status,
|  | gboolean | active
| ) |  |

Sets whether or not a status is active.

This should only be called by the account, conversation, and buddy APIs.

Parameters

  status | The status.
  active | The active state.

## ◆ purple_status_set_active_with_attrs()

void purple_status_set_active_with_attrs | ( | PurpleStatus * | status,
|  | gboolean | active,
|  | va_list | args
| ) |  |

Sets whether or not a status is active.

This should only be called by the account, conversation, and buddy APIs.

Parameters

  status | The status.
  active | The active state.
  args | A list of attributes to set on the status. This list is composed of key/value pairs, where each key is a valid attribute name for this PurpleStatusType. The list should be NULL terminated.

## ◆ purple_status_set_active_with_attrs_list()

void purple_status_set_active_with_attrs_list | ( | PurpleStatus * | status,
|  | gboolean | active,
|  | GList * | attrs
| ) |  |

Sets whether or not a status is active.

This should only be called by the account, conversation, and buddy APIs.

Parameters

  status | The status.
  active | The active state.
  attrs | A list of attributes to set on the status. This list is composed of key/value pairs, where each key is a valid attribute name for this PurpleStatusType. The list is not modified or freed by this function.

## ◆ purple_status_set_attr_boolean()

void purple_status_set_attr_boolean | ( | PurpleStatus * | status,
|  | const char * | id,
|  | gboolean | value
| ) |  |

Sets the boolean value of an attribute in a status with the specified ID.

Parameters

  status | The status.
  id | The attribute ID.
  value | The boolean value.

Deprecated:
  This function is only used by status.c and should be made static in 3.0.0.

## ◆ purple_status_set_attr_int()

void purple_status_set_attr_int | ( | PurpleStatus * | status,
|  | const char * | id,
|  | int | value
| ) |  |

Sets the integer value of an attribute in a status with the specified ID.

Parameters

  status | The status.
  id | The attribute ID.
  value | The integer value.

Deprecated:
  This function is only used by status.c and should be made static in 3.0.0.

## ◆ purple_status_set_attr_string()

void purple_status_set_attr_string | ( | PurpleStatus * | status,
|  | const char * | id,
|  | const char * | value
| ) |  |

Sets the string value of an attribute in a status with the specified ID.

Parameters

  status | The status.
  id | The attribute ID.
  value | The string value.

Deprecated:
  This function is only used by status.c and should be made static in 3.0.0.

## ◆ purple_status_type_add_attr()

void purple_status_type_add_attr | ( | PurpleStatusType * | status_type,
|  | const char * | id,
|  | const char * | name,
|  | PurpleValue * | value
| ) |  |

Adds an attribute to a status type.

Parameters

  status_type | The status type to add the attribute to.
  id | The ID of the attribute.
  name | The name presented to the user.
  value | The value type of this attribute.

Deprecated:
  This function isn't needed and should be removed in 3.0.0. Status type attributes should be set when the status type is created, in the call to purple_status_type_new_with_attrs.

## ◆ purple_status_type_add_attrs()

void purple_status_type_add_attrs | ( | PurpleStatusType * | status_type,
|  | const char * | id,
|  | const char * | name,
|  | PurpleValue * | value,
|  |  | ...
| ) |  |

Adds multiple attributes to a status type.

Parameters

  status_type | The status type to add the attribute to.
  id | The ID of the first attribute.
  name | The description of the first attribute.
  value | The value type of the first attribute attribute.
  ... | Additional attribute information.

Deprecated:
  This function isn't needed and should be removed in 3.0.0. Status type attributes should be set when the status type is created, in the call to purple_status_type_new_with_attrs.

## ◆ purple_status_type_add_attrs_vargs()

void purple_status_type_add_attrs_vargs | ( | PurpleStatusType * | status_type,
|  | va_list | args
| ) |  |

Adds multiple attributes to a status type using a va_list.

Parameters

  status_type | The status type to add the attribute to.
  args | The va_list of attributes.

Deprecated:
  This function isn't needed and should be removed in 3.0.0. Status type attributes should be set when the status type is created, in the call to purple_status_type_new_with_attrs.

## ◆ purple_status_type_destroy()

void purple_status_type_destroy | ( | PurpleStatusType * | status_type | ) |

Destroys a status type.

Parameters

  status_type | The status type to destroy.

## ◆ purple_status_type_find_with_id()

const PurpleStatusType * purple_status_type_find_with_id | ( | GList * | status_types,
|  | const char * | id
| ) |  |

Find the PurpleStatusType with the given id.

Parameters

  status_types | A list of status types. Often account->status_types.
  id | The unique ID of the status type you wish to find.

Returns
  The status type with the given ID, or NULL if one could not be found.

## ◆ purple_status_type_get_attr()

PurpleStatusAttr * purple_status_type_get_attr | ( | const PurpleStatusType * | status_type,
|  | const char * | id
| ) |  |

Returns the attribute with the specified ID.

Parameters

  status_type | The status type containing the attribute.
  id | The ID of the desired attribute.

Returns
  The attribute, if found. NULL otherwise.

## ◆ purple_status_type_get_attrs()

GList * purple_status_type_get_attrs | ( | const PurpleStatusType * | status_type | ) |

Returns a list of all attributes in a status type.

Parameters

  status_type | The status type.

Note
  The return value of this function must not be modified or freed.

Returns
  The list of attributes.

## ◆ purple_status_type_get_id()

const char * purple_status_type_get_id | ( | const PurpleStatusType * | status_type | ) |

Returns the ID of a status type.

Parameters

  status_type | The status type.

Returns
  The ID of the status type.

## ◆ purple_status_type_get_name()

const char * purple_status_type_get_name | ( | const PurpleStatusType * | status_type | ) |

Returns the name of a status type.

Parameters

  status_type | The status type.

Returns
  The name of the status type.

## ◆ purple_status_type_get_primary_attr()

const char * purple_status_type_get_primary_attr | ( | const PurpleStatusType * | type | ) |

Returns a status type's primary attribute ID.

Parameters

  type | The status type.

Returns
  The primary attribute's ID.

Deprecated:
  This function isn't used and should be removed in 3.0.0.

## ◆ purple_status_type_get_primitive()

PurpleStatusPrimitive purple_status_type_get_primitive | ( | const PurpleStatusType * | status_type | ) |

Returns the primitive type of a status type.

Parameters

  status_type | The status type.

Returns
  The primitive type of the status type.

## ◆ purple_status_type_is_available()

gboolean purple_status_type_is_available | ( | const PurpleStatusType * | status_type | ) |

Returns whether or not a status type is available.

Available status types are online and possibly invisible, but not away.

Parameters

  status_type | The status type.

Returns
  TRUE if the status is available, or FALSE otherwise.

## ◆ purple_status_type_is_exclusive()

gboolean purple_status_type_is_exclusive | ( | const PurpleStatusType * | status_type | ) |

Returns whether the status type is exclusive.

Parameters

  status_type | The status type.

Returns
  TRUE if the status type is exclusive, FALSE otherwise.

## ◆ purple_status_type_is_independent()

gboolean purple_status_type_is_independent | ( | const PurpleStatusType * | status_type | ) |

Returns whether or not the status type is independent.

Independent status types are non-exclusive. If other status types on the same hierarchy level are set, this one will not be affected.

Parameters

  status_type | The status type.

Returns
  TRUE if the status type is independent, or FALSE otherwise.

## ◆ purple_status_type_is_saveable()

gboolean purple_status_type_is_saveable | ( | const PurpleStatusType * | status_type | ) |

Returns whether or not the status type is saveable.

Parameters

  status_type | The status type.

Returns
  TRUE if user-defined statuses based off this type are saveable. FALSE otherwise.

## ◆ purple_status_type_is_user_settable()

gboolean purple_status_type_is_user_settable | ( | const PurpleStatusType * | status_type | ) |

Returns whether or not the status type can be set or modified by the user.

Parameters

  status_type | The status type.

Returns
  TRUE if the status type can be set or modified by the user. FALSE if it's a protocol-set setting.

## ◆ purple_status_type_new()

PurpleStatusType * purple_status_type_new | ( | PurpleStatusPrimitive | primitive,
|  | const char * | id,
|  | const char * | name,
|  | gboolean | user_settable
| ) |  |

Creates a new status type with some default values ( saveable and not independent).

Parameters

  primitive | The primitive status type.
  id | The ID of the status type, or `NULL` to use the id of the primitive status type.
  name | The name presented to the user, or `NULL` to use the name of the primitive status type.
  user_settable | TRUE if this is a status the user can manually set.

Returns
  A new status type.

## ◆ purple_status_type_new_full()

PurpleStatusType * purple_status_type_new_full | ( | PurpleStatusPrimitive | primitive,
|  | const char * | id,
|  | const char * | name,
|  | gboolean | saveable,
|  | gboolean | user_settable,
|  | gboolean | independent
| ) |  |

Creates a new status type.

Parameters

  primitive | The primitive status type.
  id | The ID of the status type, or `NULL` to use the id of the primitive status type.
  name | The name presented to the user, or `NULL` to use the name of the primitive status type.
  saveable | TRUE if the information set for this status by the user can be saved for future sessions.
  user_settable | TRUE if this is a status the user can manually set.
  independent | TRUE if this is an independent (non-exclusive) status type.

Returns
  A new status type.

## ◆ purple_status_type_new_with_attrs()

PurpleStatusType * purple_status_type_new_with_attrs | ( | PurpleStatusPrimitive | primitive,
|  | const char * | id,
|  | const char * | name,
|  | gboolean | saveable,
|  | gboolean | user_settable,
|  | gboolean | independent,
|  | const char * | attr_id,
|  | const char * | attr_name,
|  | PurpleValue * | attr_value,
|  |  | ...
| ) |  |

Creates a new status type with attributes.

Parameters

  primitive | The primitive status type.
  id | The ID of the status type, or `NULL` to use the id of the primitive status type.
  name | The name presented to the user, or `NULL` to use the name of the primitive status type.
  saveable | TRUE if the information set for this status by the user can be saved for future sessions.
  user_settable | TRUE if this is a status the user can manually set.
  independent | TRUE if this is an independent (non-exclusive) status type.
  attr_id | The ID of the first attribute.
  attr_name | The name of the first attribute.
  attr_value | The value type of the first attribute attribute.
  ... | Additional attribute information.

Returns
  A new status type.

## ◆ purple_status_type_set_primary_attr()

void purple_status_type_set_primary_attr | ( | PurpleStatusType * | status_type,
|  | const char * | attr_id
| ) |  |

Sets a status type's primary attribute.

The value for the primary attribute is used as the description for the particular status type. An example is an away message. The message would be the primary attribute.

Parameters

  status_type | The status type.
  attr_id | The ID of the primary attribute.

Deprecated:
  This function isn't used and should be removed in 3.0.0.