mirror of
https://github.com/osmarks/ngircd.git
synced 2025-01-05 13:20:29 +00:00
Implemented IRC commands INFO, USERS (dummy), and SUMMON (dummy).
This commit is contained in:
parent
2f71fbb2a1
commit
ddecfcd831
22
ChangeLog
22
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 $
|
||||
|
15
NEWS
15
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 $
|
||||
|
@ -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>
|
||||
@ -85,6 +85,71 @@ IRC_ADMIN(CLIENT *Client, REQUEST *Req )
|
||||
} /* 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
|
||||
IRC_ISON( CLIENT *Client, REQUEST *Req )
|
||||
{
|
||||
@ -469,6 +534,19 @@ 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 )
|
||||
{
|
||||
@ -546,6 +624,18 @@ IRC_USERHOST( CLIENT *Client, REQUEST *Req )
|
||||
} /* 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
|
||||
IRC_VERSION( CLIENT *Client, REQUEST *Req )
|
||||
{
|
||||
|
@ -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 ));
|
||||
|
@ -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"
|
||||
|
@ -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 },
|
||||
|
@ -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
|
||||
|
||||
|
50
src/testsuite/misc-test.e
Normal file
50
src/testsuite/misc-test.e
Normal file
@ -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-
|
Loading…
Reference in New Issue
Block a user