dslinux/user/tinyirc COPYING DCC.doc Makefile announce ctcp.doc magic server-numerics tinyirc.c tinyircd.c
stsp
stsp at user.in-berlin.de
Mon Jul 3 00:34:12 CEST 2006
Update of /cvsroot/dslinux/dslinux/user/tinyirc
In directory antilope:/tmp/cvs-serv31778
Added Files:
COPYING DCC.doc Makefile announce ctcp.doc magic
server-numerics tinyirc.c tinyircd.c
Log Message:
Adding pristine copy of tinyirc so I can branch from it.
--- NEW FILE: server-numerics ---
/************************************************************************
* IRC - Internet Relay Chat, include/numeric.h
* Copyright (C) 1990 Jarkko Oikarinen
*
* 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
* the Free Software Foundation; either version 1, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* -- Avalon -- 1 Sep 1992
*
* Added RPL_TRACELOG, RPL_STATSOLINE
*/
/*
* -- Avalon -- 13 Aug 1992
*
* Added ERR_BADCHANNELKEY, ERR_KEYSET
*/
/*
* -- Avalon -- 10 Aug 1992
*
* Added RPL_SUMMONING
*/
/*
* -- Avalon -- 5 Jul 1992
*
* Added ERR_NICKCOLLISION
*/
/*
* -- Avalon -- 14 Jul 1992
*
* Added RPL_UNAWAY, RPL_NOWAWAY, ERR_NOORIGIN, ERR_FILEERROR, ERR_NOLOGIN,
* ERR_SUMMONDISABLED, ERR_USERSDISABLED, RPL_USERSSTART, RPL_USERS,
* RPL_ENDOFUSERS, RPL_NOUSERS
*/
/*
* -- Avalon -- 12 Jul 1992
*
* Added RPL_CLOSING RPL_CLOSEEND
*/
/*
* -- Avalon -- 10-11 Jul 1992
*
* Added RPL_MOTD, RPL_MOTDSTART, RPL_ENDOFMOTD, ERR_NOMOTD,
* RPL_INFO, RPL_INFOSTART, RPL_ENDOFINFO, ERR_CANTKILLSERVER,
* RPL_LUSERCLIENT, RPL_LUSEROP, RPL_LUSERUNKNOWN, RPL_LUSERCHAN, RPL_LUSERME,
* RPL_STATSUPTIME, RPL_ADMINLOC1, RPL_ADMINLOC2, RPL_ADMINME,
* RPL_ADMINEMAIL, ERR_NOADMININFO
*/
/*
* -- Avalon -- 28 Jun 1992
*
* Added ERR_BADCHANMASK and RPL_ENDOFWHOWAS
*/
/*
* -- Avalon -- 13 May 1992
*
* Added RPL_STATSLLINE
*/
/*
* -- Avalon -- 12 Jan 1992
*
* Added RPL_TRACELINK
*/
/*
* -- Wumpus -- 30 Nov 1991
*
* It's very important that you never change what a numeric means --
* you can delete old ones (maybe) and add new ones, but never ever
* take a number and make it suddenly mean something else, or change
* an old number just for the hell of it.
*/
/*
* -- avalon -- 19 Nov 1991
* Added ERR_USERSDONTMATCH
*
* -- avalon -- 06 Nov 1991
* Added RPL_BANLIST, RPL_BANLISTEND, ERR_BANNEDFROMCHAN
*
* -- avalon -- 15 Oct 1991
* Added RPL_TRACEs (201-209)
* Added RPL_STATSs (211-219)
*/
/* -- Jto -- 16 Jun 1990
* A couple of new numerics added...
*/
/* -- Jto -- 03 Jun 1990
* Added ERR_YOUWILLBEBANNED and Check defines (sigh, had to put 'em here..)
* Added ERR_UNKNOWNMODE...
* Added ERR_CANNOTSENDTOCHAN...
*/
/*
* Reserve numerics 000-099 for server-client connections where the client
* is local to the server. If any server is passed a numeric in this range
* from another server then it is remapped to 100-199. -avalon
*/
#define RPL_WELCOME 001
#define RPL_YOURHOST 002
#define RPL_CREATED 003
#define RPL_MYINFO 004
/*
* Errors are in the range from 400-599 currently and are grouped by what
* commands they come from.
*/
#define ERR_NOSUCHNICK 401
#define ERR_NOSUCHSERVER 402
#define ERR_NOSUCHCHANNEL 403
#define ERR_CANNOTSENDTOCHAN 404
#define ERR_TOOMANYCHANNELS 405
#define ERR_WASNOSUCHNICK 406
#define ERR_TOOMANYTARGETS 407
#define ERR_NOSUCHSERVICE 408
#define ERR_NOORIGIN 409
#define ERR_NORECIPIENT 411
#define ERR_NOTEXTTOSEND 412
#define ERR_NOTOPLEVEL 413
#define ERR_WILDTOPLEVEL 414
#define ERR_UNKNOWNCOMMAND 421
#define ERR_NOMOTD 422
#define ERR_NOADMININFO 423
#define ERR_FILEERROR 424
#define ERR_NONICKNAMEGIVEN 431
#define ERR_ERRONEUSNICKNAME 432
#define ERR_NICKNAMEINUSE 433
#define ERR_SERVICENAMEINUSE 434
#define ERR_SERVICECONFUSED 435
#define ERR_NICKCOLLISION 436
#define ERR_USERNOTINCHANNEL 441
#define ERR_NOTONCHANNEL 442
#define ERR_USERONCHANNEL 443
#define ERR_NOLOGIN 444
#define ERR_SUMMONDISABLED 445
#define ERR_USERSDISABLED 446
#define ERR_NOTREGISTERED 451
#define ERR_NEEDMOREPARAMS 461
#define ERR_ALREADYREGISTRED 462
#define ERR_NOPERMFORHOST 463
#define ERR_PASSWDMISMATCH 464
#define ERR_YOUREBANNEDCREEP 465
#define ERR_YOUWILLBEBANNED 466
#define ERR_KEYSET 467
#define ERR_CHANNELISFULL 471
#define ERR_UNKNOWNMODE 472
#define ERR_INVITEONLYCHAN 473
#define ERR_BANNEDFROMCHAN 474
#define ERR_BADCHANNELKEY 475
#define ERR_BADCHANMASK 476
#define ERR_NOPRIVILEGES 481
#define ERR_CHANOPRIVSNEEDED 482
#define ERR_CANTKILLSERVER 483
#define ERR_NOOPERHOST 491
#define ERR_NOSERVICEHOST 492
#define ERR_UMODEUNKNOWNFLAG 501
#define ERR_USERSDONTMATCH 502
/*
* Numberic replies from server commands.
* These are currently in the range 200-399.
*/
#define RPL_NONE 300
#define RPL_AWAY 301
#define RPL_USERHOST 302
#define RPL_ISON 303
#define RPL_TEXT 304
#define RPL_UNAWAY 305
#define RPL_NOWAWAY 306
#define RPL_WHOISUSER 311
#define RPL_WHOISSERVER 312
#define RPL_WHOISOPERATOR 313
#define RPL_WHOWASUSER 314
/* rpl_endofwho below (315) */
#define RPL_ENDOFWHOWAS 369
#define RPL_WHOISCHANOP 316 /* redundant and not needed but reserved */
#define RPL_WHOISIDLE 317
#define RPL_ENDOFWHOIS 318
#define RPL_WHOISCHANNELS 319
#define RPL_LISTSTART 321
#define RPL_LIST 322
#define RPL_LISTEND 323
#define RPL_CHANNELMODEIS 324
#define RPL_NOTOPIC 331
#define RPL_TOPIC 332
#define RPL_INVITING 341
#define RPL_SUMMONING 342
#define RPL_VERSION 351
#define RPL_WHOREPLY 352
#define RPL_ENDOFWHO 315
#define RPL_NAMREPLY 353
#define RPL_ENDOFNAMES 366
#define RPL_KILLDONE 361
#define RPL_CLOSING 362
#define RPL_CLOSEEND 363
#define RPL_LINKS 364
#define RPL_ENDOFLINKS 365
/* rpl_endofnames above (366) */
#define RPL_BANLIST 367
#define RPL_ENDOFBANLIST 368
/* rpl_endofwhowas above (369) */
#define RPL_INFO 371
#define RPL_MOTD 372
#define RPL_INFOSTART 373
#define RPL_ENDOFINFO 374
#define RPL_MOTDSTART 375
#define RPL_ENDOFMOTD 376
#define RPL_YOUREOPER 381
#define RPL_REHASHING 382
#define RPL_YOURESERVICE 383
#define RPL_MYPORTIS 384
#define RPL_NOTOPERANYMORE 385
#define RPL_TIME 391
#define RPL_USERSSTART 392
#define RPL_USERS 393
#define RPL_ENDOFUSERS 394
#define RPL_NOUSERS 395
#define RPL_TRACELINK 200
#define RPL_TRACECONNECTING 201
#define RPL_TRACEHANDSHAKE 202
#define RPL_TRACEUNKNOWN 203
#define RPL_TRACEOPERATOR 204
#define RPL_TRACEUSER 205
#define RPL_TRACESERVER 206
#define RPL_TRACESERVICE 207
#define RPL_TRACENEWTYPE 208
#define RPL_TRACECLASS 209
#define RPL_STATSLINKINFO 211
#define RPL_STATSCOMMANDS 212
#define RPL_STATSCLINE 213
#define RPL_STATSNLINE 214
#define RPL_STATSILINE 215
#define RPL_STATSKLINE 216
#define RPL_STATSQLINE 217
#define RPL_STATSYLINE 218
#define RPL_ENDOFSTATS 219
#define RPL_UMODEIS 221
#define RPL_SERVICEINFO 231
#define RPL_ENDOFSERVICES 232
#define RPL_SERVICE 233
#define RPL_SERVLIST 234
#define RPL_SERVLISTEND 235
#define RPL_STATSLLINE 241
#define RPL_STATSUPTIME 242
#define RPL_STATSOLINE 243
#define RPL_STATSHLINE 244
#define RPL_STATSSLINE 245
#define RPL_LUSERCLIENT 251
#define RPL_LUSEROP 252
#define RPL_LUSERUNKNOWN 253
#define RPL_LUSERCHANNELS 254
#define RPL_LUSERME 255
#define RPL_ADMINME 256
#define RPL_ADMINLOC1 257
#define RPL_ADMINLOC2 258
#define RPL_ADMINEMAIL 259
#define RPL_TRACELOG 261
--- NEW FILE: magic ---
103276200
--- NEW FILE: COPYING ---
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
--- NEW FILE: DCC.doc ---
From: jnelson at iastate.edu (Jeremy Nelson)
Newsgroups: alt.irc.ircii
Subject: Re: Specs for DCC
Date: 2 Apr 1994 22:50:53 GMT
These are the *original* specifications for dcc. DCC is inherently a
feature of ircII, and any implementation had best be able to deal
with DCC as currently implemented in ircII at this time.
This is over two years old, so it is somewhat out of date, but the
mechanism for dcc is still pretty much the same, but the implementation
has evolved over time.
------ snip here -----
A description of the DCC protocol
=================================
By Troy Rollo (troy at plod.cbme.unsw.oz.au)
(In response for requests for the protocol to be
documented).
The first comment I should make is that the DCC protocol
was never designed to be portable to clients other than IRCII.
As such I take no responsibility for it being difficult to
implement for other clients.
Why DCC?
========
DCC allows the user to overcome some limitations
of the IRC server network and to have the ultimate in secure
chat connections while still in an IRC oriented protocol.
DCC uses direct TCP connections between the clients
taking part to carry data. There is no flood control, so
packets can be sent at full speed, and there is no
dependance on server links (or load imposed on them). In
addition, since only the initial handshake for DCC conections
is passed through the IRC network, it is impossible for
Operators with cracked servers to spy on DCC messages.
How?
====
The initial socket for a DCC connection is created
by the side that initiates (Offers) the connection. This socket
should be a TCP socket bound to INADDR_ANY, listening for
connections.
The Initiating client, on creating the socket, should
send its details to the target client using the CTCP command
DCC. This command takes the form:
DCC type argument address port
type - The connection type
argument - The connectin type dependant argument
address - the host address of the initiator as an integer.
port - the port or the socket on which the initiator expects
to receive the connection.
The address and port should be sent as ascii representations of the
decimal integer formed by converting the values to host byte order
and treating them as an unsigned long and unsigned short respectively.
The following DCC connection types are known to IRCII:
Type Purpose Argument
CHAT To carry a secure conversation the string "chat"
SEND To send a file to the recipient the file name
In addition, the following are included in the IRCII DCC command,
although they do not transmit a DCC request via IRC:
TALK Establishes a TALK connection
Implementation
==============
The CHAT and SEND connection types should not be
accepted automatically as this would create the potential for
terrorism. Instead, they should notify the user that an
offer has been made, and allow the user to accept it.
The recipient should have the opportunity to rename
a file send with the DCC SEND command prior to retrieving
it.
The following are the steps which should occur in
the clients:
Initiator:
DCC command issued.
Create a socket, bind it to INADDR_ANY, port 0, and
make it passive (a listening socket).
Send the recipient a DCC request via CTCP supplying
the address and port of the socket. (This
is ideally taken from the address of the local
side of the socket which is connected to a
server. This is presumably the interface on
the host which is closest to the rest of
the net, and results in one less routing hop
in the case of gateway nodes).
Continue normally until a connection is received.
On a connection:
Accept the connection.
Close the original passive socket.
Conduct transaction on the new socket.
Acceptor:
CTCP DCC request received.
Record information on the DCC request and notify the user.
At this point, the USER should be able to abort (close) the
request, or accept it. The request should be accepted with
a command specifying the sender, type, and argument, or
a subset of these where no ambiguity exists.
If accepted, create a TCP socket.
Connect the new socket to the address and port supplied.
Conduct the transaction over the socket.
Type specific details.
======================
CHAT Data sent across a CHAT connection should be sent line-by-line
without any prefixes or commands. A CHAT connection ends when
one party issues the DCC CLOSE command to their clients, which
causes the socket to be closed and the information on the connection
to be discarded.
FILE Data is sent in packets, rather than dumped in a stream manner.
This allows the DCC SEND connection to survive where an FTP
connection might fail. The size of the packets is up to the
client, and may be set by the user. Smaller packets result
in a higher probability of survival over bad links.
The recipient should acknowledge each packet by transmitting
the total number of bytes received as an unsigned, 4 byte
integer in network byte order. The sender should not continue
to transmit until the recipient has acknowledged all data
already transmitted. Additionally, the sender should not
close the connection until the last byte has been
acknowledged by the recipient.
Note that it is not possible for the recipient to tell if the
entire file has been received - only the sender has that
information, although IRCII does not report it. Users generally
verify the transfer by checking file sizes.
Note also that no provision is made for text translation.
The block size used by IRCII is BIG_BUFFER_SIZE (1024).
This should probably be reviewed and reduced.
--- NEW FILE: ctcp.doc ---
>From frechett at ucsu.Colorado.EDU Fri Jul 17 15:56:07 1992
To: hrose at eff.org
Subject: CTCP stuff..
Date: Mon, 13 Jul 92 09:48:54 -0600
From: frechett at ucsu.Colorado.EDU
X-Mts: smtp
------- Forwarded Message
>From owner-irc-dev at coke.CS.Berkeley.EDU Tue May 19 20:50:56 1992
Received: from coke.CS.Berkeley.EDU by ucsu.Colorado.EDU with SMTP id AA10565
(5.65c+/IDA-1.4.4/CNS-2.1 for <frechett at ucsu.Colorado.EDU>); Tue, 19 May 1992 11:05:19 -0600
Received: by coke.CS.Berkeley.EDU (5.65/1.43)
id AA04019; Tue, 19 May 92 09:52:06 -0700
Received: from sunic.sunet.se by coke.CS.Berkeley.EDU (5.65/1.43)
id AA04014; Tue, 19 May 92 09:51:38 -0700
Received: from Minsk.DoCS.UU.SE by sunic.sunet.se (5.65c8/1.25)
id AA26625; Tue, 19 May 1992 18:50:59 +0200
Received: by Minsk.DoCS.UU.SE (Sun-4/630, SunOS 4.1.2)
with sendmail 5.61-bind 1.5+ida/ICU/DoCS id AA14442; Tue, 19 May 92 18:50:56 +0200
Date: Tue, 19 May 92 18:50:56 +0200
From: Klaus Zeuge <sojge at Minsk.DoCS.UU.SE>
Message-Id: <9205191650.AA14442 at Minsk.DoCS.UU.SE>
X-Zippy-Proclaims: I hope I bought the right relish... zzzzzzzzz...
X-Dogma: 36 >> 32
X-Last-Band-Seen: Beagle at Barowiak in Uppsala, Sweden, 920409.
X-Mini-Review: Pretty nice, FUNNY.
To: irc-dev at coke.CS.Berkeley.EDU
Subject: CTCP -- please comment
Sometime in the fall last year I started writing on a paper to
summerize the usage of CTCP (client to client protocoll), quoting etc.
This is it.
It needs proofreading, and suggestions about what's good and bad. It's
not complete either.
Maybe it's a start.
- -----------------------------------------------------------------------------
sojge at docs.uu.se Sun Oct 27 17:27:59 1991 -*-Text-*-
The client-to-client protocol (CTCP) *13*
This client-to-client protocol is meant to be used as a way to
1/ in general send structered data (such as graphics,
voice and different font information) between users
clients, and in a more specific case
2/ place a query to a users client and getting an answer.
As of now, only a simple text encryption scheme is implemented in
category 1, and a few query/reply pairs in category 2. This paper will
concentrate on the latter category.
*****************************************
BASIC PROTOCOL BETWEEN CLIENTS AND SERVER
*****************************************
Characters between client and server are 8 bit bytes (also known as
octets) and can have nummeric values from octal 0 up to 0377 inclusive
(0 up to 255 decimal). Some characters are special.
CHARS ::= '\000' .. '\377'
NUL ::= '\000'
NL ::= '\n'
CR ::= '\r'
A line sent to a server, or received from a server (here called "low
level messages") consist or zero or more octets (expcept NUL, NL or
CR) with either a NL or CR appended.
L-CHARS ::= '\001' .. '\011' | '\013' | '\014' |
'\016' .. '\377'
L-LINE ::= L-CHARS* CR LF
A NUL is never sent over to the server.
*****************
LOW LEVEL QUOTING
*****************
As messages to and from servers can't contain NUL, NL and CR, but it
still might be desirable to send ANY character (in so called "middle
level messages") between clients, those three characters have to be
quoted. Therefor a quote character is needed. Of course, the quote
character itself has to be quoted too.
M-QUOTE ::= '\020'
(Ie a CNTRL/P).
When sending a middle level message, if finding a character being one
of NUL, NL, CR or M-QUOTE, that character is replaced by a two
character sequence according to the following table.
NUL --> M-QUOTE '0'
NL --> M-QUOTE 'n'
CR --> M-QUOTE 'r'
M-QUOTE --> M-QUOTE M-QUOTE
When receiving a low level message, and seeing a M-QUOTE, look at the
next character, and replace those two according to the following table
to get the corresponding middle level message.
M-QUOTE '0' --> NUL
M-QUOTE 'n' --> NL
M-QUOTE 'r' --> CR
M-QUOTE M-QUOTE --> M-QUOTE
If the character following M-QUOTE isn't any of the listed characters,
that is an error, so drop the M-QUOTE character from the message,
optionally warning the user about it. Ie, a string 'x' M-QUOTE 'y' 'z'
>from a server dequotes into 'x 'y' 'z'.
Before low level quoting, a message to the server (and in the opposite
direction: after low level dequoting, a message from the server) looks
like
M-LINE ::= CHARS*
***********
TAGGED DATA
***********
To send both extended data and query/reply pairs between clients, an
extended data format is needed. The extended data are sent in the text
part of a middle level message (and efter low level quoting of course
also in the text part of the low level message).
To send extended data inside the text, we need some way to delimit it.
This is done by starting and ending extended data with a delimiter
character.
X-DELIM ::= '\001'
As both the starting and ending delimiter looks the same, every second
X-DELIM is called the odd, and every second the even delimiter. The
first one in a message is odd.
When having being quoted (and conversly, before having been dequoted)
any number of characters of any kind except X-DELIM can be used in the
extended data, ie inside the X-DELIM pair.
X-CHR ::= '\000' | '\002' .. '\377'
An extended message is either empty (ie nothing between the odd and
even delimiter), has one or more non-space characters (ie any
character but '\040') or has one or more non-space characters followed
by a space followed by zero or more characters.
X-N-AS ::= '\000' | '\002' .. '\037' | '\041' .. '\377'
SPC ::= '\040'
X-MSG ::= | X-N-AS+ | X-N-AS+ SPC X-CHR*
The first characters up until the first SPC (or if no SPC, all of the
X-MSG) is called the tag of the extended message. The tag is used to
know what kind of extended data is used.
The tag can be *any* strings of characters and if the happen to be
letters, they are case sensitive, so upper and lower case matters.
Extended data is only valid in PRIVMSG and NOTICE commands. If the
extended data is a reply to a query, it is sent in a NOTICE, else it
is sent in a PRIVMSG. Both PRIVMSG and NOTICE to a user and to a
channel may contain extended data.
The text part of a PRIVMSG or NOTICE might contain zero or more
extended messages, intermixed with zero or more chunks of non-extended
data.
******************
CTCP LEVEL QUOTING
******************
In order to be able to send the delimiter X-DELIM inside an extended
data message, it has to be quoted. This introduces another quote
character (which should differ from the low level quote character so
it won't have to be quoted yet again).
X-QUOTE ::= '\134'
(Ie a back slash).
When quoting on the CTCP level, only actual CTCP message (ie extended
data, queries, replies) are quoted. This enables users to actually
send X-QUOTE characters at will. The following translations should be
used
X-DELIM --> X-QUOTE 'a'
X-QUOTE --> X-QUOTE X-QUOTE
and when dequoting on the CTCP level, only CTCP messages are dequoted
whereby the following table is used.
X-QUOTE 'a' --> X-DELIM
X-QUOTE X-QUOTE --> X-QUOTE
If a X-QUOTE is seen with another the character following it than the
ones above, that's an error and the X-QUOTE character should be
dropped. Ie the CTCP-quoted string 'x' X-QUOTE 'y' 'z' becomes after
dequoting the three character string 'x' 'y' 'z'.
If a X-DELIM is found outside a CTCP message, the message will contain
the X-DELIM. (This should only happen with the last X-DELIM when there
are an odd number of X-DELIM's in a middle level message.
***************
QUTING EXAMPLES
***************
There are basically three levels of messages. The highest level (H) is
the text on the user-to-client level. The middle layer (M) is on the
level where CTCP quoting has been applied to the H-level message. The
lowest level (L) is on the client-to-server level, where low level
quoting has been applied to the M-level message.
The following relations are true, with lowQuote(message) being a
function doing the low level quoting, lowDequote(message) the low
level dequoting, ctcpQuote(message) the CTCP level quoting,
ctcpDequote(message) the CTCP level dequoting, and
ctcpExtract(message) the removing of all CTCP messages from a message.
The operator || denotes string concatenation.
L = lowQuote(M)
M = ctcpDequote(L)
M = ctcpQuote(H)
H = ctcpDequote(ctcpExtract(M))
When sending CTCP message imbedded in normal text
M = ctcpQuote(H1) || '\001' || ctcpQuote(X) || '\001' || ctcpQuote(H2)
Of course, there might be zero or more normal text messages and zero
or more CTCP messages mixed.
- --- Example 1 -----------------------------------------------------------------
A user (called actor) wanting to send the string
Hi there!\nHow are you?
to user victim, ie a message where the user has entered an inline
newline (how this is done, if at all, differs from client to client),
will result internaly in the client in the command
PRIVMSG victim :Hi there!\nHow are you? \K?
which will be CTCP quoted into
PRIVMSG victim :Hi there!\nHow are you? \\K?
which in turn will be low level quoted into
PRIVMSG victim :Hi there!\020nHow are you? \\K?
and sent to the server after appending a newline at the end.
This will arrive on victim's side as
:actor PRIVMSG victim :Hi there!\020nHow are you? \\K?
(where the \\K would look similar to OK in SIS D47 et al) which after
low level dequoting becomes
:actor PRIVMSG victim :Hi there!\nHow are you? \\K?
and after CTCP dequoting
:actom PRIVMSG victim :Hi there!\nHow are you? \K?
How this is displayed differs from client to client, but it suggested
that a line break should occour between the words "there" and "How".
- --- Example 2 -----------------------------------------------------------------
If actor's client wants to send the string "Emacs wins" this might
become the string "\n\t\big\020\001\000\\:" when being
SED-encrypted using some key, so the client starts by CTCP-quoting
this string into the string "\n\t\big\020\\a\000\\\\:" and
builds the M-level command
PRIVMSG victim :\001SED \n\t\big\020\\a\000\\\\:\001
which after low level quoting becomes
PRIVMSG victim :\001SED \020n\t\big\020\020\\a\0200\\\\:\001
which will be sent to the server, with a newline tacked on.
On victim's side, the string
:actor PRIVMSG victim :\001SED \020n\t\big\020\020\\a\0200\\\\:\001
will be received from the server and low level dequoted into
:actor PRIVMSG victim :\001SED \n\t\big\020\\a\000\\\\:\001
whereafter the string "\n\t\big\020\\a\000\\\\:" will be extracted
and first CTCP dequoted into "\n\t\big\020\001\000\\:" and then
SED decoded getting back "Emacs wins" when using the same key.
- --- Example 3 -----------------------------------------------------------------
If the user actor want's to query the USERINFO of user victim, and is
in the middle of a conversation, the client may decide to tack on
USERINFO request on a normal text message. Then the client wants to
send the textmessage "Say hi to Ron\n\t/actor" and the CTCP request
"USERINFO" to victim.
PRIVMSG victim :Say hi to Ron\n\t/actor
plus
USERINFO
which after CTCP quoting become
PRIVMSG victim :Say hi to Ron\n\t/actor
plus
USERINFO
which gets merged into
PRIVMSG victim :Say hi to Ron\n\t/actor\001USERINFO\001
and after low level quoting
PRIVMSG victim :Say hi to Ron\020n\t/actor\001USERINFO\001
and sent off to the server.
On victim's side, the message
:actor PRIVMSG victim :Say hi to Ron\020n\t/actor\001USERINFO\001
arrives. This gets low level dequoted into
:actor PRIVMSG victim :Say hi to Ron\n\t/actor\001USERINFO\001
and thereafter split up into
:actor PRIVMSG victim :Say hi to Ron\n\t/actor
plus
USERINFO
After CTCP dequoting both, the message
:actor PRiVMSG victim :Say hi to Ron\n\t/actor
gets displayed, while the CTCP command
USERINFO
gets replied to. The reply might be
USERINFO :CS student\n\001test\001
which gets CTCP quoted into
USERINFO :CS student\n\\atest\\a
and sent in a NOTICE as it is a reply:
NOTICE actor :\001USERINFO :CS student\n\\atest\\a\001
and low level quoted into
NOTICE actor :\001USERINFO :CS student\020n\\atest\\a\001
after which is it sent to victim's server.
When arriving on actor's side, the message
:victim NOTICE actor :\001USERINFO :CS student\020n\\atest\\a\001
gets low level dequoted into
:victim NOTICE actor :\001USERINFO :CS student\n\\atest\\a\001
At this point, all CTCP replies get extracted, giving 1 CTCP reply and
no normal NOTICE
USERINFO :CS student\n\\atest\\a
The remaining reply gets CTCP dequoted into
USERINFO :CS student\n\001test\001
and presumly displayed to user actor.
*******************
KNOWN EXTENDED DATA
*******************
<To be written by msa? Should include something about X-DELIM X-DELIM,
ie CTCP message with empty tag, should translate into just X-DELIM in
message.>
*************************
KNOWN REQUEST/REPLY PAIRS
*************************
A request/reply pair is sent between the two clients in two phases.
The first phase is to send the request. This is done with a "privmsg"
command (either to a nick or to a channel -- it doesn't matter).
The second phase is to send a reply. This is done with a "notice"
command.
The known request/reply pairs are for the following commands.
CLIENTINFO - Dynamic master index of what a client knows
ERRMSG - Used when an error needs to be replied with
FINGER - Mainly used to get a users idle time
USERINFO - A string set by the user (never client coder)
VERSION - The version and type of the client
FINGER
This is used to get some data stored locally at a users system about
the user and also the idle time of the user. The request is in a
"privmsg" and looks like
\001FINGER\001
while the reply is in a "notice" and looks like
\001FINGER :#\001
where the # denotes contains information about the users real name,
login name at clientmachine and idle time and is of type X-N-AS.
VERSION
This is used to get information about the name of the other client and
the version of it. The request in a "privmsg" is simply
\001VERSION\001
and the reply
\001VERSION #:#:#\001
where the first # denotes the name of the client, the second # denotes
the version of the client, the third # the enviroment the client is
running in.
Using
X-N-CLN ::= '\000' .. '\071' | '\073' .. '\377'
the client name is a string of type X-N-CLN saying things like "Kiwi"
or "ircII", the version saying things like "5.2" or "2.1.5c", the
enviroment saying things like "GNU Emacs 18.57.19 under SunOS 4.1.1 on
Sun SLC" or "Compiled with gcc -ansi under Ultrix 4.0 on VAX-11/730".
SOURCE
This is used to get information about where to get a copy of the
client. The request in a "privmsg" is simply
\001SOURCE\001
and the reply is zero or more CTCP replies of the form
\001SOURCE #:#:#\001
followed by an end marker
\001SOURCE\001
where the first # is the name of an Internet host where the client can
be gotten from with anonymous FTP the second # a directory names, and
the third # a space separated list of files to be gotten from that
directory.
Using
X-N-SPC ::= '\000' .. '\037' | '\041' .. '\377'
the name of the FTP site is to be given by name like "cs.bu.edu" or
"funic.funet.fi".
The file name field is a directory specification optionally followed
by one or more file names, delimited by spaces. If only a directory
name is given, all files in that directory should be copied when
retrieving the clients source. If some files are given, only those
files in that directpry should be copied. Note that the spcification
allows for all characters but space in the names, this includes
allowing :. Examples are "pub/emacs/irc/" to get all files in
directory pub/emacs/irc/, the client should be able to first login as
user "ftp" and the give the command "CD pub/emacs/irc/", followed by
the command "mget *". (It of course has to take care of binary and
prompt mode too). Another example is "/pub/irc Kiwi.5.2.el.Z" in which
case a "CD /pub/irc" and "get Kiwi.5.2.el.Z" is what should be done.
USERINFO
This is used to transmit a string which is settable by the user (and
never should be set by the client). The query is simply
\001USERINFO\001
with the reply
\001USERINFO :#\001
where the # is the value of the string the client's user has set.
CLIENTINFO
This is for client developers use to make it easier to show other
client hackers what a certain client knows when it comes to CTCP. The
replies should be fairly verbose explaining what CTCP commands are
understood, what arguments are expected of what type, and what replies
might be expected from the client.
The query is the word CLIENTINFO in a "privmsg" optionally followed by
a colon and one or more specifying words delimited by spaces, where
the word CLIENTINFO by itself,
\001CLIENTINFO\001
should be replied to by giving a list of known tags (see above in
section TAGGED DATA). This is only intended to be read by humans.
With one argument, the reply should be a description of how to use
that tag. With two arguments, a description of how to use that
tag's subcommand. And so on.
ERRMSG
This is used as a reply whenever an unknown query is seen. Also, when
used as a query, the reply should echo back the text in the query,
together with an indication that no error has happened. Should the
query form be used, it is
\001ERRMSG #\001
where # is a string containing any character, with the reply
\001ERRMSG # :#\001
where the first # is the same string as in the query and the second #
a short text notifying the user that no error has occurred.
A normal ERRMSG reply which is sent when a corrupted query or some
corrupted extended data is received, looks like
\001ERRMSG # :#\001
where the first # is the the failed query or corrupted extended data
and the second # a text explaining what the problem is, like "unknown
query" or "failed decrypting text".
********
EXAMPLES
********
Sending
PRIVMSG victim :\001FINGER\001
might return
:victim NOTICE actor :\001FINGER :Please check my USERINFO
instead :Klaus Zeuge (sojge at mizar) 1 second has passed since
victim gave a command last.\001
(this is only one line) or why not
:victim NOTICE actor :\001FINGER :Please check my USERINFO
instead :Klaus Zeuge (sojge at mizar) 427 seconds (7 minutes and
7 seconds) have passed since victim gave a command last.\001
if Klaus Zeuge happens to be lazy? :-)
Sending
PRIVMSG victim :CLIENTINFO
might return
:victim NOTICE actor :CLIENTINFO :You can request help of the
commands CLIENTINFO ERRMSG FINGER USERINFO VERSION by giving
an argument to CLIENTINFO.
Sending
PRIVMSG victim :CLIENTINFO CLIENTINFO
might return
:victim NOTICE actor :CLIENTINFO :CLIENTINFO with 0
arguments gives a list of known client query keywords. With 1
argument, a description of the client query keyword is
returned.
while sending
PRIVMSG victim :clientinfo clientinfo
probaly will return something like
:victim NOTICE actor :ERRMSG clientinfo clientinfo :Query is
unknown
as tag "clientinfo" isn't known.
Sending
PRIVMSG victim :CLIENTINFO ERRMSG
might return
:victim NOTICE actor :CLIENTINFO :ERRMSG is the given answer
on seeing an unknown keyword. When seeing the keyword ERRMSG,
it works like an echo.
Sending
PRIVMSG victim :\001USERINFO\001
might return the somewhat pathetically long
:victim NOTICE actor :USERINFO :I'm studying computer
science in Uppsala, I'm male (somehow, that seems to be an
important matter on IRC:-) and I speak fluent swedish, decent
german, and some english.
Sending
PRIVMSG victim :\001VERSION\001
might return
:victim NOTICE actor :\001VERSION Kiwi:5.2:GNU Emacs
18.57.19 under SunOS 4.1.1 on Sun
SLC:FTP.Lysator.LiU.SE:/pub/emacs Kiwi-5.2.el.Z
Kiwi.README\001
if the client is named Kiwi of version 5.2 and is used under GNU Emacs
18.57.19 running on a Sun SLCwith SunOS 4.1.1. The client claims a
copy of it can be found with anonymous FTP on FTP.Lysator.LiU.SE after
giving the FTP command "cd /pub/emacs/". There, one should get files
Kiwi-5.2.el.Z and Kiwi.README; presumly one of the files tells how to
proceed with building the client after having gotten the files.
- -----------------------------------------------------------------------------
End of file.
------- End of Forwarded Message
--- NEW FILE: announce ---
FOR RELEASE NOVEMBER 11, 1994 --
TINYIRC VERSION 1.0 IS NOW AVAILABLE!
Tinyirc was developed on SunOS 4.1.3, and has been verified
compatable with hpux, linux 1.3.51, AIX, DYNIX, and will probably
run on many other platforms using one of the make options.
it is available via anonymous ftp to ftp.netcom.com
in /pub/Linux/tinyirc-1.0.tar.gz this tar file is 13k
because it includes the GNU public licence.
PLEASE NOTE- The termcap-based version of tinyirc has fewer
features than the curses-based version, and development will
continue in this direction. If you want to use the curses
version of tinyirc, I highly recommend installing ncurses
on your system and linking with it. ncurses is available
on ftp.netcom.com /pub/zmbenhal/ncurses
ncurses routines may be integrated into tinyirc sometime
in the future and the termcap version dropped (next version?)
Here's what's been added since tinyirc-pre1.0
-----------------------------------------------------------------
Configuration options moved into Makefile
Curses is used on systems where termcap is not available
Large speed improvements on hpux and aix (with curses)
Output of "/MSG" resembles IrcII instead of raw data
Tokinization of server input no longer trashes spaces
Word wrap algorithm fixes (for long lines without spaces)
Environment variable IRCSERVER compatable with IrcII defs
Cosmetic changes to status line, channel mode added
"/MODE" now allows unlimited parameters instead of only 1
"/JOIN user" makes default object a user
"/PART user" removes user from object list
Suspending, Backgrounding and Foregrounding is supported
Curses version able to restore screen completely
Scrollback in curses version (PageUp/PageDown, C-u/C-v)
Arrow keys supported by curses version (when available)
More bug fixes.
Here's what's been added since version 0.4 of tinyirc.c
-----------------------------------------------------------------
Support for 2.8.x servers
SUPPORT FOR OLDER SERVERS REMOVED!
Configurable command line history
Emacs-style command line editing
^W channel switching
"/JOIN" can be used to set the default channel
"/MSG" is supported
"/NOTICE" is fixed
command completion ("/QU" = "/QUIT", etc)
full screen mode optimized to use entire display
highly-optimized input line. Only updates what is needed
cursor properly tracks input position in full screen mode
And hundreds of other enhancements and bug fixes too
numerous to mention!
-----------------------------------------------------------------
Grab your copy today and test it out! Send me a little note
letting me know how much you like tinyirc so that I'll be
motivated to keep enhancing it. If you have trouble getting
it to work, please send me email. If you do not know what
a .tar.gz file is, please read the newsgroup news.answers and
look for the Unix FAQ.
-- nathan laredo, laredo at gnu.ai.mit.edu
--- NEW FILE: Makefile ---
# tinyirc makefile
# by Nathan Laredo
#
# I don't wish to assert any rights (copyright) over this makefile
# but please give me credit if you use my code.
#
SERVER = irc.linpeople.org
PORT = 7000
#
all:
## Please use "make target"
## where target is one of the following
##
## aix hpux gnu posix generic debug
##
## If you have trouble with the input line, try a different target
debug:
$(MAKE) tinyirc CFLAGS=-g LDFLAGS=-g CC=gcc LIBS=-ltermcap
generic:
$(MAKE) tinyirc CFLAGS=-O LDFLAGS=-s LIBS=-ltermcap
aix:
$(MAKE) tinyirccv CFLAGS="-O -D_AIX_" \
LDFLAGS=-s LIBS=-lcurses CC=bsdcc
posix:
$(MAKE) tinyirc CFLAGS="-O2 -m486 -DPOSIX" LDFLAGS="-s" LIBS=-ltermcap
gnu:
$(MAKE) tinyirc CFLAGS="-O2 -pipe -DPOSIX -Wall -Wunused -Wformat" \
LDFLAGS=-s LIBS=-ltermcap CC=gcc
hpux:
$(MAKE) tinyirccv LDFLAGS=-s LIBS=-lcurses
ntest:
$(MAKE) tinyirccv CFLAGS="-O -I/usr/include/ncurses -DPOSIX" \
LDFLAGS="-L/usr/local/lib" LIBS=-lncurses CC=gcc
ctest:
$(MAKE) tinyirccv CFLAGS=-O LDFLAGS=-s LIBS=-lcurses
DEFINES = -DDEFAULTSERVER=\"$(SERVER)\" -DDEFAULTPORT=$(PORT)
tinyirc: tinyirc.o
$(CC) $(LDFLAGS) -o tinyirc tinyirc.o $(LIBS)
tinyirccv: tinyirccv.o
$(CC) $(LDFLAGS) -o tinyirc tinyirccv.o $(LIBS)
tinyirc.o: tinyirc.c Makefile
$(CC) $(CFLAGS) $(DEFINES) -c tinyirc.c -o tinyirc.o
tinyirccv.o: tinyirccv.c Makefile
$(CC) $(CFLAGS) $(DEFINES) -c tinyirccv.c -o tinyirccv.o
#EOF
--- NEW FILE: tinyircd.c ---
#define RELEASE "tinyircd 0.1"
/* tinyircd 0.1
Copyright (C) 1996 Nathan I. Laredo
This program is modifiable/redistributable under the terms
of the GNU General Public Licence.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Send your comments and all your spare pocket change to
laredo at gnu.ai.mit.edu (Nathan Laredo) or to PSC1, BOX 709,
Lackland AFB, TX, 78236-5128
*/
#include <stdio.h>
#ifndef POSIX
#include <sgtty.h>
#define USE_OLD_TTY
#include <sys/ioctl.h>
#if !defined(sun) && !defined(sequent) && !defined(__hpux) && \
!defined(_AIX_)
#include <strings.h>
#define strchr index
#else
#include <string.h>
#endif
#else
#include <string.h>
#include <termios.h>
#endif
#include <pwd.h>
#include <ctype.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/file.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <signal.h>
#include <utmp.h>
#define ischan(x) (*x == '#' || *x == '&' || *x == '+')
/* global structures */
struct channel_list {
char *name;
char *users;
char *modes;
char *banlist;
char *moderators;
time_t creation;
struct channel_list *next;
};
struct user_list {
char *nick;
char *logname;
char *loghost;
char *realname;
char *mode;
time_t creation;
int hopcount;
};
/*************************************************************/
int my_stricmp(str1, str2)
char *str1, *str2;
{
int cmp;
while (*str1 != 0 && str2 != 0) {
if (isalpha(*str1) && isalpha(*str2)) {
cmp = *str1 ^ *str2;
if ((cmp != 32) && (cmp != 0))
return (*str1 - *str2);
} else {
if (*str1 != *str2)
return (*str1 - *str2);
}
str1++;
str2++;
}
return (*str1 - *str2);
}
int makeconnect(hostname)
char *hostname;
{
struct sockaddr_in sa;
struct hostent *hp;
int s, t;
if ((hp = gethostbyname(hostname)) == NULL)
return -1;
for (t = 0, s = -1; s < 0 && hp->h_addr_list[t] != NULL; t++) {
bzero(&sa, sizeof(sa));
bcopy(hp->h_addr_list[t], (char *) &sa.sin_addr, hp->h_length);
sa.sin_family = hp->h_addrtype;
sa.sin_port = htons((unsigned short) IRCPORT);
s = socket(hp->h_addrtype, SOCK_STREAM, 0);
if (s > 0)
if (connect(s, (struct sockaddr *) &sa, sizeof(sa)) < 0) {
close(s);
s = -1;
} else {
fcntl(s, F_SETFL, O_NDELAY);
my_tcp = s;
sprintf(lineout, "NICK :%s\n", IRCNAME);
sendline();
sprintf(lineout, "USER %s * * :%s\n", IRCLOGIN, IRCGECOS);
sendline();
}
}
return s;
}
main(argc, argv)
int argc;
char **argv;
{
int i = 0;
printf("%s Copyright (C) 1991-1996 Nathan Laredo\n\
This is free software with ABSOLUTELY NO WARRANTY.\n\
For details please see the file COPYING.\n", RELEASE);
if (!(tmp = (char *) getenv("IRCSERVER")))
strcpy(hostname, DEFAULTSERVER);
else {
while (*tmp && *tmp != ':')
hostname[i++] = *(tmp++);
hostname[i] = '\0';
if (*tmp == ':')
IRCPORT = (unsigned short) atoi(++tmp);
}
if (argc > 1) {
for (i = 1; i < argc; i++)
if (argv[i][0] == '-') {
if (argv[i][1] == 'd')
dumb = 1;
else {
fprintf(stderr, "usage: %s %s\n", argv[0],
"[nick] [server] [port] [-dumb]");
exit(1);
}
} else if (strchr(argv[i], '.'))
strcpy(hostname, argv[i]);
else if (atoi(argv[i]) > 255)
IRCPORT = atoi(argv[i]);
else
strncpy(IRCNAME, argv[i], sizeof(IRCNAME));
}
if ((my_tty = open("/dev/tty", O_RDWR, 0)) == -1)
my_tty = fileno(stdin);
IRCGECOS[i = 63] = 0;
if (!getpeername(my_tty, IRCGECOS, &i)) { /* inetd */
strcpy(IRCNAME, IRCGECOS);
strcpy(IRCLOGIN, "fromident");
setenv("TERM", "vt102", 1);
} else {
userinfo = getpwuid(getuid());
tmp = (char *) getenv("IRCNICK");
if (tmp == NULL)
strncpy(IRCNAME, userinfo->pw_name, sizeof(IRCNAME));
else
strncpy(IRCNAME, tmp, sizeof(IRCNAME));
strcpy(IRCLOGIN, userinfo->pw_name);
setutent();
strcpy(ut.ut_line, strrchr(ttyname(0), '/') + 1);
if ((utmp = getutline(&ut)) == NULL || !(utmp->ut_addr) ||
*((char *) utmp->ut_host) == ':' /* X connection */ )
tmp = userinfo->pw_gecos;
else {
struct hostent *h;
struct in_addr a;
a.s_addr = utmp->ut_addr;
if (!(h = gethostbyaddr((char *) &a.s_addr,
sizeof(a.s_addr), AF_INET)))
tmp = (char *) inet_ntoa(a);
else
tmp = (char *) h->h_name;
}
strcpy(IRCGECOS, tmp);
endutent();
}
fprintf(stderr, "*** User is %s\n", IRCGECOS);
printf("*** trying port %d of %s\n\n", IRCPORT, hostname);
if (makeconnect(hostname) < 0) {
fprintf(stderr, "*** %s refused connection, aborting\n", hostname);
exit(0);
}
idletimer = time(NULL);
ptr = termcap;
if ((term = (char *) getenv("TERM")) == NULL) {
fprintf(stderr, "tinyirc: TERM not set\n");
exit(1);
}
if (tgetent(bp, term) < 1) {
fprintf(stderr, "tinyirc: no termcap entry for %s\n", term);
exit(1);
}
if ((CO = tgetnum("co") - 2) < 20)
CO = 78;
if ((LI = tgetnum("li")) == -1)
LI = 24;
if (!dumb) {
#define tgs(x) ((char *) tgetstr(x, &ptr))
if ((CM = tgs("cm")) == NULL)
CM = tgs("CM");
if ((SO = tgs("so")) == NULL)
SO = "";
if ((SE = tgs("se")) == NULL)
SE = "";
if (!CM || !(CS = tgs("cs")) ||
!(CE = tgs("ce"))) {
printf("tinyirc: sorry, no termcap cm,cs,ce: dumb mode set\n");
dumb = 1;
}
if (!dumb) {
DC = tgs("dc");
savetty();
raw();
#ifdef CURSES
nonl();
noecho();
#endif
}
}
redraw();
signal(SIGINT, cleanup);
signal(SIGHUP, cleanup);
signal(SIGTERM, cleanup);
signal(SIGSEGV, cleanup);
signal(SIGTTIN, stopin);
for (i = 0; i < HISTLEN; i++)
hist[i] = (char *) calloc(512, sizeof(char));
linein = hist[hline = 0];
while (sok) {
FD_ZERO(&readfs);
FD_SET(my_tcp, &readfs);
if (!noinput)
FD_SET(my_tty, &readfs);
if (!dumb) {
timeout.tv_sec = 61;
timeout.tv_usec = 0;
}
if (select(FD_SETSIZE, &readfs, NULL, NULL, (dumb ? NULL : &timeout))) {
if (FD_ISSET(my_tty, &readfs))
userinput();
if (FD_ISSET(my_tcp, &readfs))
sok = serverinput();
if (!wasdate)
updatestatus();
} else
updatestatus();
if (!sok && reconnect) {
close(my_tcp); /* dead socket */
printf("*** trying port %d of %s\n\n", IRCPORT, hostname);
if (makeconnect(hostname) < 0) {
fprintf(stderr, "*** %s refused connection\n", hostname);
exit(0);
}
sok++;
}
if (!dumb)
tputs_x(tgoto(CM, curx % CO, LI - 1));
fflush(stdout);
}
if (!dumb) {
tputs_x(tgoto(CS, -1, -1));
tputs_x(tgoto(CM, 0, LI - 1));
#ifdef CURSES
echo();
nl();
#endif
resetty();
}
exit(0);
}
/* EOF */
--- NEW FILE: tinyirc.c ---
#undef AUTOJOIN "JOIN :#linuxcon\n"
#define COMMANDCHAR '/'
#define ASCIIHEXCHAR '@'
#define HEXASCIICHAR '#'
#define USE_ANSICOLOR
/* each line of hist adds 512 bytes to resident size */
#define HISTLEN 8
#ifdef AUTOJOIN
#define RELEASE "TinyIRC 1.1 LinuxConv Edition"
#else
#define RELEASE "TinyIRC 1.1"
#endif
/* most bytes to try to read from server at one time */
#define IB_SIZE 4096
/* TinyIRC 1.1
Copyright (C) 1991-1996 Nathan I. Laredo
This program is modifiable/redistributable under the terms
of the GNU General Public Licence.
[...1035 lines suppressed...]
exit(0);
}
sok++;
}
if (!dumb)
tputs_x(tgoto(CM, curx % CO, LI - 1));
fflush(stdout);
}
if (!dumb) {
tputs_x(tgoto(CS, -1, -1));
tputs_x(tgoto(CM, 0, LI - 1));
#ifdef CURSES
echo();
nl();
#endif
resetty();
}
exit(0);
}
/* EOF */
More information about the dslinux-commit
mailing list