Commit Diff


commit - 2f71fbb2a1319d1b0aca4c9564c2e51a88b4a578
commit + ddecfcd8310f77974803c9c67431809320646a55
blob - 303661f0fe24c950a9c88e4826d6a70cbbe3aa90
blob + 163ccab52a98841e619e9846d7fdf5aa6d775751
--- ChangeLog
+++ ChangeLog
@@ -11,19 +11,21 @@
 
 
 ngIRCd HEAD
-  - RPL_WHOREPLY messages generated by IRC_WHO didn't
-    include flags (*,@,+) (Dana Dahlstrom)
-  - also add test cases for this (again, Dana)
-  - Under some circumstances ngIRCd issued
-  channel MODE messages with a trailing space. (Dana Dahlstrom)
+
+  - Implemented IRC commands INFO, SUMMON (dummy), and USERS (dummy) and
+    enhanced test suite to check these commands. (Dana Dahlstrom)
+  - RPL_WHOREPLY messages generated by IRC_WHO didn't include flags (*,@,+).
+    (Dana Dahlstrom)
+  - Under some circumstances ngIRCd issued channel MODE messages with a
+    trailing space. (Dana Dahlstrom)
   - IRC_WHO now supports search patterns and will test this
     against user nickname/servername/hostname, etc. as required by
     RFC 2812, Section 3.6.1. (reported by Dana Dahlstrom)
   - Add test cases for "WHO" command. (Dana Dahlstrom)
-  - implement RFC 2812 handling of "0" argument to 'JOIN':
-    must be treated as if the user had sent PART commands
-    for all channels the user is a member of. (Dana Dahlstrom)
-  - allow NOTICEs to be sent to a channel. (Fabian Schlager)
+  - Implement RFC 2812 handling of "0" argument to 'JOIN': must be treated
+    as if the user had sent PART commands for all channels the user is a
+    member of. (Dana Dahlstrom)
+  - Allow NOTICEs to be sent to a channel. (Fabian Schlager)
 
 ngIRCd 0.11.0 (2008-01-15)
 
@@ -749,4 +751,4 @@ ngIRCd 0.0.1, 31.12.2001
 
 
 -- 
-$Id: ChangeLog,v 1.339 2008/02/17 00:00:12 fw Exp $
+$Id: ChangeLog,v 1.340 2008/02/17 13:26:41 alex Exp $
blob - 9bd503f753c41213a1c97d00cb717f15281b12a1
blob + d5db7b86de58f906898d49536fc641ba31e43163
--- NEWS
+++ NEWS
@@ -11,13 +11,16 @@
 
 
 ngIRCd HEAD
+
+  - Implemented IRC commands INFO, SUMMON (dummy), and USERS (dummy) and
+    enhanced test suite to check these commands. (Dana Dahlstrom)
   - IRC_WHO now supports search patterns and will test this
     against user nickname/servername/hostname, etc. as required by
-    RFC 2812, Section 3.6.1.
-  - implement RFC 2812 handling of "0" argument to 'JOIN':
-    must be treated as if the user had sent PART commands
-    for all channels the user is a member of. (Dana Dahlstrom)
-  - allow NOTICEs to be sent to a channel. (Fabian Schlager)
+    RFC 2812, Section 3.6.1. (reported by Dana Dahlstrom)
+  - Implement RFC 2812 handling of "0" argument to 'JOIN': must be treated
+    as if the user had sent PART commands for all channels the user is a
+    member of. (Dana Dahlstrom)
+  - Allow NOTICEs to be sent to a channel. (Fabian Schlager)
 
 ngIRCd 0.11.0 (2008-01-15)
 
@@ -260,4 +263,4 @@ ngIRCd 0.0.1, 31.12.2001
 
 
 -- 
-$Id: NEWS,v 1.86 2008/02/11 11:06:33 fw Exp $
+$Id: NEWS,v 1.87 2008/02/17 13:26:41 alex Exp $
blob - 7878c5d4ab2a3459b580505df2b53b81e0f1b2e2
blob + 87ed2ad00c6e7d00037a58c5242731f6629527a0
--- src/ngircd/irc-info.c
+++ src/ngircd/irc-info.c
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: irc-info.c,v 1.43 2008/02/17 00:00:12 fw Exp $";
+static char UNUSED id[] = "$Id: irc-info.c,v 1.44 2008/02/17 13:26:42 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -83,6 +83,71 @@ IRC_ADMIN(CLIENT *Client, REQUEST *Req )
 	IRC_SetPenalty( Client, 1 );
 	return CONNECTED;
 } /* IRC_ADMIN */
