Loading...
Searching...
No Matches
status.h
Go to the documentation of this file.
/*
* purple
*
* Purple is the legal property of its developers, whose names are too numerous
* to list here. Please refer to the COPYRIGHT file distributed with this
* source distribution.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
#ifndef _PURPLE_STATUS_H_
#define _PURPLE_STATUS_H_
typedef struct _PurpleStatusType PurpleStatusType;
typedef struct _PurpleStatusAttr PurpleStatusAttr;
typedef struct _PurplePresence PurplePresence;
typedef struct _PurpleStatus PurpleStatus;
typedef struct _PurpleMood {
const char *mood;
const char *description;
gpointer *padding;
} PurpleMood;
typedef enum
{
PURPLE_PRESENCE_CONTEXT_UNSET = 0,
PURPLE_PRESENCE_CONTEXT_ACCOUNT,
PURPLE_PRESENCE_CONTEXT_CONV,
PURPLE_PRESENCE_CONTEXT_BUDDY
} PurplePresenceContext;
/*
* If you add a value to this enum, make sure you update
* the status_primitive_map and primitive_scores arrays in status.c.
*/
typedef enum
{
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
} PurpleStatusPrimitive;
#include "account.h"
#include "blist.h"
#include "conversation.h"
#include "value.h"
#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"
#ifdef __cplusplus
extern "C" {
#endif
/**************************************************************************/
/**************************************************************************/
const char *purple_primitive_get_id_from_type(PurpleStatusPrimitive type);
const char *purple_primitive_get_name_from_type(PurpleStatusPrimitive type);
PurpleStatusPrimitive purple_primitive_get_type_from_id(const char *id);
/**************************************************************************/
/**************************************************************************/
PurpleStatusType *purple_status_type_new_full(PurpleStatusPrimitive primitive,
const char *id, const char *name,
gboolean saveable,
gboolean user_settable,
gboolean independent);
PurpleStatusType *purple_status_type_new(PurpleStatusPrimitive primitive,
const char *id, const char *name,
gboolean user_settable);
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;
void purple_status_type_destroy(PurpleStatusType *status_type);
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
void purple_status_type_set_primary_attr(PurpleStatusType *status_type,
const char *attr_id);
#endif
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
void purple_status_type_add_attr(PurpleStatusType *status_type, const char *id,
const char *name, PurpleValue *value);
#endif
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
void purple_status_type_add_attrs(PurpleStatusType *status_type, const char *id,
const char *name, PurpleValue *value, ...) G_GNUC_NULL_TERMINATED;
#endif
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
void purple_status_type_add_attrs_vargs(PurpleStatusType *status_type,
va_list args);
#endif
PurpleStatusPrimitive purple_status_type_get_primitive(
const PurpleStatusType *status_type);
const char *purple_status_type_get_id(const PurpleStatusType *status_type);
const char *purple_status_type_get_name(const PurpleStatusType *status_type);
gboolean purple_status_type_is_saveable(const PurpleStatusType *status_type);
gboolean purple_status_type_is_user_settable(const PurpleStatusType *status_type);
gboolean purple_status_type_is_independent(const PurpleStatusType *status_type);
gboolean purple_status_type_is_exclusive(const PurpleStatusType *status_type);
gboolean purple_status_type_is_available(const PurpleStatusType *status_type);
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
const char *purple_status_type_get_primary_attr(const PurpleStatusType *type);
#endif
PurpleStatusAttr *purple_status_type_get_attr(const PurpleStatusType *status_type,
const char *id);
GList *purple_status_type_get_attrs(const PurpleStatusType *status_type);
const PurpleStatusType *purple_status_type_find_with_id(GList *status_types,
const char *id);
/**************************************************************************/
/**************************************************************************/
PurpleStatusAttr *purple_status_attr_new(const char *id, const char *name,
PurpleValue *value_type);
void purple_status_attr_destroy(PurpleStatusAttr *attr);
const char *purple_status_attr_get_id(const PurpleStatusAttr *attr);
const char *purple_status_attr_get_name(const PurpleStatusAttr *attr);
PurpleValue *purple_status_attr_get_value(const PurpleStatusAttr *attr);
/**************************************************************************/
/**************************************************************************/
PurpleStatus *purple_status_new(PurpleStatusType *status_type,
PurplePresence *presence);
void purple_status_destroy(PurpleStatus *status);
void purple_status_set_active(PurpleStatus *status, gboolean active);
void purple_status_set_active_with_attrs(PurpleStatus *status, gboolean active,
va_list args);
void purple_status_set_active_with_attrs_list(PurpleStatus *status, gboolean active,
GList *attrs);
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
void purple_status_set_attr_boolean(PurpleStatus *status, const char *id,
gboolean value);
#endif
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
void purple_status_set_attr_int(PurpleStatus *status, const char *id,
int value);
#endif
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
void purple_status_set_attr_string(PurpleStatus *status, const char *id,
const char *value);
#endif
PurpleStatusType *purple_status_get_type(const PurpleStatus *status);
PurplePresence *purple_status_get_presence(const PurpleStatus *status);
const char *purple_status_get_id(const PurpleStatus *status);
const char *purple_status_get_name(const PurpleStatus *status);
gboolean purple_status_is_independent(const PurpleStatus *status);
gboolean purple_status_is_exclusive(const PurpleStatus *status);
gboolean purple_status_is_available(const PurpleStatus *status);
gboolean purple_status_is_active(const PurpleStatus *status);
gboolean purple_status_is_online(const PurpleStatus *status);
PurpleValue *purple_status_get_attr_value(const PurpleStatus *status,
const char *id);
gboolean purple_status_get_attr_boolean(const PurpleStatus *status,
const char *id);
int purple_status_get_attr_int(const PurpleStatus *status, const char *id);
const char *purple_status_get_attr_string(const PurpleStatus *status,
const char *id);
gint purple_status_compare(const PurpleStatus *status1, const PurpleStatus *status2);
/**************************************************************************/
/**************************************************************************/
PurplePresence *purple_presence_new(PurplePresenceContext context);
PurplePresence *purple_presence_new_for_account(PurpleAccount *account);
PurplePresence *purple_presence_new_for_conv(PurpleConversation *conv);
PurplePresence *purple_presence_new_for_buddy(PurpleBuddy *buddy);
void purple_presence_destroy(PurplePresence *presence);
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
void purple_presence_add_status(PurplePresence *presence, PurpleStatus *status);
#endif
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
void purple_presence_add_list(PurplePresence *presence, GList *source_list);
#endif
void purple_presence_set_status_active(PurplePresence *presence,
const char *status_id, gboolean active);
void purple_presence_switch_status(PurplePresence *presence,
const char *status_id);
void purple_presence_set_idle(PurplePresence *presence, gboolean idle,
time_t idle_time);
void purple_presence_set_login_time(PurplePresence *presence, time_t login_time);
PurplePresenceContext purple_presence_get_context(const PurplePresence *presence);
PurpleAccount *purple_presence_get_account(const PurplePresence *presence);
PurpleConversation *purple_presence_get_conversation(const PurplePresence *presence);
const char *purple_presence_get_chat_user(const PurplePresence *presence);
PurpleBuddy *purple_presence_get_buddy(const PurplePresence *presence);
GList *purple_presence_get_statuses(const PurplePresence *presence);
PurpleStatus *purple_presence_get_status(const PurplePresence *presence,
const char *status_id);
PurpleStatus *purple_presence_get_active_status(const PurplePresence *presence);
gboolean purple_presence_is_available(const PurplePresence *presence);
gboolean purple_presence_is_online(const PurplePresence *presence);
gboolean purple_presence_is_status_active(const PurplePresence *presence,
const char *status_id);
gboolean purple_presence_is_status_primitive_active(
const PurplePresence *presence, PurpleStatusPrimitive primitive);
gboolean purple_presence_is_idle(const PurplePresence *presence);
time_t purple_presence_get_idle_time(const PurplePresence *presence);
time_t purple_presence_get_login_time(const PurplePresence *presence);
gint purple_presence_compare(const PurplePresence *presence1,
const PurplePresence *presence2);
/**************************************************************************/
/**************************************************************************/
void *purple_status_get_handle(void);
void purple_status_init(void);
void purple_status_uninit(void);
#ifdef __cplusplus
}
#endif
#endif /* _PURPLE_STATUS_H_ */
account.h
Account API.
PurpleAccount
struct _PurpleAccount PurpleAccount
Structure representing an account.
Definition account.h:38
blist.h
Buddy List API.
PurpleBuddy
struct _PurpleBuddy PurpleBuddy
A buddy.
Definition blist.h:48
conversation.h
Conversation API.
PurpleConversation
struct _PurpleConversation PurpleConversation
A core representation of a conversation between two or more people.
Definition conversation.h:38
purple_status_destroy
void purple_status_destroy(PurpleStatus *status)
Destroys a status.
purple_presence_new_for_conv
PurplePresence * purple_presence_new_for_conv(PurpleConversation *conv)
Creates a presence for a conversation.
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.
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.
purple_status_is_independent
gboolean purple_status_is_independent(const PurpleStatus *status)
Returns whether or not a status is independent.
purple_presence_new_for_account
PurplePresence * purple_presence_new_for_account(PurpleAccount *account)
Creates a presence for an account.
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.
purple_presence_get_account
PurpleAccount * purple_presence_get_account(const PurplePresence *presence)
Returns a presence's account.
purple_status_is_active
gboolean purple_status_is_active(const PurpleStatus *status)
Returns the active state of a status.
purple_status_type_get_name
const char * purple_status_type_get_name(const PurpleStatusType *status_type)
Returns the name of a status type.
PurplePresenceContext
PurplePresenceContext
A context for a presence.
Definition status.h:102
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.
purple_status_attr_get_value
PurpleValue * purple_status_attr_get_value(const PurpleStatusAttr *attr)
Returns the value of a status attribute.
purple_status_get_name
const char * purple_status_get_name(const PurpleStatus *status)
Returns the status's name.
purple_presence_is_idle
gboolean purple_presence_is_idle(const PurplePresence *presence)
Returns whether or not a presence is idle.
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.
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.
purple_status_is_online
gboolean purple_status_is_online(const PurpleStatus *status)
Returns whether or not a status is considered 'online'.
PurpleStatusType
struct _PurpleStatusType PurpleStatusType
PurpleStatusType's are created by each PRPL.
Definition status.h:85
purple_status_attr_get_name
const char * purple_status_attr_get_name(const PurpleStatusAttr *attr)
Returns the name of a status attribute.
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.
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.
purple_presence_is_online
gboolean purple_presence_is_online(const PurplePresence *presence)
Returns whether or not a presence is online.
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.
purple_status_init
void purple_status_init(void)
Initializes the status subsystem.
purple_presence_get_active_status
PurpleStatus * purple_presence_get_active_status(const PurplePresence *presence)
Returns the active exclusive status from a presence.
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.
purple_status_attr_get_id
const char * purple_status_attr_get_id(const PurpleStatusAttr *attr)
Returns the ID of a status attribute.
purple_status_uninit
void purple_status_uninit(void)
Uninitializes the status subsystem.
purple_presence_add_status
void purple_presence_add_status(PurplePresence *presence, PurpleStatus *status)
Adds a status to a presence.
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.
purple_presence_get_buddy
PurpleBuddy * purple_presence_get_buddy(const PurplePresence *presence)
Returns the presence's buddy.
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.
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.
purple_presence_switch_status
void purple_presence_switch_status(PurplePresence *presence, const char *status_id)
Switches the active status in a presence.
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.
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.
purple_status_type_is_independent
gboolean purple_status_type_is_independent(const PurpleStatusType *status_type)
Returns whether or not the status type is independent.
purple_presence_get_statuses
GList * purple_presence_get_statuses(const PurplePresence *presence)
Returns all the statuses in a presence.
purple_status_set_active
void purple_status_set_active(PurpleStatus *status, gboolean active)
Sets whether or not a status is active.
purple_presence_get_chat_user
const char * purple_presence_get_chat_user(const PurplePresence *presence)
Returns a presence's chat user.
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.
purple_presence_destroy
void purple_presence_destroy(PurplePresence *presence)
Destroys a presence.
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.
purple_presence_get_context
PurplePresenceContext purple_presence_get_context(const PurplePresence *presence)
Returns the presence's context.
purple_status_type_is_saveable
gboolean purple_status_type_is_saveable(const PurpleStatusType *status_type)
Returns whether or not the status type is saveable.
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).
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,...) G_GNUC_NULL_TERMINATED
Creates a new status type with attributes.
purple_presence_new_for_buddy
PurplePresence * purple_presence_new_for_buddy(PurpleBuddy *buddy)
Creates a presence for a buddy.
purple_status_type_is_available
gboolean purple_status_type_is_available(const PurpleStatusType *status_type)
Returns whether or not a status type is available.
purple_status_type_destroy
void purple_status_type_destroy(PurpleStatusType *status_type)
Destroys a status type.
purple_presence_add_list
void purple_presence_add_list(PurplePresence *presence, GList *source_list)
Adds a list of statuses to the presence.
PurpleStatusPrimitive
PurpleStatusPrimitive
A primitive defining the basic structure of a status type.
Definition status.h:118
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.
purple_status_type_get_primitive
PurpleStatusPrimitive purple_status_type_get_primitive(const PurpleStatusType *status_type)
Returns the primitive type of a status type.
purple_status_attr_new
PurpleStatusAttr * purple_status_attr_new(const char *id, const char *name, PurpleValue *value_type)
Creates a new status attribute.
purple_status_is_exclusive
gboolean purple_status_is_exclusive(const PurpleStatus *status)
Returns whether or not a status is exclusive.
purple_status_type_get_id
const char * purple_status_type_get_id(const PurpleStatusType *status_type)
Returns the ID of a status type.
purple_presence_is_available
gboolean purple_presence_is_available(const PurplePresence *presence)
Returns whether or not a presence is available.
purple_status_compare
gint purple_status_compare(const PurpleStatus *status1, const PurpleStatus *status2)
Compares two statuses for availability.
purple_status_type_add_attrs
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.
purple_status_type_is_exclusive
gboolean purple_status_type_is_exclusive(const PurpleStatusType *status_type)
Returns whether the status type is exclusive.
purple_status_get_id
const char * purple_status_get_id(const PurpleStatus *status)
Returns the status's type ID.
purple_status_get_handle
void * purple_status_get_handle(void)
Get the handle for the status subsystem.
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.
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.
purple_status_get_type
PurpleStatusType * purple_status_get_type(const PurpleStatus *status)
Returns the status's type.
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.
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.
purple_status_attr_destroy
void purple_status_attr_destroy(PurpleStatusAttr *attr)
Destroys a status attribute.
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.
purple_status_is_available
gboolean purple_status_is_available(const PurpleStatus *status)
Returns whether or not a status is available.
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.
purple_presence_new
PurplePresence * purple_presence_new(PurplePresenceContext context)
Creates a new presence.
purple_presence_set_login_time
void purple_presence_set_login_time(PurplePresence *presence, time_t login_time)
Sets the login time on a presence.
purple_presence_get_idle_time
time_t purple_presence_get_idle_time(const PurplePresence *presence)
Returns the presence's idle time.
purple_presence_get_conversation
PurpleConversation * purple_presence_get_conversation(const PurplePresence *presence)
Returns a presence's conversation.
purple_status_get_presence
PurplePresence * purple_status_get_presence(const PurpleStatus *status)
Returns the status's presence.
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.
purple_presence_get_login_time
time_t purple_presence_get_login_time(const PurplePresence *presence)
Returns the presence's login time.
purple_presence_compare
gint purple_presence_compare(const PurplePresence *presence1, const PurplePresence *presence2)
Compares two presences for availability.
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.
purple_status_new
PurpleStatus * purple_status_new(PurpleStatusType *status_type, PurplePresence *presence)
Creates a new status.
PurpleValue
A wrapper for a type, subtype, and specific type of value.
Definition value.h:90
_PurpleMood
Definition status.h:90
value.h
Value wrapper API.