From 97d29d7913dc533c503eb1124404d707a918bf65 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sat, 1 Oct 2016 23:47:42 +0200 Subject: [PATCH] Bring back VersionIsEmpty for supybot.user Was removed by e5729bc86d8148dcb39339d488b674e125fe0aa9, but the removal breaks compatibility with popular IRCds. --- src/conf.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/conf.py b/src/conf.py index 86b78c35f..7fc4e1719 100644 --- a/src/conf.py +++ b/src/conf.py @@ -212,8 +212,20 @@ registerGlobalValue(supybot, 'ident', ValidNick('limnoria', _("""Determines the bot's ident string, if the server doesn't provide one by default."""))) +# Although empty version strings are theoretically allowed by the RFC, +# popular IRCds do not. +# So, we keep replacing the empty string by the current version for +# bots which are migrated from Supybot or an old version of Limnoria +# (whose default value of supybot.user is the empty string). +class VersionIfEmpty(registry.String): + def __call__(self): + ret = registry.String.__call__(self) + if not ret: + ret = 'Limnoria $version' + return ret + registerGlobalValue(supybot, 'user', - registry.String('Limnoria $version', _("""Determines the real name which the bot sends to + VersionIfEmpty('Limnoria $version', _("""Determines the real name which the bot sends to the server. A standard real name using the current version of the bot will be generated if this is left empty.""")))