+
+
+/**
+ * Handler for the IRC command "INFO".
+ * See RFC 2812 section 3.4.10.
+ */
+GLOBAL bool
+IRC_INFO(CLIENT * Client, REQUEST * Req)
+{
+	CLIENT *target, *prefix;
+	char msg[510];
+
+	assert(Client != NULL);
+	assert(Req != NULL);
+
+	/* Wrong number of parameters? */
+	if (Req->argc > 1)
+		return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+					  Client_ID(Client), Req->command);
+
+	/* Determine prefix */
+	if (Client_Type(Client) == CLIENT_SERVER)
+		prefix = Client_Search(Req->prefix);
+	else
+		prefix = Client;
+	if (!prefix)
+		return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
+					  Client_ID(Client), Req->prefix);
+
+	/* Look for a target */
+	if (Req->argc > 0)
+		target = Client_Search(Req->argv[0]);
+	else
+		target = Client_ThisServer();
+	
+	/* Make sure that the target is a server */
+	if (target && Client_Type(target) != CLIENT_SERVER)
+		target = Client_Introducer(target);
+
+	if (!target)
+		return IRC_WriteStrClient(prefix, ERR_NOSUCHSERVER_MSG,
+					  Client_ID(prefix), Req->argv[0]);
+
+	/* Pass on to another server? */
+	if (target != Client_ThisServer()) {
+		IRC_WriteStrClientPrefix(target, prefix, "INFO %s",
+					 Req->argv[0]);
+		return CONNECTED;
+	}
+
+	if (!IRC_WriteStrClient(Client, RPL_INFO_MSG, Client_ID(prefix),
+				NGIRCd_Version))
+		return DISCONNECTED;
+	
+	strlcpy(msg, "Server has been started ", sizeof(msg));
+	strlcat(msg, NGIRCd_StartStr, sizeof(msg));
+	if (!IRC_WriteStrClient(Client, RPL_INFO_MSG, Client_ID(prefix), msg))
+		return DISCONNECTED;
+
+	if (!IRC_WriteStrClient(Client, RPL_ENDOFINFO_MSG, Client_ID(prefix)))
+		return DISCONNECTED;
+
+	IRC_SetPenalty(Client, 2);
+	return CONNECTED;
+} /* IRC_INFO */
 
 
 GLOBAL bool
@@ -469,7 +534,20 @@ IRC_STATS( CLIENT *Client, REQUEST *Req )
 } /* IRC_STATS */
 
 
+/**
+ * Handler for the IRC command "SUMMON".
+ * See RFC 2812 section 4.5. ngIRCd doesn't implement this functionality and
+ * therefore answers with ERR_SUMMONDISABLED.
+ */
 GLOBAL bool
+IRC_SUMMON(CLIENT * Client, REQUEST * Req)
+{
+	return IRC_WriteStrClient(Client, ERR_SUMMONDISABLED_MSG,
+				  Client_ID(Client), Req->command);
+} /* IRC_SUMMON */
+
+
+GLOBAL bool
 IRC_TIME( CLIENT *Client, REQUEST *Req )
 {
 	CLIENT *from, *target;
@@ -544,6 +622,18 @@ IRC_USERHOST( CLIENT *Client, REQUEST *Req )
 
 	return IRC_WriteStrClient( Client, rpl, Client_ID( Client ) );
 } /* IRC_USERHOST */
+
+
+/**
+ * Handler for the IRC command "USERS".
+ * See RFC 2812 section 4.6. As suggested there the command is disabled.
+ */
+GLOBAL bool
+IRC_USERS(CLIENT * Client, REQUEST * Req)
+{
+	return IRC_WriteStrClient(Client, ERR_USERSDISABLED_MSG,
+				  Client_ID(Client), Req->command);
+} /* IRC_USERS */
 
 
 GLOBAL bool
blob - 1aff85bfcca2ad58619f06a60ff0ea985294415c
blob + faef75ad9ac37c55021bcca15ab887a5b648a5ff
--- src/ngircd/irc-info.h
+++ src/ngircd/irc-info.h
@@ -8,7 +8,7 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: irc-info.h,v 1.5 2008/02/11 11:06:31 fw Exp $
+ * $Id: irc-info.h,v 1.6 2008/02/17 13:26:42 alex Exp $
  *
  * IRC info commands (header)
  */
