summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-04-29 19:31:02 +0200
committerSébastien Helleu <flashcode@flashtux.org>2024-04-29 21:07:04 +0200
commit9cd7fd38a91dc2980e82be49185c1eb20d70c0f9 (patch)
treeaf8a880ae9cf2d4575dbf01ec013505a2c328af9 /src
parentded599b272e94763a3f5477e43ec32bec7080f0d (diff)
downloadweechat-9cd7fd38a91dc2980e82be49185c1eb20d70c0f9.zip
api: allow to set nicklist group/nick id in functions nicklist_group_set and nicklist_nick_set (issue #2081)
Diffstat (limited to 'src')
-rw-r--r--src/gui/gui-nicklist.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/gui/gui-nicklist.c b/src/gui/gui-nicklist.c
index cbb5ad8e8..6d7f9e7fd 100644
--- a/src/gui/gui-nicklist.c
+++ b/src/gui/gui-nicklist.c
@@ -1037,6 +1037,7 @@ gui_nicklist_group_set (struct t_gui_buffer *buffer,
struct t_gui_nick_group *group,
const char *property, const char *value)
{
+ long long id;
long number;
char *error;
int group_changed;
@@ -1046,7 +1047,18 @@ gui_nicklist_group_set (struct t_gui_buffer *buffer,
group_changed = 0;
- if (strcmp (property, "color") == 0)
+ if (strcmp (property, "id") == 0)
+ {
+ id = strtoll (value, &error, 10);
+ if (error && !error[0]
+ && (id != group->id)
+ && !gui_nicklist_search_group_id (buffer, NULL, id))
+ {
+ group->id = id;
+ group_changed = 1;
+ }
+ }
+ else if (strcmp (property, "color") == 0)
{
string_shared_free (group->color);
group->color = (value[0]) ? (char *)string_shared_get (value) : NULL;
@@ -1147,6 +1159,7 @@ gui_nicklist_nick_set (struct t_gui_buffer *buffer,
struct t_gui_nick *nick,
const char *property, const char *value)
{
+ long long id;
long number;
char *error;
int nick_changed;
@@ -1156,7 +1169,18 @@ gui_nicklist_nick_set (struct t_gui_buffer *buffer,
nick_changed = 0;
- if (strcmp (property, "color") == 0)
+ if (strcmp (property, "id") == 0)
+ {
+ id = strtoll (value, &error, 10);
+ if (error && !error[0]
+ && (id != nick->id)
+ && !gui_nicklist_search_nick_id (buffer, NULL, id))
+ {
+ nick->id = id;
+ nick_changed = 1;
+ }
+ }
+ else if (strcmp (property, "color") == 0)
{
string_shared_free (nick->color);
nick->color = (value[0]) ? (char *)string_shared_get (value) : NULL;