diff options
author | Gary Kramlich <grim@reaperworld.com> | 2022-11-09 23:15:35 -0600 |
---|---|---|
committer | Gary Kramlich <grim@reaperworld.com> | 2022-11-09 23:15:35 -0600 |
commit | 1f795a4ace31a4c07914393261df169edb0dc2ff (patch) | |
tree | 2d3c621f9800f926e12c33afe0fa4a7a44d50f05 /libpurple/purpletags.c | |
parent | e929bad905f891dc84265bc4a3230c5a51278520 (diff) | |
download | pidgin-1f795a4ace31a4c07914393261df169edb0dc2ff.tar.gz |
Don't allow duplicate tags in PurpleTags
Originally I was thinking it might be useful to store counter objects in the
tags, but that adds a bunch of complexity to the serialization layer and tag
users can just get the existing tag, and then increment the value themselves.
Testing Done:
Ran the unit tests.
Reviewed at https://reviews.imfreedom.org/r/2053/
Diffstat (limited to 'libpurple/purpletags.c')
-rw-r--r-- | libpurple/purpletags.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libpurple/purpletags.c b/libpurple/purpletags.c index 4ff8705d1b..f4b2e972f7 100644 --- a/libpurple/purpletags.c +++ b/libpurple/purpletags.c @@ -119,6 +119,10 @@ purple_tags_add(PurpleTags *tags, const gchar *tag) { g_return_if_fail(PURPLE_IS_TAGS(tags)); g_return_if_fail(tag != NULL); + /* Remove any existing tags with this value. */ + purple_tags_remove(tags, tag); + + /* Add the new tag. */ tags->tags = g_list_append(tags->tags, g_strdup(tag)); } |