@@ -19,14 +19,17 @@
 
 
 GLOBAL bool IRC_ADMIN PARAMS(( CLIENT *Client, REQUEST *Req ));
+GLOBAL bool IRC_INFO PARAMS(( CLIENT *Client, REQUEST *Req ));
 GLOBAL bool IRC_ISON PARAMS(( CLIENT *Client, REQUEST *Req ));
 GLOBAL bool IRC_LINKS PARAMS(( CLIENT *Client, REQUEST *Req ));
 GLOBAL bool IRC_LUSERS PARAMS(( CLIENT *Client, REQUEST *Req ));
 GLOBAL bool IRC_MOTD PARAMS(( CLIENT *Client, REQUEST *Req ));
 GLOBAL bool IRC_NAMES PARAMS(( CLIENT *Client, REQUEST *Req ));
 GLOBAL bool IRC_STATS PARAMS(( CLIENT *Client, REQUEST *Req ));
+GLOBAL bool IRC_SUMMON PARAMS(( CLIENT *Client, REQUEST *Req ));
 GLOBAL bool IRC_TIME PARAMS(( CLIENT *Client, REQUEST *Req ));
 GLOBAL bool IRC_USERHOST PARAMS(( CLIENT *Client, REQUEST *Req ));
+GLOBAL bool IRC_USERS PARAMS(( CLIENT *Client, REQUEST *Req ));
 GLOBAL bool IRC_VERSION PARAMS(( CLIENT *Client, REQUEST *Req ));
 GLOBAL bool IRC_WHO PARAMS(( CLIENT *Client, REQUEST *Req ));
 GLOBAL bool IRC_WHOIS PARAMS(( CLIENT *Client, REQUEST *Req ));
blob - ccf9aa099010cde05f4a107cf1297b07066d026f
blob + 4f01ac5e4ccdad96e7d922fd8869fdbafc020bfb
--- src/ngircd/messages.h
+++ src/ngircd/messages.h
@@ -8,7 +8,7 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: messages.h,v 1.74 2007/12/11 11:29:44 fw Exp $
+ * $Id: messages.h,v 1.75 2008/02/17 13:26:42 alex Exp $
  *
  * IRC numerics (Header)
  */
@@ -77,6 +77,8 @@
 #define RPL_BANLIST_MSG			"367 %s %s %s"
 #define RPL_ENDOFBANLIST_MSG		"368 %s %s :End of channel ban list"
 #define RPL_ENDOFWHOWAS_MSG		"369 %s %s :End of WHOWAS list"
+#define RPL_INFO_MSG    		"371 %s :%s"
+#define RPL_ENDOFINFO_MSG    		"374 %s :End of INFO list"
 #define RPL_MOTD_MSG			"372 %s :- %s"
 #define RPL_MOTDSTART_MSG		"375 %s :- %s message of the day"
 #define RPL_ENDOFMOTD_MSG		"376 %s :End of MOTD command"
@@ -100,6 +102,8 @@
 #define ERR_USERNOTINCHANNEL_MSG	"441 %s %s %s :They aren't on that channel"
 #define ERR_NOTONCHANNEL_MSG		"442 %s %s :You are not on that channel"
 #define ERR_USERONCHANNEL_MSG		"443 %s %s %s :is already on channel"
+#define ERR_SUMMONDISABLED_MSG		"445 %s %s :SUMMON has been disabled"
+#define ERR_USERSDISABLED_MSG		"446 %s %s :USERS has been disabled"
 #define ERR_NOTREGISTERED_MSG		"451 %s :Connection not registered"
 #define ERR_NOTREGISTEREDSERVER_MSG	"451 %s :Connection not registered as server link"
 #define ERR_NEEDMOREPARAMS_MSG		"461 %s %s :Syntax error"
