summary refs log tree commit diff stats
path: root/src/common
diff options
context:
space:
mode:
authorBerke Viktor <bviktor@hexchat.org>2013-05-12 16:38:21 +0200
committerBerke Viktor <bviktor@hexchat.org>2013-05-12 16:38:21 +0200
commitaac707956287e89639348edab4c7bd6782efd912 (patch)
treea180548e56d25a85b1dc03fa17fb73f768b3dd45 /src/common
parentcadcfc553c762f4658b3b34dd08038d6af029451 (diff)
Add code for migrating existing configs
Diffstat (limited to 'src/common')
-rw-r--r--src/common/servlist.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/common/servlist.c b/src/common/servlist.c
index d9654d77..3fd16f7f 100644
--- a/src/common/servlist.c
+++ b/src/common/servlist.c
@@ -661,7 +661,7 @@ servlist_connect (session *sess, ircnet *net, gboolean join)
 	}
 	else
 	{
-		serv->loginmethod = 2;				/* use /NickServ by default */
+		serv->loginmethod = 7;				/* Use server password by default. If we had a NickServ password, it'd be set to 2 already. */
 	}
 
 	serv->password[0] = 0;
@@ -1248,6 +1248,34 @@ servlist_load (void)
 			case 'D':
 				net->selected = atoi (buf + 2);
 				break;
+			/* FIXME Migration code. In 2.9.5 the order was:
+			 *
+			 * P=serverpass, A=saslpass, B=nickservpass
+			 *
+			 * So if server password was unset, we can safely use SASL
+			 * password for our new universal password, or if that's also
+			 * unset, use NickServ password.
+			 *
+			 * Should be removed at some point.
+			 */
+			case 'A':
+				if (!net->pass)
+				{
+					net->pass = strdup (buf + 2);
+					if (!net->logintype)
+					{
+						net->logintype = 6;
+					}
+				}
+			case 'B':
+				if (!net->pass)
+				{
+					net->pass = strdup (buf + 2);
+					if (!net->logintype)
+					{
+						net->logintype = 2;
+					}
+				}
 			}
 		}
 		if (buf[0] == 'N')