diff options
author | Jilles Tjoelker <jilles@irssi.org> | 2008-12-13 21:42:42 +0000 |
---|---|---|
committer | jilles <jilles@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2008-12-13 21:42:42 +0000 |
commit | fe4c5abe286b81238d8a5757ba888ff495c04766 (patch) | |
tree | f20abd8c14abc6f85113caa5d3d8fe8231120d98 /src/irc/core | |
parent | 251d956ddc7858b6a5ee0d12962b696968a731a7 (diff) | |
download | irssi-fe4c5abe286b81238d8a5757ba888ff495c04766.zip |
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
Diffstat (limited to 'src/irc/core')
-rw-r--r-- | src/irc/core/irc-session.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/irc/core/irc-session.c b/src/irc/core/irc-session.c index 5cd5cc43..21fc5fc7 100644 --- a/src/irc/core/irc-session.c +++ b/src/irc/core/irc-session.c @@ -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)); } |