blob - 31ac99f59e5a8288fa63befa577f60e11977264a
blob + 5cfeaaa8a9fa05ba1c5e81a5cf612c6bb77c23d1
--- src/ngircd/parse.c
+++ src/ngircd/parse.c
@@ -12,7 +12,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: parse.c,v 1.71 2008/02/05 13:07:14 fw Exp $";
+static char UNUSED id[] = "$Id: parse.c,v 1.72 2008/02/17 13:26:42 alex Exp $";
 
 /**
  * @file
@@ -67,6 +67,7 @@ static COMMAND My_Commands[] =
 	{ "DISCONNECT", IRC_DISCONNECT, CLIENT_USER, 0, 0, 0 },
 	{ "ERROR", IRC_ERROR, 0xFFFF, 0, 0, 0 },
 	{ "HELP", IRC_HELP, CLIENT_USER, 0, 0, 0 },
+	{ "INFO", IRC_INFO, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
 	{ "INVITE", IRC_INVITE, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
 	{ "ISON", IRC_ISON, CLIENT_USER, 0, 0, 0 },
 	{ "JOIN", IRC_JOIN, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
@@ -93,11 +94,13 @@ static COMMAND My_Commands[] =
 	{ "SERVER", IRC_SERVER, 0xFFFF, 0, 0, 0 },
 	{ "SQUIT", IRC_SQUIT, CLIENT_SERVER, 0, 0, 0 },
 	{ "STATS", IRC_STATS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
+	{ "SUMMON", IRC_SUMMON, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
 	{ "TIME", IRC_TIME, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
 	{ "TOPIC", IRC_TOPIC, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
 	{ "TRACE", IRC_TRACE, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
 	{ "USER", IRC_USER, 0xFFFF, 0, 0, 0 },
 	{ "USERHOST", IRC_USERHOST, CLIENT_USER, 0, 0, 0 },
+	{ "USERS", IRC_USERS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
 	{ "VERSION", IRC_VERSION, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
 	{ "WALLOPS", IRC_WALLOPS, CLIENT_USER|CLIENT_SERVER, 0, 0, 0 },
 	{ "WHO", IRC_WHO, CLIENT_USER, 0, 0, 0 },
blob - 6ea9597c2596f53925ec94dcf108b913a59e18e6
blob + 6512aaae337713ac9f7a79f3bacd0b83e73673a4
--- src/testsuite/Makefile.am
+++ src/testsuite/Makefile.am
@@ -9,7 +9,7 @@
 # Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
 # der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
 #
-# $Id: Makefile.am,v 1.17 2008/02/17 00:00:13 fw Exp $
+# $Id: Makefile.am,v 1.18 2008/02/17 13:26:42 alex Exp $
 #
 
 AUTOMAKE_OPTIONS = ../portab/ansi2knr
@@ -20,9 +20,8 @@ EXTRA_DIST = \
 	README functions.inc getpid.sh \
 	start-server.sh stop-server.sh tests.sh stress-server.sh \
 	test-loop.sh wait-tests.sh \
-	connect-test.e channel-test.e mode-test.e \
-	who-test.e
-	stress-A.e stress-B.e check-idle.e \
+	channel-test.e connect-test.e check-idle.e misc-test.e mode-test.e \
+	who-test.e stress-A.e stress-B.e \
 	ngircd-test.conf
 
 all:
@@ -52,6 +51,10 @@ who-test: tests.sh
 	rm -f who-test
 	ln -s $(srcdir)/tests.sh who-test
 
+misc-test: tests.sh
+	rm -f misc-test
+	ln -s $(srcdir)/tests.sh misc-test
+
 mode-test: tests.sh
 	rm -f mode-test
 	ln -s $(srcdir)/tests.sh mode-test
@@ -59,8 +62,9 @@ mode-test: tests.sh
 TESTS = start-server.sh \
 	connect-test \
 	channel-test \
-	who-test \
+	misc-test \
 	mode-test \
+	who-test \
 	stress-server.sh \
 	stop-server.sh
 
blob - /dev/null
blob + 5c985f555bacbdc5210786e298a55cdd9653ff72 (mode 644)
--- /dev/null
+++ src/testsuite/misc-test.e
@@ -0,0 +1,50 @@
+# $Id: misc-test.e,v 1.1 2008/02/17 13:26:42 alex Exp $
+
+spawn telnet localhost 6789
+expect {
+	timeout { exit 1 }
+	"Connected"
+}
+
+send "nick nick\r"
+send "user user . . :User\r"
+expect {
+	timeout { exit 1 }
+	"376"
+}
+
+send "summon\r"
+expect {
+	timeout { exit 1 }
+	"445"
+}
+
+send "users\r"
+expect {
+	timeout { exit 1 }
+	"446"
+}
+
+send "info\r"
+expect {
+	timeout { exit 1 }
+	"371"
+}
+expect {
+	timeout { exit 1 }
+	"374"
+}
+
+send "squit\r"
+expect {
+	timeout { exit 1 }
+	"481"
+}
+
+send "quit\r"
+expect {
+	timeout { exit 1 }
+	"ERROR"
+}
+
+# -eof-