Tue, 24 Oct 2023 01:23:22 -0500
Add purple_tags_remove_all
This isn't used by anything yet, but will be in the future.
Testing Done:
Ran the unit tests under valgrind.
Reviewed at https://reviews.imfreedom.org/r/2691/
|
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 |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
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 | * |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * This program is free software; you can redistribute it and/or modify |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * it under the terms of the GNU General Public License as published by |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * the Free Software Foundation; either version 2 of the License, or |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * (at your option) any later version. |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * This program is distributed in the hope that it will be useful, |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | * GNU General Public License for more details. |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
|
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 |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | * a tag with a name and value. Please note this distinction when the API calls |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | * for a name versus a tag which would be the name and the value. |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | * |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | * Since: 3.0.0 |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
50 | */ |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
51 | |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | G_BEGIN_DECLS |
|
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 | * purple_tags_new: |
|
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 | * Creates a new tags object. |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | * |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | * Returns: (transfer full): The new tags object. |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | * |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | * Since: 3.0.0 |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | */ |
|
42387
d9350cda1556
Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42239
diff
changeset
|
63 | PURPLE_AVAILABLE_IN_3_0 |
|
41736
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | PurpleTags *purple_tags_new(void); |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | /** |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | * purple_tags_lookup: |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | * @tags: The instance. |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | * @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
|
70 | * @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
|
71 | * was found or not. |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | * |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | * 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
|
74 | * |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | * 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
|
76 | * |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | * 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
|
78 | * %NULL is returned. |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | * |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | * Since: 3.0.0 |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | */ |
|
42387
d9350cda1556
Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42239
diff
changeset
|
82 | PURPLE_AVAILABLE_IN_3_0 |
|
41736
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | 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
|
84 | |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | /** |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | * purple_tags_get: |
|
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 get. |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | * |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | * Gets the first tag that matches @name. |
|
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 | * 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
|
93 | * %NULL is returned. |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | * |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | * Since: 3.0.0 |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | */ |
|
42387
d9350cda1556
Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42239
diff
changeset
|
97 | PURPLE_AVAILABLE_IN_3_0 |
|
41736
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | 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
|
99 | |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | /** |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | * purple_tags_add: |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | * @tags: The instance. |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | * @tag: The tag data. |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | * |
|
41908
9d2735c0e848
Don't allow duplicate tags in PurpleTags
Gary Kramlich <grim@reaperworld.com>
parents:
41892
diff
changeset
|
105 | * 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
|
106 | * replaced. |
|
41736
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
107 | * |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
108 | * Since: 3.0.0 |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | */ |
|
42387
d9350cda1556
Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42239
diff
changeset
|
110 | PURPLE_AVAILABLE_IN_3_0 |
|
41736
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | 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
|
112 | |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | /** |
|
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
|
114 | * 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
|
115 | * @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
|
116 | * @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
|
117 | * @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
|
118 | * |
|
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
|
119 | * 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
|
120 | * 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
|
121 | * |
|
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
|
122 | * Since: 3.0.0 |
|
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
|
123 | */ |
|
42387
d9350cda1556
Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42239
diff
changeset
|
124 | 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
|
125 | 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
|
126 | |
|
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
|
127 | /** |
|
41736
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | * purple_tags_remove: |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | * @tags: The instance. |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | * @tag: The tag data. |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | * |
|
42239
a453c0c955e9
Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents:
42238
diff
changeset
|
132 | * 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
|
133 | * the name. |
|
41736
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | * |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | * 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
|
136 | * |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
137 | * Since: 3.0.0 |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | */ |
|
42387
d9350cda1556
Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42239
diff
changeset
|
139 | PURPLE_AVAILABLE_IN_3_0 |
|
41736
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | 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
|
141 | |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 | /** |
|
42239
a453c0c955e9
Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents:
42238
diff
changeset
|
143 | * purple_tags_remove_with_value: |
|
a453c0c955e9
Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents:
42238
diff
changeset
|
144 | * @tags: The instance. |
|
a453c0c955e9
Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents:
42238
diff
changeset
|
145 | * @name: The tag name. |
|
a453c0c955e9
Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents:
42238
diff
changeset
|
146 | * @value: (nullable): The tag value. |
|
a453c0c955e9
Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents:
42238
diff
changeset
|
147 | * |
|
a453c0c955e9
Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents:
42238
diff
changeset
|
148 | * 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
|
149 | * from @name and @value. |
|
a453c0c955e9
Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents:
42238
diff
changeset
|
150 | * |
|
a453c0c955e9
Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents:
42238
diff
changeset
|
151 | * 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
|
152 | * |
|
a453c0c955e9
Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents:
42238
diff
changeset
|
153 | * Since: 3.0.0 |
|
a453c0c955e9
Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents:
42238
diff
changeset
|
154 | */ |
|
42387
d9350cda1556
Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42239
diff
changeset
|
155 | PURPLE_AVAILABLE_IN_3_0 |
|
42239
a453c0c955e9
Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents:
42238
diff
changeset
|
156 | 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
|
157 | |
|
a453c0c955e9
Add purple_tags_remove_with_value
Gary Kramlich <grim@reaperworld.com>
parents:
42238
diff
changeset
|
158 | /** |
|
42390
c2cd0378e212
Add purple_tags_remove_all
Gary Kramlich <grim@reaperworld.com>
parents:
42387
diff
changeset
|
159 | * purple_tags_remove_all: |
|
c2cd0378e212
Add purple_tags_remove_all
Gary Kramlich <grim@reaperworld.com>
parents:
42387
diff
changeset
|
160 | * @tags: The instance. |
|
c2cd0378e212
Add purple_tags_remove_all
Gary Kramlich <grim@reaperworld.com>
parents:
42387
diff
changeset
|
161 | * |
|
c2cd0378e212
Add purple_tags_remove_all
Gary Kramlich <grim@reaperworld.com>
parents:
42387
diff
changeset
|
162 | * Removes all tags from @tags. |
|
c2cd0378e212
Add purple_tags_remove_all
Gary Kramlich <grim@reaperworld.com>
parents:
42387
diff
changeset
|
163 | * |
|
c2cd0378e212
Add purple_tags_remove_all
Gary Kramlich <grim@reaperworld.com>
parents:
42387
diff
changeset
|
164 | * Since: 3.0.0 |
|
c2cd0378e212
Add purple_tags_remove_all
Gary Kramlich <grim@reaperworld.com>
parents:
42387
diff
changeset
|
165 | */ |
|
c2cd0378e212
Add purple_tags_remove_all
Gary Kramlich <grim@reaperworld.com>
parents:
42387
diff
changeset
|
166 | PURPLE_AVAILABLE_IN_3_0 |
|
c2cd0378e212
Add purple_tags_remove_all
Gary Kramlich <grim@reaperworld.com>
parents:
42387
diff
changeset
|
167 | void purple_tags_remove_all(PurpleTags *tags); |
|
c2cd0378e212
Add purple_tags_remove_all
Gary Kramlich <grim@reaperworld.com>
parents:
42387
diff
changeset
|
168 | |
|
c2cd0378e212
Add purple_tags_remove_all
Gary Kramlich <grim@reaperworld.com>
parents:
42387
diff
changeset
|
169 | /** |
|
41736
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | * purple_tags_get_count: |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | * @tags: The instance. |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
172 | * |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
173 | * Gets the number of tags in @tags. |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
174 | * |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
175 | * 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
|
176 | * |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
177 | * Since: 3.0.0 |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
178 | */ |
|
42387
d9350cda1556
Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42239
diff
changeset
|
179 | PURPLE_AVAILABLE_IN_3_0 |
|
41736
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
180 | guint purple_tags_get_count(PurpleTags *tags); |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
181 | |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
182 | /** |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
183 | * purple_tags_get_all: |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
184 | * @tags: The instance. |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
185 | * |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
186 | * Gets a list of all the tags. |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
187 | * |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
188 | * 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
|
189 | * |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
190 | * Since: 3.0.0 |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
191 | */ |
|
42387
d9350cda1556
Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42239
diff
changeset
|
192 | PURPLE_AVAILABLE_IN_3_0 |
|
41736
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
193 | GList *purple_tags_get_all(PurpleTags *tags); |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
194 | |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
195 | /** |
|
42238
48bb3244b5ea
Add purple_tags_get_all_with_name
Gary Kramlich <grim@reaperworld.com>
parents:
41945
diff
changeset
|
196 | * purple_tags_get_all_with_name: |
|
48bb3244b5ea
Add purple_tags_get_all_with_name
Gary Kramlich <grim@reaperworld.com>
parents:
41945
diff
changeset
|
197 | * @tags: The instance. |
|
48bb3244b5ea
Add purple_tags_get_all_with_name
Gary Kramlich <grim@reaperworld.com>
parents:
41945
diff
changeset
|
198 | * @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
|
199 | * |
|
48bb3244b5ea
Add purple_tags_get_all_with_name
Gary Kramlich <grim@reaperworld.com>
parents:
41945
diff
changeset
|
200 | * 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
|
201 | * |
|
48bb3244b5ea
Add purple_tags_get_all_with_name
Gary Kramlich <grim@reaperworld.com>
parents:
41945
diff
changeset
|
202 | * 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
|
203 | * tags. |
|
48bb3244b5ea
Add purple_tags_get_all_with_name
Gary Kramlich <grim@reaperworld.com>
parents:
41945
diff
changeset
|
204 | * |
|
48bb3244b5ea
Add purple_tags_get_all_with_name
Gary Kramlich <grim@reaperworld.com>
parents:
41945
diff
changeset
|
205 | * Since: 3.0.0 |
|
48bb3244b5ea
Add purple_tags_get_all_with_name
Gary Kramlich <grim@reaperworld.com>
parents:
41945
diff
changeset
|
206 | */ |
|
42387
d9350cda1556
Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42239
diff
changeset
|
207 | PURPLE_AVAILABLE_IN_3_0 |
|
42238
48bb3244b5ea
Add purple_tags_get_all_with_name
Gary Kramlich <grim@reaperworld.com>
parents:
41945
diff
changeset
|
208 | 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
|
209 | |
|
48bb3244b5ea
Add purple_tags_get_all_with_name
Gary Kramlich <grim@reaperworld.com>
parents:
41945
diff
changeset
|
210 | /** |
|
41736
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
211 | * purple_tags_to_string: |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
212 | * @tags: The instance. |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
213 | * @separator: (nullable): A string to separate the items. |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
214 | * |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
215 | * 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
|
216 | * |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
217 | * Returns: (transfer full): The string representation. |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
218 | * |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
219 | * Since: 3.0.0 |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
220 | */ |
|
42387
d9350cda1556
Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42239
diff
changeset
|
221 | PURPLE_AVAILABLE_IN_3_0 |
|
41736
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
222 | 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
|
223 | |
|
41892
39e595f7d056
Add purple_tag_parse for parsing tags
Gary Kramlich <grim@reaperworld.com>
parents:
41736
diff
changeset
|
224 | /** |
|
39e595f7d056
Add purple_tag_parse for parsing tags
Gary Kramlich <grim@reaperworld.com>
parents:
41736
diff
changeset
|
225 | * purple_tag_parse: |
|
39e595f7d056
Add purple_tag_parse for parsing tags
Gary Kramlich <grim@reaperworld.com>
parents:
41736
diff
changeset
|
226 | * @tag: The tag. |
|
39e595f7d056
Add purple_tag_parse for parsing tags
Gary Kramlich <grim@reaperworld.com>
parents:
41736
diff
changeset
|
227 | * @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
|
228 | * of the tag. |
|
39e595f7d056
Add purple_tag_parse for parsing tags
Gary Kramlich <grim@reaperworld.com>
parents:
41736
diff
changeset
|
229 | * @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
|
230 | * value of the tag. |
|
39e595f7d056
Add purple_tag_parse for parsing tags
Gary Kramlich <grim@reaperworld.com>
parents:
41736
diff
changeset
|
231 | * |
|
39e595f7d056
Add purple_tag_parse for parsing tags
Gary Kramlich <grim@reaperworld.com>
parents:
41736
diff
changeset
|
232 | * 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
|
233 | * |
|
39e595f7d056
Add purple_tag_parse for parsing tags
Gary Kramlich <grim@reaperworld.com>
parents:
41736
diff
changeset
|
234 | * Since: 3.0.0 |
|
39e595f7d056
Add purple_tag_parse for parsing tags
Gary Kramlich <grim@reaperworld.com>
parents:
41736
diff
changeset
|
235 | */ |
|
42387
d9350cda1556
Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42239
diff
changeset
|
236 | PURPLE_AVAILABLE_IN_3_0 |
|
41892
39e595f7d056
Add purple_tag_parse for parsing tags
Gary Kramlich <grim@reaperworld.com>
parents:
41736
diff
changeset
|
237 | void purple_tag_parse(const char *tag, char **name, char **value); |
|
39e595f7d056
Add purple_tag_parse for parsing tags
Gary Kramlich <grim@reaperworld.com>
parents:
41736
diff
changeset
|
238 | |
|
41736
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
239 | G_END_DECLS |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
240 | |
|
d78c0951ea2c
Create the PurpleTags object for handling tags
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
241 | #endif /* PURPLE_TAGS_H */ |