summary refs log tree commit diff stats
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/modes.c6
-rw-r--r--src/common/proto-irc.c11
-rw-r--r--src/common/server.c1
-rw-r--r--src/common/servlist.c39
-rw-r--r--src/common/servlist.h1
5 files changed, 45 insertions, 13 deletions
diff --git a/src/common/modes.c b/src/common/modes.c
index 38e57e4c..f8b25fcd 100644
--- a/src/common/modes.c
+++ b/src/common/modes.c
@@ -816,12 +816,6 @@ inbound_005 (server * serv, char *word[])
 				fe_set_channel (serv->server_session);
 			}
 
-			/* use /NICKSERV */
-			if (g_ascii_strcasecmp (word[w] + 8, "UniBG") == 0)
-				serv->nickservtype = 3;
-			else if (g_ascii_strcasecmp (word[w] + 8, "QuakeNet") == 0)
-				serv->nickservtype = 4;
-
 		} else if (strncmp (word[w], "CASEMAPPING=", 12) == 0)
 		{
 			if (strcmp (word[w] + 12, "ascii") == 0)	/* bahamut */
diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c
index 27c3cb8e..984f7f20 100644
--- a/src/common/proto-irc.c
+++ b/src/common/proto-irc.c
@@ -80,14 +80,21 @@ irc_nickserv (server *serv, char *cmd, char *arg1, char *arg2, char *arg3)
 		break;
 	case 4:
 		/* why couldn't QuakeNet implement one of the existing ones? */
-		tcp_sendf (serv, "AUTH %s%s%s\r\n", cmd, arg1, arg2, arg3);
+		tcp_sendf (serv, "AUTH %s %s\r\n", arg1, arg2);
 	}
 }
 
 static void
 irc_ns_identify (server *serv, char *pass)
 {
-	irc_nickserv (serv, "IDENTIFY", pass, "", "");
+	if (serv->nickservtype == 4)	/* QuakeNet needs to do everything in its own ways... */
+	{
+		irc_nickserv (serv, "", serv->nick, pass, "");
+	}
+	else
+	{
+		irc_nickserv (serv, "IDENTIFY", pass, "", "");
+	}
 }
 
 static void
diff --git a/src/common/server.c b/src/common/server.c
index 2f87faad..1f4f626e 100644
--- a/src/common/server.c
+++ b/src/common/server.c
@@ -1881,7 +1881,6 @@ server_set_defaults (server *serv)
 	serv->nick_modes = strdup ("ohv");
 
 	serv->nickcount = 1;
-	serv->nickservtype = 0;
 	serv->end_of_motd = FALSE;
 	serv->is_away = FALSE;
 	serv->supports_watch = FALSE;
diff --git a/src/common/servlist.c b/src/common/servlist.c
index a87cc719..736fffed 100644
--- a/src/common/servlist.c
+++ b/src/common/servlist.c
@@ -43,6 +43,7 @@ struct defaultserver
 	char *host;
 	char *channel;
 	char *charset;
+	int nsmode;		/* default NickServ type */
 };
 
 static const struct defaultserver def[] =
@@ -166,7 +167,7 @@ static const struct defaultserver def[] =
 	{0,			"irc.criten.net"},
 	{0,			"irc.eu.criten.net"},
 
-	{"DALnet",	0},
+	{"DALnet", 0, 0, 0, 2},
 	{0,			"irc.dal.net"},
 	{0,			"irc.eu.dal.net"},
 
@@ -433,7 +434,7 @@ static const struct defaultserver def[] =
 	{0,			"nfsi.ptnet.org"},
 	{0,			"fctunl.ptnet.org"},
 
-	{"QuakeNet",	0},
+	{"QuakeNet", 0, 0, 0, 5},
 	{0,			"irc.quakenet.org"},
 	{0,			"irc.se.quakenet.org"},
 	{0,			"irc.dk.quakenet.org"},
@@ -467,7 +468,7 @@ static const struct defaultserver def[] =
 	{"Rizon", 0},
 	{0,			"irc.rizon.net"},
 
-	{"RusNet", 0, 0, "KOI8-R (Cyrillic)"},
+	{"RusNet", 0, 0, "KOI8-R (Cyrillic)", 2},
 	{0,			"irc.tomsk.net"},
 	{0,			"irc.rinet.ru"},
 	{0,			"irc.run.net"},
@@ -552,7 +553,7 @@ static const struct defaultserver def[] =
 	{0,			"us.undernet.org"},
 	{0,			"eu.undernet.org"},
 
-	{"UniBG",		0},
+	{"UniBG", 0, 0, 0, 4},
 	{0,			"irc.lirex.com"},
 	{0,			"irc.naturella.com"},
 	{0,			"irc.spnet.net"},
@@ -625,6 +626,15 @@ servlist_connect (session *sess, ircnet *net, gboolean join)
 		}
 	}
 
+	if (net->nstype >= 1)	/* once again, make sure gtk_combo_box_get_active() is not bugging us, just in case */
+	{
+		serv->nickservtype = net->nstype - 1;	/* ircnet->nstype starts at 1, server->nickservtype starts at 0! */
+	}
+	else
+	{
+		serv->nickservtype = 1;					/* use /NickServ by default */
+	}
+
 	serv->password[0] = 0;
 	serv->sasluser[0] = 0;
 	serv->saslpassword[0] = 0;
@@ -1027,6 +1037,10 @@ servlist_load_defaults (void)
 				free (net->encoding);
 				net->encoding = strdup (def[i].charset);
 			}
+			if (def[i].nsmode)
+			{
+				net->nstype = def[i].nsmode;
+			}
 			if (g_str_hash (def[i].network) == def_hash)
 			{
 				prefs.hex_gui_slist_select = j;
@@ -1128,6 +1142,9 @@ servlist_load (void)
 			case 'B':
 				net->nickserv = strdup (buf + 2);
 				break;
+			case 'T':
+				net->nstype = atoi (buf + 2);
+				break;
 			}
 		}
 		if (buf[0] == 'N')
@@ -1241,6 +1258,20 @@ servlist_save (void)
 			fprintf (fp, "J=%s\n", net->autojoin);
 		if (net->nickserv)
 			fprintf (fp, "B=%s\n", net->nickserv);
+		if (net->nstype)
+		{
+			if (net->nstype == -1)		/* gtk_combo_box_get_active() returns -1 for invalid indices */
+			{
+				net->nstype = 0; 		/* avoid further crashes for the current session */
+				buf = g_strdup_printf (_("Warning: invalid NickServ type. Falling back to default type for network %s."), net->name);
+				fe_message (buf, FE_MSG_WARN);
+				g_free (buf);
+			}
+			else						/* the selection was fine, save it */
+			{
+				fprintf (fp, "T=%d\n", net->nstype);
+			}
+		}
 		if (net->encoding && g_ascii_strcasecmp (net->encoding, "System") &&
 			 g_ascii_strcasecmp (net->encoding, "System default"))
 		{
diff --git a/src/common/servlist.h b/src/common/servlist.h
index 5ed3c4d6..b652f463 100644
--- a/src/common/servlist.h
+++ b/src/common/servlist.h
@@ -37,6 +37,7 @@ typedef struct ircnet
 	char *autojoin;
 	char *command;
 	char *nickserv;
+	int nstype;
 	char *comment;
 	char *encoding;
 	GSList *servlist;