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
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.
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.
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
22 #ifndef _PURPLE_STATUS_H_
23 #define _PURPLE_STATUS_H_
26 * @file status.h Status API
29 * A brief explanation of the status API:
31 * PurpleStatusType's are created by each PRPL. They outline the
32 * available statuses of the protocol. AIM, for example, supports
33 * an available state with an optional available message, an away
34 * state with a mandatory message, and an invisible state (which is
35 * technically "independent" of the other two, but we'll get into
36 * that later). PurpleStatusTypes are very permanent. They are
37 * hardcoded in each PRPL and will not change often. And because
38 * they are hardcoded, they do not need to be saved to any XML file.
40 * A PurpleStatus can be thought of as an "instance" of a PurpleStatusType.
41 * If you're familiar with object-oriented programming languages
42 * then this should be immediately clear. Say, for example, that
43 * one of your AIM buddies has set himself as "away." You have a
44 * PurpleBuddy node for this person in your buddy list. Purple wants
45 * to mark this buddy as "away," so it creates a new PurpleStatus.
46 * The PurpleStatus has its PurpleStatusType set to the "away" state
47 * for the oscar PRPL. The PurpleStatus also contains the buddy's
48 * away message. PurpleStatuses are sometimes saved, depending on
49 * the context. The current PurpleStatuses associated with each of
50 * your accounts are saved so that the next time you start Purple,
51 * your accounts will be set to their last known statuses. There
52 * is also a list of saved statuses that are written to the
53 * status.xml file. Also, each PurpleStatus has a "saveable" boolean.
54 * If "saveable" is set to FALSE then the status is NEVER saved.
55 * All PurpleStatuses should be inside a PurplePresence.
58 * A PurpleStatus is either "independent" or "exclusive."
59 * Independent statuses can be active or inactive and they don't
60 * affect anything else. However, you can only have one exclusive
61 * status per PurplePresence. If you activate one exclusive status,
62 * then the previous exclusive status is automatically deactivated.
64 * A PurplePresence is like a collection of PurpleStatuses (plus some
65 * other random info). For any buddy, or for any one of your accounts,
66 * or for any person with which you're chatting, you may know various
67 * amounts of information. This information is all contained in
68 * one PurplePresence. If one of your buddies is away and idle,
69 * then the presence contains the PurpleStatus for their awayness,
70 * and it contains their current idle time. PurplePresences are
71 * never saved to disk. The information they contain is only relevant
72 * for the current PurpleSession.
75 typedef struct _PurpleStatusType PurpleStatusType;
76 typedef struct _PurpleStatusAttr PurpleStatusAttr;
77 typedef struct _PurplePresence PurplePresence;
78 typedef struct _PurpleStatus PurpleStatus;
81 * A context for a presence.
83 * The context indicates to what the presence applies.
87 PURPLE_PRESENCE_CONTEXT_UNSET = 0,
88 PURPLE_PRESENCE_CONTEXT_ACCOUNT,
89 PURPLE_PRESENCE_CONTEXT_CONV,
90 PURPLE_PRESENCE_CONTEXT_BUDDY
92 } PurplePresenceContext;
95 * A primitive defining the basic structure of a status type.
98 * If you add a value to this enum, make sure you update
99 * the status_primitive_map array in status.c and the special-cases for idle
100 * and offline-messagable just below it.
104 PURPLE_STATUS_UNSET = 0,
105 PURPLE_STATUS_OFFLINE,
106 PURPLE_STATUS_AVAILABLE,
107 PURPLE_STATUS_UNAVAILABLE,
108 PURPLE_STATUS_INVISIBLE,
110 PURPLE_STATUS_EXTENDED_AWAY,
111 PURPLE_STATUS_MOBILE,
113 PURPLE_STATUS_NUM_PRIMITIVES
114 } PurpleStatusPrimitive;
118 #include "conversation.h"
121 #define PURPLE_TUNE_ARTIST "tune_artist"
122 #define PURPLE_TUNE_TITLE "tune_title"
123 #define PURPLE_TUNE_ALBUM "tune_album"
124 #define PURPLE_TUNE_GENRE "tune_genre"
125 #define PURPLE_TUNE_COMMENT "tune_comment"
126 #define PURPLE_TUNE_TRACK "tune_track"
127 #define PURPLE_TUNE_TIME "tune_time"
128 #define PURPLE_TUNE_YEAR "tune_year"
129 #define PURPLE_TUNE_URL "tune_url"
130 #define PURPLE_TUNE_FULL "tune_full"
136 /**************************************************************************/
137 /** @name PurpleStatusPrimitive API */
138 /**************************************************************************/
142 * Lookup the id of a primitive status type based on the type. This
143 * ID is a unique plain-text name of the status, without spaces.
145 * @param type A primitive status type.
147 * @return The unique ID for this type.
149 const char *purple_primitive_get_id_from_type(PurpleStatusPrimitive type);
152 * Lookup the name of a primitive status type based on the type. This
153 * name is the plain-English name of the status type. It is usually one
156 * @param type A primitive status type.
158 * @return The name of this type, suitable for users to see.
160 const char *purple_primitive_get_name_from_type(PurpleStatusPrimitive type);
163 * Lookup the value of a primitive status type based on the id. The
164 * ID is a unique plain-text name of the status, without spaces.
166 * @param id The unique ID of a primitive status type.
168 * @return The PurpleStatusPrimitive value.
170 PurpleStatusPrimitive purple_primitive_get_type_from_id(const char *id);
174 /**************************************************************************/
175 /** @name PurpleStatusType API */
176 /**************************************************************************/
180 * Creates a new status type.
182 * @param primitive The primitive status type.
183 * @param id The ID of the status type, or @c NULL to use the id of
184 * the primitive status type.
185 * @param name The name presented to the user, or @c NULL to use the
186 * name of the primitive status type.
187 * @param saveable TRUE if the information set for this status by the
188 * user can be saved for future sessions.
189 * @param user_settable TRUE if this is a status the user can manually set.
190 * @param independent TRUE if this is an independent (non-exclusive)
193 * @return A new status type.
195 PurpleStatusType *purple_status_type_new_full(PurpleStatusPrimitive primitive,
196 const char *id, const char *name,
198 gboolean user_settable,
199 gboolean independent);
202 * Creates a new status type with some default values (
203 * saveable and not independent).
205 * @param primitive The primitive status type.
206 * @param id The ID of the status type, or @c NULL to use the id of
207 * the primitive status type.
208 * @param name The name presented to the user, or @c NULL to use the
209 * name of the primitive status type.
210 * @param user_settable TRUE if this is a status the user can manually set.
212 * @return A new status type.
214 PurpleStatusType *purple_status_type_new(PurpleStatusPrimitive primitive,
215 const char *id, const char *name,
216 gboolean user_settable);
219 * Creates a new status type with attributes.
221 * @param primitive The primitive status type.
222 * @param id The ID of the status type, or @c NULL to use the id of
223 * the primitive status type.
224 * @param name The name presented to the user, or @c NULL to use the
225 * name of the primitive status type.
226 * @param saveable TRUE if the information set for this status by the
227 * user can be saved for future sessions.
228 * @param user_settable TRUE if this is a status the user can manually set.
229 * @param independent TRUE if this is an independent (non-exclusive)
231 * @param attr_id The ID of the first attribute.
232 * @param attr_name The name of the first attribute.
233 * @param attr_value The value type of the first attribute attribute.
234 * @param ... Additional attribute information.
236 * @return A new status type.
238 PurpleStatusType *purple_status_type_new_with_attrs(PurpleStatusPrimitive primitive,
242 gboolean user_settable,
243 gboolean independent,
245 const char *attr_name,
246 PurpleValue *attr_value, ...) G_GNUC_NULL_TERMINATED;
249 * Destroys a status type.
251 * @param status_type The status type to destroy.
253 void purple_status_type_destroy(PurpleStatusType *status_type);
255 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
257 * Sets a status type's primary attribute.
259 * The value for the primary attribute is used as the description for
260 * the particular status type. An example is an away message. The message
261 * would be the primary attribute.
263 * @param status_type The status type.
264 * @param attr_id The ID of the primary attribute.
266 * @deprecated This function isn't used and should be removed in 3.0.0.
268 void purple_status_type_set_primary_attr(PurpleStatusType *status_type,
269 const char *attr_id);
272 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
274 * Adds an attribute to a status type.
276 * @param status_type The status type to add the attribute to.
277 * @param id The ID of the attribute.
278 * @param name The name presented to the user.
279 * @param value The value type of this attribute.
281 * @deprecated This function isn't needed and should be removed in 3.0.0.
282 * Status type attributes should be set when the status type
283 * is created, in the call to purple_status_type_new_with_attrs.
285 void purple_status_type_add_attr(PurpleStatusType *status_type, const char *id,
286 const char *name, PurpleValue *value);
289 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
291 * Adds multiple attributes to a status type.
293 * @param status_type The status type to add the attribute to.
294 * @param id The ID of the first attribute.
295 * @param name The description of the first attribute.
296 * @param value The value type of the first attribute attribute.
297 * @param ... Additional attribute information.
299 * @deprecated This function isn't needed and should be removed in 3.0.0.
300 * Status type attributes should be set when the status type
301 * is created, in the call to purple_status_type_new_with_attrs.
303 void purple_status_type_add_attrs(PurpleStatusType *status_type, const char *id,
304 const char *name, PurpleValue *value, ...) G_GNUC_NULL_TERMINATED;
307 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
309 * Adds multiple attributes to a status type using a va_list.
311 * @param status_type The status type to add the attribute to.
312 * @param args The va_list of attributes.
314 * @deprecated This function isn't needed and should be removed in 3.0.0.
315 * Status type attributes should be set when the status type
316 * is created, in the call to purple_status_type_new_with_attrs.
318 void purple_status_type_add_attrs_vargs(PurpleStatusType *status_type,
323 * Returns the primitive type of a status type.
325 * @param status_type The status type.
327 * @return The primitive type of the status type.
329 PurpleStatusPrimitive purple_status_type_get_primitive(
330 const PurpleStatusType *status_type);
333 * Returns the ID of a status type.
335 * @param status_type The status type.
337 * @return The ID of the status type.
339 const char *purple_status_type_get_id(const PurpleStatusType *status_type);
342 * Returns the name of a status type.
344 * @param status_type The status type.
346 * @return The name of the status type.
348 const char *purple_status_type_get_name(const PurpleStatusType *status_type);
351 * Returns whether or not the status type is saveable.
353 * @param status_type The status type.
355 * @return TRUE if user-defined statuses based off this type are saveable.
358 gboolean purple_status_type_is_saveable(const PurpleStatusType *status_type);
361 * Returns whether or not the status type can be set or modified by the
364 * @param status_type The status type.
366 * @return TRUE if the status type can be set or modified by the user.
367 * FALSE if it's a protocol-set setting.
369 gboolean purple_status_type_is_user_settable(const PurpleStatusType *status_type);
372 * Returns whether or not the status type is independent.
374 * Independent status types are non-exclusive. If other status types on
375 * the same hierarchy level are set, this one will not be affected.
377 * @param status_type The status type.
379 * @return TRUE if the status type is independent, or FALSE otherwise.
381 gboolean purple_status_type_is_independent(const PurpleStatusType *status_type);
384 * Returns whether the status type is exclusive.
386 * @param status_type The status type.
388 * @return TRUE if the status type is exclusive, FALSE otherwise.
390 gboolean purple_status_type_is_exclusive(const PurpleStatusType *status_type);
393 * Returns whether or not a status type is available.
395 * Available status types are online and possibly invisible, but not away.
397 * @param status_type The status type.
399 * @return TRUE if the status is available, or FALSE otherwise.
401 gboolean purple_status_type_is_available(const PurpleStatusType *status_type);
403 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
405 * Returns a status type's primary attribute ID.
407 * @param type The status type.
409 * @return The primary attribute's ID.
411 * @deprecated This function isn't used and should be removed in 3.0.0.
413 const char *purple_status_type_get_primary_attr(const PurpleStatusType *type);
417 * Returns the attribute with the specified ID.
419 * @param status_type The status type containing the attribute.
420 * @param id The ID of the desired attribute.
422 * @return The attribute, if found. NULL otherwise.
424 PurpleStatusAttr *purple_status_type_get_attr(const PurpleStatusType *status_type,
428 * Returns a list of all attributes in a status type.
430 * @param status_type The status type.
432 * @constreturn The list of attributes.
434 GList *purple_status_type_get_attrs(const PurpleStatusType *status_type);
437 * Find the PurpleStatusType with the given id.
439 * @param status_types A list of status types. Often account->status_types.
440 * @param id The unique ID of the status type you wish to find.
442 * @return The status type with the given ID, or NULL if one could
445 const PurpleStatusType *purple_status_type_find_with_id(GList *status_types,
450 /**************************************************************************/
451 /** @name PurpleStatusAttr API */
452 /**************************************************************************/
456 * Creates a new status attribute.
458 * @param id The ID of the attribute.
459 * @param name The name presented to the user.
460 * @param value_type The type of data contained in the attribute.
462 * @return A new status attribute.
464 PurpleStatusAttr *purple_status_attr_new(const char *id, const char *name,
465 PurpleValue *value_type);
468 * Destroys a status attribute.
470 * @param attr The status attribute to destroy.
472 void purple_status_attr_destroy(PurpleStatusAttr *attr);
475 * Returns the ID of a status attribute.
477 * @param attr The status attribute.
479 * @return The status attribute's ID.
481 const char *purple_status_attr_get_id(const PurpleStatusAttr *attr);
484 * Returns the name of a status attribute.
486 * @param attr The status attribute.
488 * @return The status attribute's name.
490 const char *purple_status_attr_get_name(const PurpleStatusAttr *attr);
493 * Returns the value of a status attribute.
495 * @param attr The status attribute.
497 * @return The status attribute's value.
499 PurpleValue *purple_status_attr_get_value(const PurpleStatusAttr *attr);
503 /**************************************************************************/
504 /** @name PurpleStatus API */
505 /**************************************************************************/
509 * Creates a new status.
511 * @param status_type The type of status.
512 * @param presence The parent presence.
514 * @return The new status.
516 PurpleStatus *purple_status_new(PurpleStatusType *status_type,
517 PurplePresence *presence);
522 * @param status The status to destroy.
524 void purple_status_destroy(PurpleStatus *status);
527 * Sets whether or not a status is active.
529 * This should only be called by the account, conversation, and buddy APIs.
531 * @param status The status.
532 * @param active The active state.
534 void purple_status_set_active(PurpleStatus *status, gboolean active);
537 * Sets whether or not a status is active.
539 * This should only be called by the account, conversation, and buddy APIs.
541 * @param status The status.
542 * @param active The active state.
543 * @param args A list of attributes to set on the status. This list is
544 * composed of key/value pairs, where each key is a valid
545 * attribute name for this PurpleStatusType. The list should
546 * be NULL terminated.
548 void purple_status_set_active_with_attrs(PurpleStatus *status, gboolean active,
552 * Sets whether or not a status is active.
554 * This should only be called by the account, conversation, and buddy APIs.
556 * @param status The status.
557 * @param active The active state.
558 * @param attrs A list of attributes to set on the status. This list is
559 * composed of key/value pairs, where each key is a valid
560 * attribute name for this PurpleStatusType. The list is
561 * not modified or freed by this function.
563 void purple_status_set_active_with_attrs_list(PurpleStatus *status, gboolean active,
566 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
568 * Sets the boolean value of an attribute in a status with the specified ID.
570 * @param status The status.
571 * @param id The attribute ID.
572 * @param value The boolean value.
574 * @deprecated This function is only used by status.c and should be made
577 void purple_status_set_attr_boolean(PurpleStatus *status, const char *id,
581 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
583 * Sets the integer value of an attribute in a status with the specified ID.
585 * @param status The status.
586 * @param id The attribute ID.
587 * @param value The integer value.
589 * @deprecated This function is only used by status.c and should be made
592 void purple_status_set_attr_int(PurpleStatus *status, const char *id,
596 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
598 * Sets the string value of an attribute in a status with the specified ID.
600 * @param status The status.
601 * @param id The attribute ID.
602 * @param value The string value.
604 * @deprecated This function is only used by status.c and should be made
607 void purple_status_set_attr_string(PurpleStatus *status, const char *id,
612 * Returns the status's type.
614 * @param status The status.
616 * @return The status's type.
618 PurpleStatusType *purple_status_get_type(const PurpleStatus *status);
621 * Returns the status's presence.
623 * @param status The status.
625 * @return The status's presence.
627 PurplePresence *purple_status_get_presence(const PurpleStatus *status);
630 * Returns the status's type ID.
632 * This is a convenience method for
633 * purple_status_type_get_id(purple_status_get_type(status)).
635 * @param status The status.
637 * @return The status's ID.
639 const char *purple_status_get_id(const PurpleStatus *status);
642 * Returns the status's name.
644 * This is a convenience method for
645 * purple_status_type_get_name(purple_status_get_type(status)).
647 * @param status The status.
649 * @return The status's name.
651 const char *purple_status_get_name(const PurpleStatus *status);
654 * Returns whether or not a status is independent.
656 * This is a convenience method for
657 * purple_status_type_is_independent(purple_status_get_type(status)).
659 * @param status The status.
661 * @return TRUE if the status is independent, or FALSE otherwise.
663 gboolean purple_status_is_independent(const PurpleStatus *status);
666 * Returns whether or not a status is exclusive.
668 * This is a convenience method for
669 * purple_status_type_is_exclusive(purple_status_get_type(status)).
671 * @param status The status.
673 * @return TRUE if the status is exclusive, FALSE otherwise.
675 gboolean purple_status_is_exclusive(const PurpleStatus *status);
678 * Returns whether or not a status is available.
680 * Available statuses are online and possibly invisible, but not away or idle.
682 * This is a convenience method for
683 * purple_status_type_is_available(purple_status_get_type(status)).
685 * @param status The status.
687 * @return TRUE if the status is available, or FALSE otherwise.
689 gboolean purple_status_is_available(const PurpleStatus *status);
692 * Returns the active state of a status.
694 * @param status The status.
696 * @return The active state of the status.
698 gboolean purple_status_is_active(const PurpleStatus *status);
701 * Returns whether or not a status is considered 'online'
703 * @param status The status.
705 * @return TRUE if the status is considered online, FALSE otherwise
707 gboolean purple_status_is_online(const PurpleStatus *status);
710 * Returns the value of an attribute in a status with the specified ID.
712 * @param status The status.
713 * @param id The attribute ID.
715 * @return The value of the attribute.
717 PurpleValue *purple_status_get_attr_value(const PurpleStatus *status,
721 * Returns the boolean value of an attribute in a status with the specified ID.
723 * @param status The status.
724 * @param id The attribute ID.
726 * @return The boolean value of the attribute.
728 gboolean purple_status_get_attr_boolean(const PurpleStatus *status,
732 * Returns the integer value of an attribute in a status with the specified ID.
734 * @param status The status.
735 * @param id The attribute ID.
737 * @return The integer value of the attribute.
739 int purple_status_get_attr_int(const PurpleStatus *status, const char *id);
742 * Returns the string value of an attribute in a status with the specified ID.
744 * @param status The status.
745 * @param id The attribute ID.
747 * @return The string value of the attribute.
749 const char *purple_status_get_attr_string(const PurpleStatus *status,
753 * Compares two statuses for availability.
755 * @param status1 The first status.
756 * @param status2 The second status.
758 * @return -1 if @a status1 is more available than @a status2.
759 * 0 if @a status1 is equal to @a status2.
760 * 1 if @a status2 is more available than @a status1.
762 gint purple_status_compare(const PurpleStatus *status1, const PurpleStatus *status2);
766 /**************************************************************************/
767 /** @name PurplePresence API */
768 /**************************************************************************/
772 * Creates a new presence.
774 * @param context The presence context.
776 * @return A new presence.
778 PurplePresence *purple_presence_new(PurplePresenceContext context);
781 * Creates a presence for an account.
783 * @param account The account.
785 * @return The new presence.
787 PurplePresence *purple_presence_new_for_account(PurpleAccount *account);
790 * Creates a presence for a conversation.
792 * @param conv The conversation.
794 * @return The new presence.
796 PurplePresence *purple_presence_new_for_conv(PurpleConversation *conv);
799 * Creates a presence for a buddy.
801 * @param buddy The buddy.
803 * @return The new presence.
805 PurplePresence *purple_presence_new_for_buddy(PurpleBuddy *buddy);
808 * Destroys a presence.
810 * All statuses added to this list will be destroyed along with
813 * @param presence The presence to destroy.
815 void purple_presence_destroy(PurplePresence *presence);
817 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
819 * Adds a status to a presence.
821 * @param presence The presence.
822 * @param status The status to add.
824 * @deprecated This function is only used by purple_presence_add_list,
825 * and both should be removed in 3.0.0.
827 void purple_presence_add_status(PurplePresence *presence, PurpleStatus *status);
830 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
832 * Adds a list of statuses to the presence.
834 * @param presence The presence.
835 * @param source_list The source list of statuses to add, which is not
836 * modified or freed by this function.
838 * @deprecated This function isn't used and should be removed in 3.0.0.
840 void purple_presence_add_list(PurplePresence *presence, GList *source_list);
844 * Sets the active state of a status in a presence.
846 * Only independent statuses can be set unactive. Normal statuses can only
847 * be set active, so if you wish to disable a status, set another
848 * non-independent status to active, or use purple_presence_switch_status().
850 * @param presence The presence.
851 * @param status_id The ID of the status.
852 * @param active The active state.
854 void purple_presence_set_status_active(PurplePresence *presence,
855 const char *status_id, gboolean active);
858 * Switches the active status in a presence.
860 * This is similar to purple_presence_set_status_active(), except it won't
861 * activate independent statuses.
863 * @param presence The presence.
864 * @param status_id The status ID to switch to.
866 void purple_presence_switch_status(PurplePresence *presence,
867 const char *status_id);
870 * Sets the idle state and time on a presence.
872 * @param presence The presence.
873 * @param idle The idle state.
874 * @param idle_time The idle time, if @a idle is TRUE. This
875 * is the time at which the user became idle,
876 * in seconds since the epoch. If this value is
877 * unknown then 0 should be used.
879 void purple_presence_set_idle(PurplePresence *presence, gboolean idle,
883 * Sets the login time on a presence.
885 * @param presence The presence.
886 * @param login_time The login time.
888 void purple_presence_set_login_time(PurplePresence *presence, time_t login_time);
892 * Returns the presence's context.
894 * @param presence The presence.
896 * @return The presence's context.
898 PurplePresenceContext purple_presence_get_context(const PurplePresence *presence);
901 * Returns a presence's account.
903 * @param presence The presence.
905 * @return The presence's account.
907 PurpleAccount *purple_presence_get_account(const PurplePresence *presence);
910 * Returns a presence's conversation.
912 * @param presence The presence.
914 * @return The presence's conversation.
916 PurpleConversation *purple_presence_get_conversation(const PurplePresence *presence);
919 * Returns a presence's chat user.
921 * @param presence The presence.
923 * @return The chat's user.
925 const char *purple_presence_get_chat_user(const PurplePresence *presence);
928 * Returns the presence's buddy.
930 * @param presence The presence.
932 * @return The presence's buddy.
934 PurpleBuddy *purple_presence_get_buddy(const PurplePresence *presence);
937 * Returns all the statuses in a presence.
939 * @param presence The presence.
941 * @constreturn The statuses.
943 GList *purple_presence_get_statuses(const PurplePresence *presence);
946 * Returns the status with the specified ID from a presence.
948 * @param presence The presence.
949 * @param status_id The ID of the status.
951 * @return The status if found, or NULL.
953 PurpleStatus *purple_presence_get_status(const PurplePresence *presence,
954 const char *status_id);
957 * Returns the active exclusive status from a presence.
959 * @param presence The presence.
961 * @return The active exclusive status.
963 PurpleStatus *purple_presence_get_active_status(const PurplePresence *presence);
966 * Returns whether or not a presence is available.
968 * Available presences are online and possibly invisible, but not away or idle.
970 * @param presence The presence.
972 * @return TRUE if the presence is available, or FALSE otherwise.
974 gboolean purple_presence_is_available(const PurplePresence *presence);
977 * Returns whether or not a presence is online.
979 * @param presence The presence.
981 * @return TRUE if the presence is online, or FALSE otherwise.
983 gboolean purple_presence_is_online(const PurplePresence *presence);
986 * Returns whether or not a status in a presence is active.
988 * A status is active if itself or any of its sub-statuses are active.
990 * @param presence The presence.
991 * @param status_id The ID of the status.
993 * @return TRUE if the status is active, or FALSE.
995 gboolean purple_presence_is_status_active(const PurplePresence *presence,
996 const char *status_id);
999 * Returns whether or not a status with the specified primitive type
1000 * in a presence is active.
1002 * A status is active if itself or any of its sub-statuses are active.
1004 * @param presence The presence.
1005 * @param primitive The status primitive.
1007 * @return TRUE if the status is active, or FALSE.
1009 gboolean purple_presence_is_status_primitive_active(
1010 const PurplePresence *presence, PurpleStatusPrimitive primitive);
1013 * Returns whether or not a presence is idle.
1015 * @param presence The presence.
1017 * @return TRUE if the presence is idle, or FALSE otherwise.
1018 * If the presence is offline (purple_presence_is_online()
1019 * returns FALSE) then FALSE is returned.
1021 gboolean purple_presence_is_idle(const PurplePresence *presence);
1024 * Returns the presence's idle time.
1026 * @param presence The presence.
1028 * @return The presence's idle time.
1030 time_t purple_presence_get_idle_time(const PurplePresence *presence);
1033 * Returns the presence's login time.
1035 * @param presence The presence.
1037 * @return The presence's login time.
1039 time_t purple_presence_get_login_time(const PurplePresence *presence);
1042 * Compares two presences for availability.
1044 * @param presence1 The first presence.
1045 * @param presence2 The second presence.
1047 * @return -1 if @a presence1 is more available than @a presence2.
1048 * 0 if @a presence1 is equal to @a presence2.
1049 * 1 if @a presence1 is less available than @a presence2.
1051 gint purple_presence_compare(const PurplePresence *presence1,
1052 const PurplePresence *presence2);
1056 /**************************************************************************/
1057 /** @name Status subsystem */
1058 /**************************************************************************/
1062 * Get the handle for the status subsystem.
1064 * @return the handle to the status subsystem
1066 void *purple_status_get_handle(void);
1069 * Initializes the status subsystem.
1071 void purple_status_init(void);
1074 * Uninitializes the status subsystem.
1076 void purple_status_uninit(void);
1084 #endif /* _PURPLE_STATUS_H_ */