diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2024-04-07 10:09:04 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2024-04-07 13:18:14 +0200 |
commit | 89fe540b531705d8455685173c692522e81cd134 (patch) | |
tree | 717a3b15ef5e7d254a2515371efac6d79329f527 /src/plugins/irc/irc-upgrade.c | |
parent | 40a68549b5d4d99c0083f15242aab7516a87871f (diff) | |
download | weechat-89fe540b531705d8455685173c692522e81cd134.zip |
core: add unique "id" in nicklist group and nick (issue #2081)
The id is a "long long" variable with the current time (microseconds
precision).
It is guaranteed to be unique for all groups and nicks inside the buffer, and
the same number is never used again in the same buffer, during the lifetime of
the process.
It persists and is unchanged after `/upgrade`.
Diffstat (limited to 'src/plugins/irc/irc-upgrade.c')
-rw-r--r-- | src/plugins/irc/irc-upgrade.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/plugins/irc/irc-upgrade.c b/src/plugins/irc/irc-upgrade.c index 402a225e4..4a82af10f 100644 --- a/src/plugins/irc/irc-upgrade.c +++ b/src/plugins/irc/irc-upgrade.c @@ -42,6 +42,7 @@ struct t_irc_server *irc_upgrade_current_server = NULL; struct t_irc_channel *irc_upgrade_current_channel = NULL; struct t_irc_modelist *irc_upgrade_current_modelist = NULL; +int irc_upgrading = 0; /* @@ -795,14 +796,15 @@ irc_upgrade_read_cb (const void *pointer, void *data, case IRC_UPGRADE_TYPE_NICK: if (irc_upgrade_current_server && irc_upgrade_current_channel) { - ptr_nick = irc_nick_new (irc_upgrade_current_server, - irc_upgrade_current_channel, - weechat_infolist_string (infolist, "name"), - weechat_infolist_string (infolist, "host"), - weechat_infolist_string (infolist, "prefixes"), - weechat_infolist_integer (infolist, "away"), - weechat_infolist_string (infolist, "account"), - weechat_infolist_string (infolist, "realname")); + ptr_nick = irc_nick_new_in_channel ( + irc_upgrade_current_server, + irc_upgrade_current_channel, + weechat_infolist_string (infolist, "name"), + weechat_infolist_string (infolist, "host"), + weechat_infolist_string (infolist, "prefixes"), + weechat_infolist_integer (infolist, "away"), + weechat_infolist_string (infolist, "account"), + weechat_infolist_string (infolist, "realname")); if (ptr_nick) { /* @@ -1005,7 +1007,9 @@ irc_upgrade_load () if (!upgrade_file) return 0; + irc_upgrading = 1; rc = weechat_upgrade_read (upgrade_file); + irc_upgrading = 0; weechat_upgrade_close (upgrade_file); |