summary refs log tree commit diff stats
path: root/src/common/inbound.c
diff options
context:
space:
mode:
authorBerke Viktor <bviktor@hexchat.org>2013-05-11 02:40:08 +0200
committerBerke Viktor <bviktor@hexchat.org>2013-05-11 02:40:08 +0200
commit7b0b86c9f7841217d4156503fbe004fdea54caeb (patch)
tree922ca548f754c82cde3ce59f7b8a680aacb36d9e /src/common/inbound.c
parenta98b95923b4cfc2b05bc570036f810d127aa6e90 (diff)
Nuke nickserv password field and some cosmetics
Diffstat (limited to 'src/common/inbound.c')
-rw-r--r--src/common/inbound.c47
1 files changed, 35 insertions, 12 deletions
diff --git a/src/common/inbound.c b/src/common/inbound.c
index 29eaf754..2383955e 100644
--- a/src/common/inbound.c
+++ b/src/common/inbound.c
@@ -1367,6 +1367,20 @@ inbound_exec_eom_cmd (char *str, void *sess)
 	return 1;
 }
 
+static int
+inbound_nickserv_login (server *serv)
+{
+	/* this could grow ugly, but let's hope there won't be new NickServ types */
+	if (serv->loginmethod >= 1 && serv->loginmethod <= 5)
+	{
+		return 1;
+	}
+	else
+	{
+		return 0;
+	}
+}
+
 void
 inbound_login_end (session *sess, char *text)
 {
@@ -1385,34 +1399,43 @@ inbound_login_end (session *sess, char *text)
 		{
 			/* there may be more than 1, separated by \n */
 			if (((ircnet *)serv->network)->command)
-				token_foreach (((ircnet *)serv->network)->command, '\n',
-									inbound_exec_eom_cmd, sess);
+			{
+				token_foreach (((ircnet *)serv->network)->command, '\n', inbound_exec_eom_cmd, sess);
+			}
 
 			/* send nickserv password */
-			if (((ircnet *)serv->network)->nickserv)
-				serv->p_ns_identify (serv, ((ircnet *)serv->network)->nickserv);
+			if (((ircnet *)serv->network)->pass && inbound_nickserv_login (serv))
+			{
+				serv->p_ns_identify (serv, ((ircnet *)serv->network)->pass);
+			}
 		}
 
 		/* send JOIN now or wait? */
-		if (serv->network && ((ircnet *)serv->network)->nickserv &&
-			 prefs.hex_irc_join_delay)
-			serv->joindelay_tag = fe_timeout_add (prefs.hex_irc_join_delay * 1000,
-															  check_autojoin_channels, serv);
+		if (serv->network && ((ircnet *)serv->network)->pass && prefs.hex_irc_join_delay && inbound_nickserv_login (serv))
+		{
+			serv->joindelay_tag = fe_timeout_add (prefs.hex_irc_join_delay * 1000, check_autojoin_channels, serv);
+		}
 		else
+		{
 			check_autojoin_channels (serv);
+		}
+
 		if (serv->supports_watch || serv->supports_monitor)
+		{
 			notify_send_watches (serv);
+		}
+
 		serv->end_of_motd = TRUE;
 	}
+
 	if (prefs.hex_irc_skip_motd && !serv->motd_skipped)
 	{
 		serv->motd_skipped = TRUE;
-		EMIT_SIGNAL (XP_TE_MOTDSKIP, serv->server_session, NULL, NULL,
-						 NULL, NULL, 0);
+		EMIT_SIGNAL (XP_TE_MOTDSKIP, serv->server_session, NULL, NULL, NULL, NULL, 0);
 		return;
 	}
-	EMIT_SIGNAL (XP_TE_MOTD, serv->server_session, text, NULL,
-					 NULL, NULL, 0);
+
+	EMIT_SIGNAL (XP_TE_MOTD, serv->server_session, text, NULL, NULL, NULL, 0);
 }
 
 void