pidgin 2.14.14dev
Loading...
Searching...
No Matches
status.h
Go to the documentation of this file.
1/*
2 * purple
3 *
4 * Purple is the legal property of its developers, whose names are too numerous
5 * to list here. Please refer to the COPYRIGHT file distributed with this
6 * source distribution.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
21 */
22#ifndef _PURPLE_STATUS_H_
23#define _PURPLE_STATUS_H_
24
85typedef struct _PurpleStatusType PurpleStatusType;
86typedef struct _PurpleStatusAttr PurpleStatusAttr;
87typedef struct _PurplePresence PurplePresence;
88typedef struct _PurpleStatus PurpleStatus;
89
90typedef struct _PurpleMood {
91 const char *mood;
92 const char *description;
93 gpointer *padding;
95
101typedef enum
102{
103 PURPLE_PRESENCE_CONTEXT_UNSET = 0,
104 PURPLE_PRESENCE_CONTEXT_ACCOUNT,
105 PURPLE_PRESENCE_CONTEXT_CONV,
106 PURPLE_PRESENCE_CONTEXT_BUDDY
107
109
113/*
114 * If you add a value to this enum, make sure you update
115 * the status_primitive_map and primitive_scores arrays in status.c.
116 */
117typedef enum
118{
119 PURPLE_STATUS_UNSET = 0,
120 PURPLE_STATUS_OFFLINE,
121 PURPLE_STATUS_AVAILABLE,
122 PURPLE_STATUS_UNAVAILABLE,
123 PURPLE_STATUS_INVISIBLE,
124 PURPLE_STATUS_AWAY,
125 PURPLE_STATUS_EXTENDED_AWAY,
126 PURPLE_STATUS_MOBILE,
127 PURPLE_STATUS_TUNE,
128 PURPLE_STATUS_MOOD,
129 PURPLE_STATUS_NUM_PRIMITIVES
131
132#include "account.h"
133#include "blist.h"
134#include "conversation.h"
135#include "value.h"
136
137#define PURPLE_TUNE_ARTIST "tune_artist"
138#define PURPLE_TUNE_TITLE "tune_title"
139#define PURPLE_TUNE_ALBUM "tune_album"
140#define PURPLE_TUNE_GENRE "tune_genre"
141#define PURPLE_TUNE_COMMENT "tune_comment"
142#define PURPLE_TUNE_TRACK "tune_track"
143#define PURPLE_TUNE_TIME "tune_time"
144#define PURPLE_TUNE_YEAR "tune_year"
145#define PURPLE_TUNE_URL "tune_url"
146#define PURPLE_TUNE_FULL "tune_full"
147
148#define PURPLE_MOOD_NAME "mood"
149#define PURPLE_MOOD_COMMENT "moodtext"
150
151#ifdef __cplusplus
152extern "C" {
153#endif
154
155/**************************************************************************/
157/**************************************************************************/
169
180
190
193/**************************************************************************/
195/**************************************************************************/
215 const char *id, const char *name,
216 gboolean saveable,
217 gboolean user_settable,
218 gboolean independent);
219
234 const char *id, const char *name,
235 gboolean user_settable);
236
258 const char *id,
259 const char *name,
260 gboolean saveable,
261 gboolean user_settable,
262 gboolean independent,
263 const char *attr_id,
264 const char *attr_name,
265 PurpleValue *attr_value, ...) G_GNUC_NULL_TERMINATED;
266
273
274#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
288 const char *attr_id);
289#endif
290
291#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
304void purple_status_type_add_attr(PurpleStatusType *status_type, const char *id,
305 const char *name, PurpleValue *value);
306#endif
307
308#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
322void purple_status_type_add_attrs(PurpleStatusType *status_type, const char *id,
323 const char *name, PurpleValue *value, ...) G_GNUC_NULL_TERMINATED;
324#endif
325
326#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
338 va_list args);
339#endif
340
349 const PurpleStatusType *status_type);
350
358const char *purple_status_type_get_id(const PurpleStatusType *status_type);
359
367const char *purple_status_type_get_name(const PurpleStatusType *status_type);
368
378
389
401
410
421
422#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
433#endif
434
443PurpleStatusAttr *purple_status_type_get_attr(const PurpleStatusType *status_type,
444 const char *id);
445
454
465 const char *id);
466
469/**************************************************************************/
471/**************************************************************************/
483PurpleStatusAttr *purple_status_attr_new(const char *id, const char *name,
484 PurpleValue *value_type);
485
491void purple_status_attr_destroy(PurpleStatusAttr *attr);
492
500const char *purple_status_attr_get_id(const PurpleStatusAttr *attr);
501
509const char *purple_status_attr_get_name(const PurpleStatusAttr *attr);
510
518PurpleValue *purple_status_attr_get_value(const PurpleStatusAttr *attr);
519
522/**************************************************************************/
524/**************************************************************************/
535PurpleStatus *purple_status_new(PurpleStatusType *status_type,
536 PurplePresence *presence);
537
543void purple_status_destroy(PurpleStatus *status);
544
553void purple_status_set_active(PurpleStatus *status, gboolean active);
554
567void purple_status_set_active_with_attrs(PurpleStatus *status, gboolean active,
568 va_list args);
569
582void purple_status_set_active_with_attrs_list(PurpleStatus *status, gboolean active,
583 GList *attrs);
584
585#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
596void purple_status_set_attr_boolean(PurpleStatus *status, const char *id,
597 gboolean value);
598#endif
599
600#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
611void purple_status_set_attr_int(PurpleStatus *status, const char *id,
612 int value);
613#endif
614
615#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
626void purple_status_set_attr_string(PurpleStatus *status, const char *id,
627 const char *value);
628#endif
629
637PurpleStatusType *purple_status_get_type(const PurpleStatus *status);
638
646PurplePresence *purple_status_get_presence(const PurpleStatus *status);
647
658const char *purple_status_get_id(const PurpleStatus *status);
659
670const char *purple_status_get_name(const PurpleStatus *status);
671
682gboolean purple_status_is_independent(const PurpleStatus *status);
683
694gboolean purple_status_is_exclusive(const PurpleStatus *status);
695
708gboolean purple_status_is_available(const PurpleStatus *status);
709
717gboolean purple_status_is_active(const PurpleStatus *status);
718
726gboolean purple_status_is_online(const PurpleStatus *status);
727
736PurpleValue *purple_status_get_attr_value(const PurpleStatus *status,
737 const char *id);
738
747gboolean purple_status_get_attr_boolean(const PurpleStatus *status,
748 const char *id);
749
758int purple_status_get_attr_int(const PurpleStatus *status, const char *id);
759
768const char *purple_status_get_attr_string(const PurpleStatus *status,
769 const char *id);
770
781gint purple_status_compare(const PurpleStatus *status1, const PurpleStatus *status2);
782
785/**************************************************************************/
787/**************************************************************************/
798
807
816
825
834void purple_presence_destroy(PurplePresence *presence);
835
836#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
846void purple_presence_add_status(PurplePresence *presence, PurpleStatus *status);
847#endif
848
849#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
859void purple_presence_add_list(PurplePresence *presence, GList *source_list);
860#endif
861
873void purple_presence_set_status_active(PurplePresence *presence,
874 const char *status_id, gboolean active);
875
885void purple_presence_switch_status(PurplePresence *presence,
886 const char *status_id);
887
898void purple_presence_set_idle(PurplePresence *presence, gboolean idle,
899 time_t idle_time);
900
907void purple_presence_set_login_time(PurplePresence *presence, time_t login_time);
908
909
918
926PurpleAccount *purple_presence_get_account(const PurplePresence *presence);
927
936
944const char *purple_presence_get_chat_user(const PurplePresence *presence);
945
953PurpleBuddy *purple_presence_get_buddy(const PurplePresence *presence);
954
962GList *purple_presence_get_statuses(const PurplePresence *presence);
963
972PurpleStatus *purple_presence_get_status(const PurplePresence *presence,
973 const char *status_id);
974
982PurpleStatus *purple_presence_get_active_status(const PurplePresence *presence);
983
993gboolean purple_presence_is_available(const PurplePresence *presence);
994
1002gboolean purple_presence_is_online(const PurplePresence *presence);
1003
1014gboolean purple_presence_is_status_active(const PurplePresence *presence,
1015 const char *status_id);
1016
1029 const PurplePresence *presence, PurpleStatusPrimitive primitive);
1030
1040gboolean purple_presence_is_idle(const PurplePresence *presence);
1041
1049time_t purple_presence_get_idle_time(const PurplePresence *presence);
1050
1058time_t purple_presence_get_login_time(const PurplePresence *presence);
1059
1070gint purple_presence_compare(const PurplePresence *presence1,
1071 const PurplePresence *presence2);
1072
1075/**************************************************************************/
1077/**************************************************************************/
1086
1091
1096
1099#ifdef __cplusplus
1100}
1101#endif
1102
1103#endif /* _PURPLE_STATUS_H_ */
Account API.
Buddy List API.
Conversation API.
void purple_status_destroy(PurpleStatus *status)
Destroys a status.
PurplePresence * purple_presence_new_for_conv(PurpleConversation *conv)
Creates a presence for a conversation.
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 PurpleStatusType * purple_status_type_find_with_id(GList *status_types, const char *id)
Find the PurpleStatusType with the given id.
gboolean purple_status_is_independent(const PurpleStatus *status)
Returns whether or not a status is independent.
PurplePresence * purple_presence_new_for_account(PurpleAccount *account)
Creates a presence for an account.
const char * purple_primitive_get_name_from_type(PurpleStatusPrimitive type)
Lookup the name of a primitive status type based on the type.
PurpleAccount * purple_presence_get_account(const PurplePresence *presence)
Returns a presence's account.
gboolean purple_status_is_active(const PurpleStatus *status)
Returns the active state of a status.
const char * purple_status_type_get_name(const PurpleStatusType *status_type)
Returns the name of a status type.
PurplePresenceContext
A context for a presence.
Definition status.h:102
void purple_status_type_add_attrs_vargs(PurpleStatusType *status_type, va_list args)
Adds multiple attributes to a status type using a va_list.
PurpleValue * purple_status_attr_get_value(const PurpleStatusAttr *attr)
Returns the value of a status attribute.
const char * purple_status_get_name(const PurpleStatus *status)
Returns the status's name.
gboolean purple_presence_is_idle(const PurplePresence *presence)
Returns whether or not a presence is idle.
PurpleStatusPrimitive purple_primitive_get_type_from_id(const char *id)
Lookup the value of a primitive status type based on the id.
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_is_online(const PurpleStatus *status)
Returns whether or not a status is considered 'online'.
struct _PurpleStatusType PurpleStatusType
PurpleStatusType's are created by each PRPL.
Definition status.h:85
const char * purple_status_attr_get_name(const PurpleStatusAttr *attr)
Returns the name of a status attribute.
void purple_status_type_set_primary_attr(PurpleStatusType *status_type, const char *attr_id)
Sets a status type's primary attribute.
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_presence_is_online(const PurplePresence *presence)
Returns whether or not a presence is online.
void purple_presence_set_idle(PurplePresence *presence, gboolean idle, time_t idle_time)
Sets the idle state and time on a presence.
void purple_status_init(void)
Initializes the status subsystem.
PurpleStatus * purple_presence_get_active_status(const PurplePresence *presence)
Returns the active exclusive status from a presence.
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.
const char * purple_status_attr_get_id(const PurpleStatusAttr *attr)
Returns the ID of a status attribute.
void purple_status_uninit(void)
Uninitializes the status subsystem.
void purple_presence_add_status(PurplePresence *presence, PurpleStatus *status)
Adds a status to a presence.
void purple_status_type_add_attr(PurpleStatusType *status_type, const char *id, const char *name, PurpleValue *value)
Adds an attribute to a status type.
PurpleBuddy * purple_presence_get_buddy(const PurplePresence *presence)
Returns the presence's buddy.
GList * purple_status_type_get_attrs(const PurpleStatusType *status_type)
Returns a list of all attributes in a status type.
const char * purple_primitive_get_id_from_type(PurpleStatusPrimitive type)
Lookup the id of a primitive status type based on the type.
void purple_presence_switch_status(PurplePresence *presence, const char *status_id)
Switches the active status in a presence.
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.
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_status_type_is_independent(const PurpleStatusType *status_type)
Returns whether or not the status type is independent.
GList * purple_presence_get_statuses(const PurplePresence *presence)
Returns all the statuses in a presence.
void purple_status_set_active(PurpleStatus *status, gboolean active)
Sets whether or not a status is active.
const char * purple_presence_get_chat_user(const PurplePresence *presence)
Returns a presence's chat user.
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.
void purple_presence_destroy(PurplePresence *presence)
Destroys a presence.
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.
PurplePresenceContext purple_presence_get_context(const PurplePresence *presence)
Returns the presence's context.
gboolean purple_status_type_is_saveable(const PurpleStatusType *status_type)
Returns whether or not the status type is saveable.
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.
PurplePresence * purple_presence_new_for_buddy(PurpleBuddy *buddy)
Creates a presence for a buddy.
gboolean purple_status_type_is_available(const PurpleStatusType *status_type)
Returns whether or not a status type is available.
void purple_status_type_destroy(PurpleStatusType *status_type)
Destroys a status type.
void purple_presence_add_list(PurplePresence *presence, GList *source_list)
Adds a list of statuses to the presence.
PurpleStatusPrimitive
A primitive defining the basic structure of a status type.
Definition status.h:118
const char * purple_status_type_get_primary_attr(const PurpleStatusType *type)
Returns a status type's primary attribute ID.
PurpleStatusPrimitive purple_status_type_get_primitive(const PurpleStatusType *status_type)
Returns the primitive type of a status type.
PurpleStatusAttr * purple_status_attr_new(const char *id, const char *name, PurpleValue *value_type)
Creates a new status attribute.
gboolean purple_status_is_exclusive(const PurpleStatus *status)
Returns whether or not a status is exclusive.
const char * purple_status_type_get_id(const PurpleStatusType *status_type)
Returns the ID of a status type.
gboolean purple_presence_is_available(const PurplePresence *presence)
Returns whether or not a presence is available.
gint purple_status_compare(const PurpleStatus *status1, const PurpleStatus *status2)
Compares two statuses for availability.
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.
gboolean purple_status_type_is_exclusive(const PurpleStatusType *status_type)
Returns whether the status type is exclusive.
const char * purple_status_get_id(const PurpleStatus *status)
Returns the status's type ID.
void * purple_status_get_handle(void)
Get the handle for the status subsystem.
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.
PurpleStatusType * purple_status_get_type(const PurpleStatus *status)
Returns the status's type.
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.
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_status_attr_destroy(PurpleStatusAttr *attr)
Destroys a status attribute.
PurpleStatusAttr * purple_status_type_get_attr(const PurpleStatusType *status_type, const char *id)
Returns the attribute with the specified ID.
gboolean purple_status_is_available(const PurpleStatus *status)
Returns whether or not a status is available.
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.
PurplePresence * purple_presence_new(PurplePresenceContext context)
Creates a new presence.
void purple_presence_set_login_time(PurplePresence *presence, time_t login_time)
Sets the login time on a presence.
time_t purple_presence_get_idle_time(const PurplePresence *presence)
Returns the presence's idle time.
PurpleConversation * purple_presence_get_conversation(const PurplePresence *presence)
Returns a presence's conversation.
PurplePresence * purple_status_get_presence(const PurpleStatus *status)
Returns the status's presence.
PurpleStatus * purple_presence_get_status(const PurplePresence *presence, const char *status_id)
Returns the status with the specified ID from a presence.
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.
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.
PurpleStatus * purple_status_new(PurpleStatusType *status_type, PurplePresence *presence)
Creates a new status.
A wrapper for a type, subtype, and specific type of value.
Definition value.h:90
Structure representing an account.
Definition account.h:170
A buddy.
Definition blist.h:140
A core representation of a conversation between two or more people.
Value wrapper API.