mirror of
https://github.com/irssi/irssi.git
synced 2025-01-03 14:56:47 -05:00
Preserve op/halfop/voice when /upgrading from before the prefixes change
(r4922). This also restores them when /upgrading from a revision between r4922 and this one. Note that other prefixes are still lost when /upgrading from pre-r4922 irssi. git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@4968 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
251d956ddc
commit
fe4c5abe28
@ -113,9 +113,11 @@ static void sig_session_restore_server(IRC_SERVER_REC *server,
|
||||
static void sig_session_restore_nick(IRC_CHANNEL_REC *channel,
|
||||
CONFIG_NODE *node)
|
||||
{
|
||||
const char *nick;
|
||||
const char *nick, *prefixes;
|
||||
int op, halfop, voice;
|
||||
NICK_REC *nickrec;
|
||||
char newprefixes[MAX_USER_PREFIXES + 1];
|
||||
int i;
|
||||
|
||||
if (!IS_IRC_CHANNEL(channel))
|
||||
return;
|
||||
@ -128,8 +130,24 @@ static void sig_session_restore_nick(IRC_CHANNEL_REC *channel,
|
||||
voice = config_node_get_bool(node, "voice", FALSE);
|
||||
halfop = config_node_get_bool(node, "halfop", FALSE);
|
||||
nickrec = irc_nicklist_insert(channel, nick, op, halfop, voice, FALSE);
|
||||
prefixes = config_node_get_str(node, "prefixes", NULL);
|
||||
if (prefixes == NULL || *prefixes == '\0') {
|
||||
/* upgrading from old irssi or from an in-between
|
||||
* version that did not imply non-present prefixes from
|
||||
* op/voice/halfop, restore prefixes
|
||||
*/
|
||||
i = 0;
|
||||
if (op)
|
||||
newprefixes[i++] = '@';
|
||||
if (halfop)
|
||||
newprefixes[i++] = '%';
|
||||
if (voice)
|
||||
newprefixes[i++] = '+';
|
||||
newprefixes[i] = '\0';
|
||||
prefixes = newprefixes;
|
||||
}
|
||||
strocpy(nickrec->prefixes,
|
||||
config_node_get_str(node, "prefixes", ""),
|
||||
prefixes,
|
||||
sizeof(nickrec->prefixes));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user