Module: ngircd.git
Branch: master
Commit: 289a26e9e43be303a7355ab530ddcaa84aca60b9
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=289a26e9…
Author: Alexander Barton <alex(a)barton.de>
Date: Tue Jan 1 14:57:03 2013 +0100
Implement Help() function parsing and returning the help text
This function parses the already read in help text and sends the requested
portions to the user. Parsing is done as following when a user user
issues a "HELP <cmd>" command:
1. Search the file for a line "- <cmd>",
2. Output all subsequent lines that start with a TAB (ASCII 9) character
to the client using NOTICE commands, treat lines containing a single "."
after the TAB as empty lines.
3. Break at the first line not starting with a TAB character.
This format allows to have information to each command stored in this file
which will not be sent to an IRC user requesting help which enables us to
have additional annotations stored here which further describe the origin,
implementation details, or limits of the specific command.
A special "Intro" block is returned to the user when the HELP command is
used without a command name.
---
src/ngircd/irc.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 81 insertions(+), 3 deletions(-)
diff --git a/src/ngircd/irc.c b/src/ngircd/irc.c
index 1a0d725..f6b9dc5 100644
--- a/src/ngircd/irc.c
+++ b/src/ngircd/irc.c
@@ -44,6 +44,7 @@ static bool Send_Message PARAMS((CLIENT *Client, REQUEST *Req, int ForceType,
static bool Send_Message_Mask PARAMS((CLIENT *from, char *command,
char *targetMask, char *message,
bool SendErrors));
+static bool Help PARAMS((CLIENT *Client, const char *Topic));
/**
@@ -320,10 +321,23 @@ IRC_HELP(CLIENT *Client, REQUEST *Req)
assert(Req != NULL);
/* Bad number of arguments? */
- if (Req->argc > 0)
+ if (Req->argc > 1)
return IRC_WriteStrClient(Client, ERR_NORECIPIENT_MSG,
Client_ID(Client), Req->command);
+ IRC_SetPenalty(Client, 2);
+
+ if ((Req->argc == 0 && array_bytes(&Conf_Helptext) > 0)
+ || (Req->argc >= 1 && strcasecmp(Req->argv[0], "Commands") != 0)) {
+ /* Help text available and requested */
+ if (Req->argc >= 1)
+ return Help(Client, Req->argv[0]);
+
+ if (!Help(Client, "Intro"))
+ return DISCONNECTED;
+ return CONNECTED;
+ }
+
cmd = Parse_GetCommandStruct();
while(cmd->name) {
if (!IRC_WriteStrClient(Client, "NOTICE %s :%s",
@@ -331,12 +345,76 @@ IRC_HELP(CLIENT *Client, REQUEST *Req)
return DISCONNECTED;
cmd++;
}
-
- IRC_SetPenalty(Client, 2);
return CONNECTED;
} /* IRC_HELP */
+/**
+ * Send help for a given topic to the client.
+ *
+ * @param Client The client requesting help.
+ * @param Topoc The help topic requested.
+ * @return CONNECTED or DISCONNECTED.
+ */
+static bool
+Help(CLIENT *Client, const char *Topic)
+{
+ char *line;
+ size_t helptext_len, len_str, idx_start, lines = 0;
+ bool in_article = false;
+
+ assert(Client != NULL);
+ assert(Topic != NULL);
+
+ helptext_len = array_bytes(&Conf_Helptext);
+ line = array_start(&Conf_Helptext);
+ while (helptext_len > 0) {
+ len_str = strlen(line) + 1;
+ assert(helptext_len >= len_str);
+ helptext_len -= len_str;
+
+ if (in_article) {
+ /* The first character in each article text line must
+ * be a TAB (ASCII 9) character which will be stripped
+ * in the output. If it is not a TAB, the end of the
+ * article has been reached. */
+ if (line[0] != '\t') {
+ if (lines > 0)
+ return CONNECTED;
+ else
+ break;
+ }
+
+ /* A single '.' character indicates an empty line */
+ if (line[1] == '.' && line[2] == '\0')
+ idx_start = 2;
+ else
+ idx_start = 1;
+
+ if (!IRC_WriteStrClient(Client, "NOTICE %s :%s",
+ Client_ID(Client),
+ &line[idx_start]))
+ return DISCONNECTED;
+ lines++;
+
+ } else {
+ if (line[0] == '-' && line[1] == ' '
+ && strcasecmp(&line[2], Topic) == 0)
+ in_article = true;
+ }
+
+ line += len_str;
+ }
+
+ /* Help topic not found (or empty)! */
+ if (!IRC_WriteStrClient(Client, "NOTICE %s :No help for \"%s\" found!",
+ Client_ID(Client), Topic))
+ return DISCONNECTED;
+
+ return CONNECTED;
+}
+
+
static char *
#ifdef ZLIB
Option_String(CONN_ID Idx)
Module: ngircd.git
Branch: master
Commit: d2a1f6aa4be7e42dd76e5342b309b8331d86bab4
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=d2a1f6aa…
Author: Alexander Barton <alex(a)barton.de>
Date: Mon Dec 31 21:03:23 2012 +0100
Document "HelpFile" in sample-ngircd.conf and ngircd.conf.5
---
doc/sample-ngircd.conf.tmpl | 4 ++++
man/ngircd.conf.5.tmpl | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/doc/sample-ngircd.conf.tmpl b/doc/sample-ngircd.conf.tmpl
index 997a983..3f80a9f 100644
--- a/doc/sample-ngircd.conf.tmpl
+++ b/doc/sample-ngircd.conf.tmpl
@@ -33,6 +33,10 @@
;AdminInfo2 = Location
;AdminEMail = admin(a)irc.server
+ # Text file which contains the ngIRCd help text. This file is required
+ # to display help texts when using the "HELP <cmd>" command.
+ ;HelpFile = :ETCDIR:/ngircd.help
+
# Info text of the server. This will be shown by WHOIS and
# LINKS requests for example.
Info = Server Info Text
diff --git a/man/ngircd.conf.5.tmpl b/man/ngircd.conf.5.tmpl
index e3f62c8..681e86c 100644
--- a/man/ngircd.conf.5.tmpl
+++ b/man/ngircd.conf.5.tmpl
@@ -101,6 +101,10 @@ IRC network and must contain at least one dot (".") character.
Information about the server and the administrator, used by the ADMIN
command. This information is not required by the server but by RFC!
.TP
+\fBHelpFile\fR (string)
+Text file which contains the ngIRCd help text. This file is required
+to display help texts when using the "HELP <cmd>" command.
+.TP
\fBInfo\fR (string)
Info text of the server. This will be shown by WHOIS and LINKS requests for
example.
Module: ngircd.git
Branch: master
Commit: 21493731dffa0f5d9f62d24cdef290be6a6856fd
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=21493731…
Author: Alexander Barton <alex(a)barton.de>
Date: Wed Jan 2 22:37:55 2013 +0100
ngIRCd Release 20.1
---
ChangeLog | 16 +++++++++++++++-
NEWS | 4 ++++
contrib/Debian/changelog | 6 ++++++
contrib/ngircd.spec | 2 +-
4 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9e2a042..a4cfdb9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,13 +2,27 @@
ngIRCd - Next Generation IRC Server
http://ngircd.barton.de/
- (c)2001-2012 Alexander Barton and Contributors.
+ (c)2001-2013 Alexander Barton and Contributors.
ngIRCd is free software and published under the
terms of the GNU General Public License.
-- ChangeLog --
+ngIRCd 20.1 (2013-01-02)
+
+ - Allow ERROR command on server and service links only, ignore them and
+ add a penalty time on all other link types.
+ - Enforced mode setting by IRC Operators: Only check the channel user
+ modes of the initiator if he is joined to the channel and not an IRC
+ operator enforcing modes (which requires the configuration option
+ "OperCanUseMode" to be enabled), because trying to check channel user
+ modes of a non-member results in an assertion when running with debug
+ code or could crash the daemon otherwise. This closes bug #147, thanks
+ to James Kirwill <james.kirwill(a)bk.ru> for tracking this down!
+ - Fix build system to cope with spaces in path names.
+ - Code cleanups, mostly to fix build warnings on Cygwin.
+
ngIRCd 20 (2012-12-17)
- Allow user names ("INDENT") up to 20 characters when ngIRCd has not
diff --git a/NEWS b/NEWS
index c3f9c49..be743e6 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,10 @@
-- NEWS --
+ngIRCd 20.1 (2013-01-02)
+
+ - This release is a bugfix release only, without new features.
+
ngIRCd 20 (2012-12-17)
- Allow user names ("INDENT") up to 20 characters when ngIRCd has not
diff --git a/contrib/Debian/changelog b/contrib/Debian/changelog
index 2a9c2df..03c3df6 100644
--- a/contrib/Debian/changelog
+++ b/contrib/Debian/changelog
@@ -1,3 +1,9 @@
+ngircd (20.1-0ab1) unstable; urgency=low
+
+ * New "upstream" release: ngIRCd 20.1.
+
+ -- Alexander Barton <alex(a)barton.de> Wed, 02 Jan 2013 22:37:26 +0100
+
ngircd (20-0ab1) unstable; urgency=low
* New "upstream" release: ngIRCd 20.
diff --git a/contrib/ngircd.spec b/contrib/ngircd.spec
index 9632bc0..fa0a6a1 100644
--- a/contrib/ngircd.spec
+++ b/contrib/ngircd.spec
@@ -1,5 +1,5 @@
%define name ngircd
-%define version 20
+%define version 20.1
%define release 1
%define prefix %{_prefix}
Module: ngircd.git
Branch: master
Commit: 1f59821270e7298b380183778672e6db9c87971b
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=1f598212…
Author: Alexander Barton <alex(a)barton.de>
Date: Tue Jan 1 19:23:56 2013 +0100
Update Copyright notices for 2013
---
AUTHORS | 2 +-
INSTALL | 2 +-
NEWS | 2 +-
README | 2 +-
contrib/MacOSX/ngIRCd.pmdoc/index.xml | 2 +-
src/ngircd/ngircd.c | 4 ++--
6 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/AUTHORS b/AUTHORS
index 986beef..1d061a6 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -2,7 +2,7 @@
ngIRCd - Next Generation IRC Server
http://ngircd.barton.de/
- (c)2001-2012 Alexander Barton and Contributors.
+ (c)2001-2013 Alexander Barton and Contributors.
ngIRCd is free software and published under the
terms of the GNU General Public License.
diff --git a/INSTALL b/INSTALL
index b445958..de60feb 100644
--- a/INSTALL
+++ b/INSTALL
@@ -2,7 +2,7 @@
ngIRCd - Next Generation IRC Server
http://ngircd.barton.de/
- (c)2001-2012 Alexander Barton and Contributors.
+ (c)2001-2013 Alexander Barton and Contributors.
ngIRCd is free software and published under the
terms of the GNU General Public License.
diff --git a/NEWS b/NEWS
index 96ecdc8..c3f9c49 100644
--- a/NEWS
+++ b/NEWS
@@ -2,7 +2,7 @@
ngIRCd - Next Generation IRC Server
http://ngircd.barton.de/
- (c)2001-2012 Alexander Barton and Contributors.
+ (c)2001-2013 Alexander Barton and Contributors.
ngIRCd is free software and published under the
terms of the GNU General Public License.
diff --git a/README b/README
index 11d140d..c903aa1 100644
--- a/README
+++ b/README
@@ -2,7 +2,7 @@
ngIRCd - Next Generation IRC Server
http://ngircd.barton.de/
- (c)2001-2012 Alexander Barton and Contributors.
+ (c)2001-2013 Alexander Barton and Contributors.
ngIRCd is free software and published under the
terms of the GNU General Public License.
diff --git a/contrib/MacOSX/ngIRCd.pmdoc/index.xml b/contrib/MacOSX/ngIRCd.pmdoc/index.xml
index 34b3baa..e665bc6 100644
--- a/contrib/MacOSX/ngIRCd.pmdoc/index.xml
+++ b/contrib/MacOSX/ngIRCd.pmdoc/index.xml
@@ -5,7 +5,7 @@
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\qc\pardirnatural
\f0\i\fs24 \cf0 ngIRCd -- The Next Generation IRC Daemon\
-Copyright (c)2001-2011 Alexander Barton and Contributors.\
+Copyright (c)2001-2013 Alexander Barton and Contributors.\
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural
\i0 \cf0 \
diff --git a/src/ngircd/ngircd.c b/src/ngircd/ngircd.c
index f016b6a..dfae336 100644
--- a/src/ngircd/ngircd.c
+++ b/src/ngircd/ngircd.c
@@ -1,6 +1,6 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2012 Alexander Barton (alex(a)barton.de) and Contributors.
+ * Copyright (c)2001-2013 Alexander Barton (alex(a)barton.de) and Contributors.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -460,7 +460,7 @@ static void
Show_Version( void )
{
puts( NGIRCd_Version );
- puts( "Copyright (c)2001-2012 Alexander Barton (<alex(a)barton.de>) and Contributors." );
+ puts( "Copyright (c)2001-2013 Alexander Barton (<alex(a)barton.de>) and Contributors." );
puts( "Homepage: <http://ngircd.barton.de/>\n" );
puts( "This is free software; see the source for copying conditions. There is NO" );
puts( "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." );