Commit Diff


commit - f024a4992a9a38d64d0fd63283cd0c484bdec683
commit + 61b7932e82383f03cf751ff246c0610ce30dfd20
blob - 65da36016c7f44016fa6e0d18b6aaf0b3270c2e5
blob + ec425bd284686546de2cc36bb330b82151937ba3
--- doc/sample-ngircd.conf.tmpl
+++ doc/sample-ngircd.conf.tmpl
@@ -53,6 +53,12 @@
 
 	# A simple Phrase (<256 chars) if you don't want to use a motd file.
 	;MotdPhrase = "Hello world!"
+
+	# The name of the IRC network to which this server belongs. This name
+	# is optional, should only contain ASCII characters, and can't contain
+	# spaces. It is only used to inform clients. The default is empty,
+	# so no network name is announced to clients.
+	;Network = aIRCnetwork
 
 	# Global password for all users needed to connect to the server.
 	# (Default: not set)
blob - 5ca6ee388677db8be059275f205c707a4ccadb7a
blob + 3de2fbe0254701bca4f832dadc7a0e7e86c9010b
--- man/ngircd.conf.5.tmpl
+++ man/ngircd.conf.5.tmpl
@@ -125,6 +125,12 @@ configuration file.
 .TP
 \fBMotdPhrase\fR (string)
 A simple Phrase (<256 chars) if you don't want to use a MOTD file.
+.TP
+\fBNetwork\fR (string)
+The name of the IRC network to which this server belongs. This name is
+optional, should only contain ASCII characters, and can't contain spaces.
+It is only used to inform clients. The default is empty, so no network
+name is announced to clients.
 .TP
 \fBPassword\fR (string)
 Global password for all users needed to connect to the server. The default is
blob - 16275877a8d9e95f37cbf57ac1b395d55bb86d78
blob + bdbb506fcfcd39e391b6f967078804c10167a65d
--- src/ngircd/conf.c
+++ src/ngircd/conf.c
@@ -369,6 +369,7 @@ Conf_Test( void )
 		printf("  MotdPhrase = %s\n", array_bytes(&Conf_Motd)
 		       ? (const char*) array_start(&Conf_Motd) : "");
 	}
+	printf("  Network = %s\n", Conf_Network);
 #ifndef PAM
 	printf("  Password = %s\n", Conf_ServerPwd);
 #endif
@@ -749,6 +750,7 @@ Set_Defaults(bool InitServers)
 	strcpy(Conf_ServerAdminMail, "");
 	snprintf(Conf_ServerInfo, sizeof Conf_ServerInfo, "%s %s",
 		 PACKAGE_NAME, PACKAGE_VERSION);
+	strcpy(Conf_Network, "");
 	free(Conf_ListenAddress);
 	Conf_ListenAddress = NULL;
 	array_free(&Conf_ListenPorts);
@@ -1409,6 +1411,7 @@ Handle_GLOBAL(const char *File, int Line, char *Var, c
 	struct group *grp;
 	size_t len;
 	const char *section;
+	char *ptr;
 
 	assert(File != NULL);
 	assert(Line > 0);
@@ -1489,6 +1492,19 @@ Handle_GLOBAL(const char *File, int Line, char *Var, c
 				     "%s, line %d: Could not append MotdPhrase: %s",
 				     File, Line, strerror(errno));
 		Using_MotdFile = false;
+		return;
+	}
+	if (strcasecmp(Var, "Network") == 0) {
+		len = strlcpy(Conf_Network, Arg, sizeof(Conf_Network));
+		if (len >= sizeof(Conf_Network))
+			Config_Error_TooLong(File, Line, Var);
+		ptr = strchr(Conf_Network, ' ');
+		if (ptr) {
+			Config_Error(LOG_WARNING,
+				     "%s, line %d: \"Network\" can't contain spaces!",
+				     File, Line);
+			*ptr = '\0';
+		}
 		return;
 	}
 	if(strcasecmp(Var, "Password") == 0) {
blob - 02d23315552b0915020cb8690f1c084e97d69133
blob + aa80b8dd94942536c29ff4fce85c18e316e591ce
--- src/ngircd/conf.h
+++ src/ngircd/conf.h
@@ -109,6 +109,9 @@ GLOBAL char Conf_ServerAdmin1[CLIENT_INFO_LEN];
 GLOBAL char Conf_ServerAdmin2[CLIENT_INFO_LEN];
 GLOBAL char Conf_ServerAdminMail[CLIENT_INFO_LEN];
 
+/** Network name (optional, no spaces allowed) */
+GLOBAL char Conf_Network[CLIENT_INFO_LEN];
+
 /** Message of the day (MOTD) of this server */
 GLOBAL array Conf_Motd;
 
blob - 56cae2acd973d238f01add89ed0c86fa6e2ea6da
blob + aa98a5b560b163f4b96a5b4c7b1a20b7f4f6f2f3
--- src/ngircd/irc-info.c
+++ src/ngircd/irc-info.c
@@ -1539,6 +1539,10 @@ IRC_Send_NAMES(CLIENT * Client, CHANNEL * Chan)
 GLOBAL bool
 IRC_Send_ISUPPORT(CLIENT * Client)
 {
+	if (Conf_Network[0] && !IRC_WriteStrClient(Client, RPL_ISUPPORTNET_MSG,
+						   Client_ID(Client),
+						   Conf_Network))
+		return DISCONNECTED;
 	if (!IRC_WriteStrClient(Client, RPL_ISUPPORT1_MSG, Client_ID(Client),
 				CHANTYPES, CHANTYPES, Conf_MaxJoins))
 		return DISCONNECTED;
blob - 53b96581e8a1ade48eac3c5f64a4505e7e9dda0c
blob + f3a0ba442ac97ee82dd950607259b71302b5e526
--- src/ngircd/messages.h
+++ src/ngircd/messages.h
@@ -21,6 +21,7 @@
 #define RPL_YOURHOST_MSG		"002 %s :Your host is %s, running version ngircd-%s (%s/%s/%s)"
 #define RPL_CREATED_MSG			"003 %s :This server has been started %s"
 #define RPL_MYINFO_MSG			"004 %s %s ngircd-%s %s %s"
+#define RPL_ISUPPORTNET_MSG		"005 %s NETWORK=%s :is my network name"
 #define RPL_ISUPPORT1_MSG		"005 %s RFC2812 IRCD=ngIRCd CHARSET=UTF-8 CASEMAPPING=ascii PREFIX=(qaohv)~&@%%+ CHANTYPES=%s CHANMODES=beI,k,l,imMnOPQRstVz CHANLIMIT=%s:%d :are supported on this server"
 #define RPL_ISUPPORT2_MSG		"005 %s CHANNELLEN=%d NICKLEN=%d TOPICLEN=%d AWAYLEN=%d KICKLEN=%d MODES=%d MAXLIST=beI:%d EXCEPTS=e INVEX=I PENALTY :are supported on this server"