libpurple/purpletags.h

Mon, 12 May 2025 20:25:16 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Mon, 12 May 2025 20:25:16 -0500
changeset 43246
0e9bbe9b4da8
parent 43143
74178b555072
permissions
-rw-r--r--

Handle formatting in server messages

Testing Done:
Used the default motd on my local ergo server to verify that formatting was working.

Reviewed at https://reviews.imfreedom.org/r/3991/

41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Purple - Internet Messaging Library
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * Purple is the legal property of its developers, whose names are too numerous
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42390
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * source distribution.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42390
diff changeset
9 * This library is free software; you can redistribute it and/or modify it
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42390
diff changeset
10 * under the terms of the GNU General Public License as published by the Free
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42390
diff changeset
11 * Software Foundation; either version 2 of the License, or (at your option)
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42390
diff changeset
12 * any later version.
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42390
diff changeset
14 * This library is distributed in the hope that it will be useful, but WITHOUT
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42390
diff changeset
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42390
diff changeset
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42390
diff changeset
17 * more details.
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 *
42594
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42390
diff changeset
19 * You should have received a copy of the GNU General Public License along with
eddde70cedd8 Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents: 42390
diff changeset
20 * this library; if not, see <https://www.gnu.org/licenses/>.
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24 # error "only <purple.h> may be included directly"
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 #endif
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 #ifndef PURPLE_TAGS_H
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 #define PURPLE_TAGS_H
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 #include <glib.h>
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 #include <gio/gio.h>
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32
42387
d9350cda1556 Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42239
diff changeset
33 #include "purpleversion.h"
d9350cda1556 Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42239
diff changeset
34
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 #define PURPLE_TYPE_TAGS (purple_tags_get_type())
42387
d9350cda1556 Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42239
diff changeset
36
d9350cda1556 Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42239
diff changeset
37 PURPLE_AVAILABLE_IN_3_0
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 G_DECLARE_FINAL_TYPE(PurpleTags, purple_tags, PURPLE, TAGS, GObject)
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 /**
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 * PurpleTags:
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 *
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 * Tags is an object that can be used to keep track of arbitrary tags on
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 * objects. Tags are simple strings that use the first ':' to delimit a value.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 * For example: `foo` is a tag with just a name and no value, but `foo:bar` is
42745
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
46 * a tag with a name and value. Also, `foo:` is still considered a name and
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
47 * value, but the value is an empty string.
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
48 *
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
49 * Please note this distinction when the API calls for a name versus a tag
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
50 * which would be the name and the value.
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 *
42616
a7144db5570a Remove the micro version from since tags for libpurple part 5
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
52 * Since: 3.0
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 */
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 G_BEGIN_DECLS
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 /**
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 * purple_tags_new:
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 *
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 * Creates a new tags object.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 *
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 * Returns: (transfer full): The new tags object.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 *
42616
a7144db5570a Remove the micro version from since tags for libpurple part 5
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
64 * Since: 3.0
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 */
42387
d9350cda1556 Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42239
diff changeset
66 PURPLE_AVAILABLE_IN_3_0
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 PurpleTags *purple_tags_new(void);
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 /**
42745
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
70 * purple_tags_exists:
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
71 * @tags: The instance.
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
72 * @tag: The tag data.
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
73 *
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
74 * Checks if @tag exists in @tags.
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
75 *
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
76 * This checks both the tag name and value.
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
77 *
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
78 * Returns: %TRUE if @tag is in @tags, otherwise %FALSE.
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
79 *
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
80 * Since: 3.0
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
81 */
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
82 PURPLE_AVAILABLE_IN_3_0
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
83 gboolean purple_tags_exists(PurpleTags *tags, const char *tag);
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
84
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
85 /**
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 * purple_tags_lookup:
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 * @tags: The instance.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 * @name: The name of the tag to check if it exists.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 * @found: (out) (nullable): A return address for a boolean on whether the tag
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 * was found or not.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 *
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 * Gets the value of @name if it exists in @tags.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 *
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 * If @found is non %NULL, it will be set to %TRUE if @name was found.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 *
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 * Returns: The value of the first tag matching @name. If there is no value,
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 * %NULL is returned.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98 *
42616
a7144db5570a Remove the micro version from since tags for libpurple part 5
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
99 * Since: 3.0
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 */
42387
d9350cda1556 Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42239
diff changeset
101 PURPLE_AVAILABLE_IN_3_0
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102 const gchar *purple_tags_lookup(PurpleTags *tags, const gchar *name, gboolean *found);
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104 /**
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105 * purple_tags_get:
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106 * @tags: The instance.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107 * @name: The name of the tag to get.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
108 *
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109 * Gets the first tag that matches @name.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
110 *
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
111 * Returns: The value of the first tag matching @name. If there is no value,
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 * %NULL is returned.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113 *
42616
a7144db5570a Remove the micro version from since tags for libpurple part 5
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
114 * Since: 3.0
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115 */
42387
d9350cda1556 Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42239
diff changeset
116 PURPLE_AVAILABLE_IN_3_0
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117 const gchar *purple_tags_get(PurpleTags *tags, const gchar *name);
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119 /**
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120 * purple_tags_add:
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121 * @tags: The instance.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 * @tag: The tag data.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123 *
41908
9d2735c0e848 Don't allow duplicate tags in PurpleTags
Gary Kramlich <grim@reaperworld.com>
parents: 41892
diff changeset
124 * Adds @tag to @tags. If the tag already exists, the existing tag will be
9d2735c0e848 Don't allow duplicate tags in PurpleTags
Gary Kramlich <grim@reaperworld.com>
parents: 41892
diff changeset
125 * replaced.
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126 *
42616
a7144db5570a Remove the micro version from since tags for libpurple part 5
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
127 * Since: 3.0
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
128 */
42387
d9350cda1556 Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42239
diff changeset
129 PURPLE_AVAILABLE_IN_3_0
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
130 void purple_tags_add(PurpleTags *tags, const gchar *tag);
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
131
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
132 /**
41945
fd826d652e7d Add purple_tags_add_with_value to help people not have to construct their own tags
Gary Kramlich <grim@reaperworld.com>
parents: 41908
diff changeset
133 * purple_tags_add_with_value:
fd826d652e7d Add purple_tags_add_with_value to help people not have to construct their own tags
Gary Kramlich <grim@reaperworld.com>
parents: 41908
diff changeset
134 * @tags: The instance.
fd826d652e7d Add purple_tags_add_with_value to help people not have to construct their own tags
Gary Kramlich <grim@reaperworld.com>
parents: 41908
diff changeset
135 * @name: The name of the tag.
fd826d652e7d Add purple_tags_add_with_value to help people not have to construct their own tags
Gary Kramlich <grim@reaperworld.com>
parents: 41908
diff changeset
136 * @value: (nullable): The value of the tag.
fd826d652e7d Add purple_tags_add_with_value to help people not have to construct their own tags
Gary Kramlich <grim@reaperworld.com>
parents: 41908
diff changeset
137 *
fd826d652e7d Add purple_tags_add_with_value to help people not have to construct their own tags
Gary Kramlich <grim@reaperworld.com>
parents: 41908
diff changeset
138 * Formats @name and @value into a tag and adds it to @tags. If the tag already
fd826d652e7d Add purple_tags_add_with_value to help people not have to construct their own tags
Gary Kramlich <grim@reaperworld.com>
parents: 41908
diff changeset
139 * exists, the existing tag will be replaced.
fd826d652e7d Add purple_tags_add_with_value to help people not have to construct their own tags
Gary Kramlich <grim@reaperworld.com>
parents: 41908
diff changeset
140 *
42616
a7144db5570a Remove the micro version from since tags for libpurple part 5
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
141 * Since: 3.0
41945
fd826d652e7d Add purple_tags_add_with_value to help people not have to construct their own tags
Gary Kramlich <grim@reaperworld.com>
parents: 41908
diff changeset
142 */
42387
d9350cda1556 Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42239
diff changeset
143 PURPLE_AVAILABLE_IN_3_0
41945
fd826d652e7d Add purple_tags_add_with_value to help people not have to construct their own tags
Gary Kramlich <grim@reaperworld.com>
parents: 41908
diff changeset
144 void purple_tags_add_with_value(PurpleTags *tags, const char *name, const char *value);
fd826d652e7d Add purple_tags_add_with_value to help people not have to construct their own tags
Gary Kramlich <grim@reaperworld.com>
parents: 41908
diff changeset
145
fd826d652e7d Add purple_tags_add_with_value to help people not have to construct their own tags
Gary Kramlich <grim@reaperworld.com>
parents: 41908
diff changeset
146 /**
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147 * purple_tags_remove:
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148 * @tags: The instance.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149 * @tag: The tag data.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150 *
42239
a453c0c955e9 Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents: 42238
diff changeset
151 * Removes @tag from @tags. Note that this is the tag name and value not just
a453c0c955e9 Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents: 42238
diff changeset
152 * the name.
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
153 *
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154 * Returns: %TRUE if @tag was found and removed, otherwise %FALSE.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155 *
42616
a7144db5570a Remove the micro version from since tags for libpurple part 5
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
156 * Since: 3.0
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
157 */
42387
d9350cda1556 Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42239
diff changeset
158 PURPLE_AVAILABLE_IN_3_0
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
159 gboolean purple_tags_remove(PurpleTags *tags, const gchar *tag);
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161 /**
42239
a453c0c955e9 Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents: 42238
diff changeset
162 * purple_tags_remove_with_value:
a453c0c955e9 Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents: 42238
diff changeset
163 * @tags: The instance.
a453c0c955e9 Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents: 42238
diff changeset
164 * @name: The tag name.
a453c0c955e9 Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents: 42238
diff changeset
165 * @value: (nullable): The tag value.
a453c0c955e9 Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents: 42238
diff changeset
166 *
a453c0c955e9 Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents: 42238
diff changeset
167 * A helper function around [method@Tags.remove] that builds the tag variable
a453c0c955e9 Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents: 42238
diff changeset
168 * from @name and @value.
a453c0c955e9 Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents: 42238
diff changeset
169 *
a453c0c955e9 Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents: 42238
diff changeset
170 * Returns: %TRUE if a tag was found and removed, otherwise %FALSE.
a453c0c955e9 Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents: 42238
diff changeset
171 *
42616
a7144db5570a Remove the micro version from since tags for libpurple part 5
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
172 * Since: 3.0
42239
a453c0c955e9 Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents: 42238
diff changeset
173 */
42387
d9350cda1556 Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42239
diff changeset
174 PURPLE_AVAILABLE_IN_3_0
42239
a453c0c955e9 Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents: 42238
diff changeset
175 gboolean purple_tags_remove_with_value(PurpleTags *tags, const char *name, const char *value);
a453c0c955e9 Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents: 42238
diff changeset
176
a453c0c955e9 Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents: 42238
diff changeset
177 /**
42390
c2cd0378e212 Add purple_tags_remove_all
Gary Kramlich <grim@reaperworld.com>
parents: 42387
diff changeset
178 * purple_tags_remove_all:
c2cd0378e212 Add purple_tags_remove_all
Gary Kramlich <grim@reaperworld.com>
parents: 42387
diff changeset
179 * @tags: The instance.
c2cd0378e212 Add purple_tags_remove_all
Gary Kramlich <grim@reaperworld.com>
parents: 42387
diff changeset
180 *
c2cd0378e212 Add purple_tags_remove_all
Gary Kramlich <grim@reaperworld.com>
parents: 42387
diff changeset
181 * Removes all tags from @tags.
c2cd0378e212 Add purple_tags_remove_all
Gary Kramlich <grim@reaperworld.com>
parents: 42387
diff changeset
182 *
42616
a7144db5570a Remove the micro version from since tags for libpurple part 5
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
183 * Since: 3.0
42390
c2cd0378e212 Add purple_tags_remove_all
Gary Kramlich <grim@reaperworld.com>
parents: 42387
diff changeset
184 */
c2cd0378e212 Add purple_tags_remove_all
Gary Kramlich <grim@reaperworld.com>
parents: 42387
diff changeset
185 PURPLE_AVAILABLE_IN_3_0
c2cd0378e212 Add purple_tags_remove_all
Gary Kramlich <grim@reaperworld.com>
parents: 42387
diff changeset
186 void purple_tags_remove_all(PurpleTags *tags);
c2cd0378e212 Add purple_tags_remove_all
Gary Kramlich <grim@reaperworld.com>
parents: 42387
diff changeset
187
c2cd0378e212 Add purple_tags_remove_all
Gary Kramlich <grim@reaperworld.com>
parents: 42387
diff changeset
188 /**
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189 * purple_tags_get_count:
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
190 * @tags: The instance.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
191 *
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
192 * Gets the number of tags in @tags.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
193 *
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
194 * Returns: The number of tags that @tags is keeping track of.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
195 *
42616
a7144db5570a Remove the micro version from since tags for libpurple part 5
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
196 * Since: 3.0
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
197 */
42387
d9350cda1556 Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42239
diff changeset
198 PURPLE_AVAILABLE_IN_3_0
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
199 guint purple_tags_get_count(PurpleTags *tags);
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
200
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
201 /**
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
202 * purple_tags_get_all:
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
203 * @tags: The instance.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
204 *
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
205 * Gets a list of all the tags.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
206 *
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
207 * Returns: (transfer none) (element-type utf8): The list of all the tags.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
208 *
42616
a7144db5570a Remove the micro version from since tags for libpurple part 5
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
209 * Since: 3.0
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
210 */
42387
d9350cda1556 Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42239
diff changeset
211 PURPLE_AVAILABLE_IN_3_0
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
212 GList *purple_tags_get_all(PurpleTags *tags);
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
213
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
214 /**
42238
48bb3244b5ea Add purple_tags_get_all_with_name
Gary Kramlich <grim@reaperworld.com>
parents: 41945
diff changeset
215 * purple_tags_get_all_with_name:
48bb3244b5ea Add purple_tags_get_all_with_name
Gary Kramlich <grim@reaperworld.com>
parents: 41945
diff changeset
216 * @tags: The instance.
48bb3244b5ea Add purple_tags_get_all_with_name
Gary Kramlich <grim@reaperworld.com>
parents: 41945
diff changeset
217 * @name: The name of the tags to get.
48bb3244b5ea Add purple_tags_get_all_with_name
Gary Kramlich <grim@reaperworld.com>
parents: 41945
diff changeset
218 *
48bb3244b5ea Add purple_tags_get_all_with_name
Gary Kramlich <grim@reaperworld.com>
parents: 41945
diff changeset
219 * Gets a list of all tags that are named @name.
48bb3244b5ea Add purple_tags_get_all_with_name
Gary Kramlich <grim@reaperworld.com>
parents: 41945
diff changeset
220 *
48bb3244b5ea Add purple_tags_get_all_with_name
Gary Kramlich <grim@reaperworld.com>
parents: 41945
diff changeset
221 * Returns: (transfer container) (element-type utf8): The list of matching
48bb3244b5ea Add purple_tags_get_all_with_name
Gary Kramlich <grim@reaperworld.com>
parents: 41945
diff changeset
222 * tags.
48bb3244b5ea Add purple_tags_get_all_with_name
Gary Kramlich <grim@reaperworld.com>
parents: 41945
diff changeset
223 *
42616
a7144db5570a Remove the micro version from since tags for libpurple part 5
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
224 * Since: 3.0
42238
48bb3244b5ea Add purple_tags_get_all_with_name
Gary Kramlich <grim@reaperworld.com>
parents: 41945
diff changeset
225 */
42387
d9350cda1556 Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42239
diff changeset
226 PURPLE_AVAILABLE_IN_3_0
42238
48bb3244b5ea Add purple_tags_get_all_with_name
Gary Kramlich <grim@reaperworld.com>
parents: 41945
diff changeset
227 GList *purple_tags_get_all_with_name(PurpleTags *tags, const char *name);
48bb3244b5ea Add purple_tags_get_all_with_name
Gary Kramlich <grim@reaperworld.com>
parents: 41945
diff changeset
228
48bb3244b5ea Add purple_tags_get_all_with_name
Gary Kramlich <grim@reaperworld.com>
parents: 41945
diff changeset
229 /**
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
230 * purple_tags_to_string:
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
231 * @tags: The instance.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
232 * @separator: (nullable): A string to separate the items.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
233 *
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
234 * Creates a @separator delimited string containing each item in @tags.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
235 *
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
236 * Returns: (transfer full): The string representation.
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
237 *
42616
a7144db5570a Remove the micro version from since tags for libpurple part 5
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
238 * Since: 3.0
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
239 */
42387
d9350cda1556 Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42239
diff changeset
240 PURPLE_AVAILABLE_IN_3_0
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
241 gchar *purple_tags_to_string(PurpleTags *tags, const gchar *separator);
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
242
41892
39e595f7d056 Add purple_tag_parse for parsing tags
Gary Kramlich <grim@reaperworld.com>
parents: 41736
diff changeset
243 /**
43143
74178b555072 Rename purple_tag_parse to purple_tag_split
Gary Kramlich <grim@reaperworld.com>
parents: 42745
diff changeset
244 * purple_tag_split:
41892
39e595f7d056 Add purple_tag_parse for parsing tags
Gary Kramlich <grim@reaperworld.com>
parents: 41736
diff changeset
245 * @tag: The tag.
39e595f7d056 Add purple_tag_parse for parsing tags
Gary Kramlich <grim@reaperworld.com>
parents: 41736
diff changeset
246 * @name: (nullable) (optional) (out): An optional return address for the name
39e595f7d056 Add purple_tag_parse for parsing tags
Gary Kramlich <grim@reaperworld.com>
parents: 41736
diff changeset
247 * of the tag.
39e595f7d056 Add purple_tag_parse for parsing tags
Gary Kramlich <grim@reaperworld.com>
parents: 41736
diff changeset
248 * @value: (nullable) (optional) (out): An optional return address for the
39e595f7d056 Add purple_tag_parse for parsing tags
Gary Kramlich <grim@reaperworld.com>
parents: 41736
diff changeset
249 * value of the tag.
39e595f7d056 Add purple_tag_parse for parsing tags
Gary Kramlich <grim@reaperworld.com>
parents: 41736
diff changeset
250 *
39e595f7d056 Add purple_tag_parse for parsing tags
Gary Kramlich <grim@reaperworld.com>
parents: 41736
diff changeset
251 * Splits a tag into its name and value parts.
39e595f7d056 Add purple_tag_parse for parsing tags
Gary Kramlich <grim@reaperworld.com>
parents: 41736
diff changeset
252 *
42616
a7144db5570a Remove the micro version from since tags for libpurple part 5
Gary Kramlich <grim@reaperworld.com>
parents: 42594
diff changeset
253 * Since: 3.0
41892
39e595f7d056 Add purple_tag_parse for parsing tags
Gary Kramlich <grim@reaperworld.com>
parents: 41736
diff changeset
254 */
42387
d9350cda1556 Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42239
diff changeset
255 PURPLE_AVAILABLE_IN_3_0
43143
74178b555072 Rename purple_tag_parse to purple_tag_split
Gary Kramlich <grim@reaperworld.com>
parents: 42745
diff changeset
256 void purple_tag_split(const char *tag, char **name, char **value);
41892
39e595f7d056 Add purple_tag_parse for parsing tags
Gary Kramlich <grim@reaperworld.com>
parents: 41736
diff changeset
257
42745
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
258 /**
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
259 * purple_tags_contains:
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
260 * @tags: The instance.
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
261 * @needle: The tags to find.
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
262 *
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
263 * Checks if all of the tags in @needle can be found in @tags.
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
264 *
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
265 * This checks tags, which means names and values, and not just tag names.
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
266 *
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
267 * For example, if @tags contains `foo:bar, baz`, and @needle contains
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
268 * `foo:bar, baz:1` this will return %FALSE because `baz:1` is not in @tags.
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
269 *
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
270 * Returns: %TRUE if all tags in @needle can be found in @tags.
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
271 *
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
272 * Since: 3.0
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
273 */
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
274 PURPLE_AVAILABLE_IN_3_0
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
275 gboolean purple_tags_contains(PurpleTags *tags, PurpleTags *needle);
b45add2a840c Add some new methods to purple tags
Gary Kramlich <grim@reaperworld.com>
parents: 42616
diff changeset
276
41736
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
277 G_END_DECLS
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
278
d78c0951ea2c Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
279 #endif /* PURPLE_TAGS_H */

mercurial