mirror of
https://github.com/osmarks/ngircd.git
synced 2024-12-12 09:50:29 +00:00
- neue Befehle PRIVMSG, NOTICE, PING.
This commit is contained in:
parent
15764f9846
commit
72ebf4f260
@ -9,11 +9,14 @@
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: irc.c,v 1.11 2001/12/27 16:55:41 alex Exp $
|
||||
* $Id: irc.c,v 1.12 2001/12/27 19:17:26 alex Exp $
|
||||
*
|
||||
* irc.c: IRC-Befehle
|
||||
*
|
||||
* $Log: irc.c,v $
|
||||
* Revision 1.12 2001/12/27 19:17:26 alex
|
||||
* - neue Befehle PRIVMSG, NOTICE, PING.
|
||||
*
|
||||
* Revision 1.11 2001/12/27 16:55:41 alex
|
||||
* - neu: IRC_WriteStrRelated(), Aenderungen auch in IRC_WriteStrClient().
|
||||
*
|
||||
@ -169,6 +172,7 @@ GLOBAL BOOLEAN IRC_NICK( CLIENT *Client, REQUEST *Req )
|
||||
if( Client->type == CLIENT_USER )
|
||||
{
|
||||
/* Nick-Aenderung: allen mitteilen! */
|
||||
Log( LOG_INFO, "User \"%s!%s@%s\" (%s) changed nick: \"%s\" -> \"%s\".", Client->nick, Client->user, Client->host, Client->name, Client->nick, Req->argv[0] );
|
||||
IRC_WriteStrRelated( Client, "NICK :%s", Req->argv[0] );
|
||||
}
|
||||
|
||||
@ -235,10 +239,21 @@ GLOBAL BOOLEAN IRC_QUIT( CLIENT *Client, REQUEST *Req )
|
||||
|
||||
GLOBAL BOOLEAN IRC_PING( CLIENT *Client, REQUEST *Req )
|
||||
{
|
||||
CLIENT *to;
|
||||
|
||||
assert( Client != NULL );
|
||||
assert( Req != NULL );
|
||||
|
||||
return IRC_WriteStrClient( Client, This_Server, ERR_UNKNOWNCOMMAND_MSG, Client_Name( Client ), Req->command );
|
||||
if( ! Check_Valid_User( Client )) return CONNECTED;
|
||||
|
||||
/* Falsche Anzahl Parameter? */
|
||||
if( Req->argc < 1 ) return IRC_WriteStrClient( Client, This_Server, ERR_NOORIGIN_MSG, Client_Name( Client ));
|
||||
if( Req->argc > 1 ) return IRC_WriteStrClient( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Name( Client ), Req->command );
|
||||
|
||||
to = Client_Search( Req->argv[0] );
|
||||
|
||||
if( to ) return IRC_WriteStrClient( Client, This_Server, "PONG :%s", Client_Name( Client ));
|
||||
else return IRC_WriteStrClient( Client, This_Server, ERR_NOSUCHNICK_MSG, Client_Name( Client ), Req->argv[0] );
|
||||
} /* IRC_PING */
|
||||
|
||||
|
||||
@ -275,6 +290,54 @@ GLOBAL BOOLEAN IRC_MOTD( CLIENT *Client, REQUEST *Req )
|
||||
} /* IRC_MOTD */
|
||||
|
||||
|
||||
GLOBAL BOOLEAN IRC_PRIVMSG( CLIENT *Client, REQUEST *Req )
|
||||
{
|
||||
CLIENT *to;
|
||||
|
||||
assert( Client != NULL );
|
||||
assert( Req != NULL );
|
||||
|
||||
if( ! Check_Valid_User( Client )) return CONNECTED;
|
||||
|
||||
/* Falsche Anzahl Parameter? */
|
||||
if( Req->argc == 0 ) return IRC_WriteStrClient( Client, This_Server, ERR_NORECIPIENT_MSG, Client_Name( Client ), Req->command );
|
||||
if( Req->argc == 1 ) return IRC_WriteStrClient( Client, This_Server, ERR_NOTEXTTOSEND_MSG, Client_Name( Client ));
|
||||
if( Req->argc > 2 ) return IRC_WriteStrClient( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Name( Client ), Req->command );
|
||||
|
||||
to = Client_Search( Req->argv[0] );
|
||||
if( to )
|
||||
{
|
||||
/* Okay, Ziel ist ein User */
|
||||
return IRC_WriteStrClient( to, Client, "PRIVMSG %s :%s", to->nick, Req->argv[1] );
|
||||
}
|
||||
|
||||
return IRC_WriteStrClient( Client, This_Server, ERR_NOSUCHNICK_MSG, Client_Name( Client ), Req->argv[0] );
|
||||
} /* IRC_PRIVMSG */
|
||||
|
||||
|
||||
GLOBAL BOOLEAN IRC_NOTICE( CLIENT *Client, REQUEST *Req )
|
||||
{
|
||||
CLIENT *to;
|
||||
|
||||
assert( Client != NULL );
|
||||
assert( Req != NULL );
|
||||
|
||||
if( ! Check_Valid_User( Client )) return CONNECTED;
|
||||
|
||||
/* Falsche Anzahl Parameter? */
|
||||
if( Req->argc != 2 ) return CONNECTED;
|
||||
|
||||
to = Client_Search( Req->argv[0] );
|
||||
if( to )
|
||||
{
|
||||
/* Okay, Ziel ist ein User */
|
||||
return IRC_WriteStrClient( to, Client, "NOTICE %s :%s", to->nick, Req->argv[1] );
|
||||
}
|
||||
|
||||
return CONNECTED;
|
||||
} /* IRC_NOTICE */
|
||||
|
||||
|
||||
LOCAL BOOLEAN Check_Valid_User( CLIENT *Client )
|
||||
{
|
||||
assert( Client != NULL );
|
||||
@ -293,7 +356,7 @@ LOCAL BOOLEAN Hello_User( CLIENT *Client )
|
||||
assert( Client != NULL );
|
||||
assert( Client->nick[0] );
|
||||
|
||||
Log( LOG_NOTICE, "User \"%s!%s@%s\" (%s) registered.", Client->nick, Client->user, Client->host, Client->name );
|
||||
Log( LOG_INFO, "User \"%s!%s@%s\" (%s) registered.", Client->nick, Client->user, Client->host, Client->name );
|
||||
|
||||
IRC_WriteStrClient( Client, This_Server, RPL_WELCOME_MSG, Client->nick, Client_GetID( Client ));
|
||||
IRC_WriteStrClient( Client, This_Server, RPL_YOURHOST_MSG, Client->nick, This_Server->host );
|
||||
|
@ -9,11 +9,14 @@
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: irc.h,v 1.7 2001/12/27 16:55:41 alex Exp $
|
||||
* $Id: irc.h,v 1.8 2001/12/27 19:17:26 alex Exp $
|
||||
*
|
||||
* irc.h: IRC-Befehle (Header)
|
||||
*
|
||||
* $Log: irc.h,v $
|
||||
* Revision 1.8 2001/12/27 19:17:26 alex
|
||||
* - neue Befehle PRIVMSG, NOTICE, PING.
|
||||
*
|
||||
* Revision 1.7 2001/12/27 16:55:41 alex
|
||||
* - neu: IRC_WriteStrRelated(), Aenderungen auch in IRC_WriteStrClient().
|
||||
*
|
||||
@ -61,6 +64,9 @@ GLOBAL BOOLEAN IRC_QUIT( CLIENT *Client, REQUEST *Req );
|
||||
|
||||
GLOBAL BOOLEAN IRC_MOTD( CLIENT *Client, REQUEST *Req );
|
||||
|
||||
GLOBAL BOOLEAN IRC_PRIVMSG( CLIENT *Client, REQUEST *Req );
|
||||
GLOBAL BOOLEAN IRC_NOTICE( CLIENT *Client, REQUEST *Req );
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -9,11 +9,14 @@
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an comBase beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: messages.h,v 1.7 2001/12/27 16:56:06 alex Exp $
|
||||
* $Id: messages.h,v 1.8 2001/12/27 19:17:26 alex Exp $
|
||||
*
|
||||
* irc.h: IRC-Befehle (Header)
|
||||
*
|
||||
* $Log: messages.h,v $
|
||||
* Revision 1.8 2001/12/27 19:17:26 alex
|
||||
* - neue Befehle PRIVMSG, NOTICE, PING.
|
||||
*
|
||||
* Revision 1.7 2001/12/27 16:56:06 alex
|
||||
* - RPL_WELCOME an Client_GetID() angepasst.
|
||||
*
|
||||
@ -48,7 +51,7 @@
|
||||
#define RPL_WELCOME_MSG RPL_WELCOME" %s :Welcome to the Internet Relay Network %s"
|
||||
|
||||
#define RPL_YOURHOST "002"
|
||||
#define RPL_YOURHOST_MSG RPL_YOURHOST" %s :Your host is %s, running ngircd "VERSION
|
||||
#define RPL_YOURHOST_MSG RPL_YOURHOST" %s :Your host is %s, running ngircd "VERSION"-"P_OSNAME"/"P_ARCHNAME
|
||||
|
||||
#define RPL_CREATED "003"
|
||||
#define RPL_CREATED_MSG RPL_CREATED" %s :This server was created once upon a time ... ;-)"
|
||||
@ -57,18 +60,27 @@
|
||||
#define RPL_MYINFO_MSG RPL_MYINFO" %s %s ngircd-"VERSION" + +"
|
||||
|
||||
#define RPL_MOTDSTART "375"
|
||||
#define RPL_MOTDSTART_MSG RPL_MOTDSTART" %s :- %s Message of the day"
|
||||
#define RPL_MOTDSTART_MSG RPL_MOTDSTART" %s :- %s message of the day:"
|
||||
|
||||
#define RPL_MOTD "372"
|
||||
#define RPL_MOTD_MSG RPL_MOTD" %s :- %s"
|
||||
|
||||
#define RPL_ENDOFMOTD "376"
|
||||
#define RPL_ENDOFMOTD_MSG RPL_ENDOFMOTD" %s :End of MOTD command."
|
||||
#define RPL_ENDOFMOTD_MSG RPL_ENDOFMOTD" %s :End of MOTD command"
|
||||
|
||||
|
||||
#define ERR_NOSUCHNICK "401"
|
||||
#define ERR_NOSUCHNICK_MSG ERR_NOSUCHNICK" %s %s :No such nick or channel name"
|
||||
|
||||
#define ERR_NOORIGIN "409"
|
||||
#define ERR_NOORIGIN_MSG ERR_NOORIGIN" %s :No origin specified"
|
||||
|
||||
#define ERR_NORECIPIENT "411"
|
||||
#define ERR_NORECIPIENT_MSG ERR_NORECIPIENT" %s: No receipient given (%s)"
|
||||
|
||||
#define ERR_NOTEXTTOSEND "412"
|
||||
#define ERR_NOTEXTTOSEND_MSG ERR_NOTEXTTOSEND" %s: No text to send"
|
||||
|
||||
#define ERR_UNKNOWNCOMMAND "421"
|
||||
#define ERR_UNKNOWNCOMMAND_MSG ERR_UNKNOWNCOMMAND" %s %s :Unknown command"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user