summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Kramlich <grim@reaperworld.com>2023-03-21 00:40:41 -0500
committerGary Kramlich <grim@reaperworld.com>2023-03-21 00:40:41 -0500
commita7030bbc8773c9cb2e880e2fd5176e78e3665e78 (patch)
treeea2e9962b2f656f1502525ba1bb1f858e383703a
parent1b4f76976e1a069831b98518588f587be79b122c (diff)
downloadpidgin-a7030bbc8773c9cb2e880e2fd5176e78e3665e78.tar.gz
Add purple_presence_primitive_to_string for easier display
Testing Done: Compiled Reviewed at https://reviews.imfreedom.org/r/2371/
-rw-r--r--libpurple/purplepresence.c30
-rw-r--r--libpurple/purplepresence.h13
2 files changed, 43 insertions, 0 deletions
diff --git a/libpurple/purplepresence.c b/libpurple/purplepresence.c
index fbb7d23d77..e31b8a6412 100644
--- a/libpurple/purplepresence.c
+++ b/libpurple/purplepresence.c
@@ -584,3 +584,33 @@ purple_presence_get_message(PurplePresence *presence) {
return purple_status_get_attr_string(priv->active_status, "message");
}
+
+const char *
+purple_presence_primitive_to_string(PurplePresencePrimitive primitive) {
+ switch(primitive) {
+ case PURPLE_PRESENCE_PRIMITIVE_OFFLINE:
+ return _("Offline");
+ break;
+ case PURPLE_PRESENCE_PRIMITIVE_AVAILABLE:
+ return _("Available");
+ break;
+ case PURPLE_PRESENCE_PRIMITIVE_IDLE:
+ return _("Idle");
+ break;
+ case PURPLE_PRESENCE_PRIMITIVE_INVISIBLE:
+ return _("Invisible");
+ break;
+ case PURPLE_PRESENCE_PRIMITIVE_AWAY:
+ return _("Away");
+ break;
+ case PURPLE_PRESENCE_PRIMITIVE_EXTENDED_AWAY:
+ return _("Do not disturb");
+ break;
+ case PURPLE_PRESENCE_PRIMITIVE_STREAMING:
+ return _("Streaming");
+ break;
+ default:
+ return _("Unknown");
+ break;
+ }
+}
diff --git a/libpurple/purplepresence.h b/libpurple/purplepresence.h
index 14a0c400a3..8e012fed16 100644
--- a/libpurple/purplepresence.h
+++ b/libpurple/purplepresence.h
@@ -318,6 +318,19 @@ PurpleStatusPrimitive purple_presence_get_primitive(PurplePresence *presence);
*/
const char *purple_presence_get_message(PurplePresence *presence);
+/**
+ * purple_presence_primitive_to_string:
+ * @primitive: The [enum@Purple.PresencePrimitive] value.
+ *
+ * Gets a string representation for @primitive that is suitable for display to
+ * users.
+ *
+ * Returns: The string representation.
+ *
+ * Since: 3.0.0
+ */
+const char *purple_presence_primitive_to_string(PurplePresencePrimitive primitive);
+
G_END_DECLS
#endif /* PURPLE_PRESENCE_H */