mirror of
https://github.com/osmarks/ngircd.git
synced 2025-01-12 16:51:07 +00:00
- neuer Befehl NAMES, kleinere Bugfixes.
- Bug bei PING behoben: war zu restriktiv implementiert :-)
This commit is contained in:
parent
194f18c8e6
commit
fb9d6ce174
@ -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: client.c,v 1.14 2001/12/31 02:18:51 alex Exp $
|
||||
* $Id: client.c,v 1.15 2001/12/31 15:33:13 alex Exp $
|
||||
*
|
||||
* client.c: Management aller Clients
|
||||
*
|
||||
@ -21,6 +21,10 @@
|
||||
* Server gewesen, so existiert eine entsprechende CONNECTION-Struktur.
|
||||
*
|
||||
* $Log: client.c,v $
|
||||
* Revision 1.15 2001/12/31 15:33:13 alex
|
||||
* - neuer Befehl NAMES, kleinere Bugfixes.
|
||||
* - Bug bei PING behoben: war zu restriktiv implementiert :-)
|
||||
*
|
||||
* Revision 1.14 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
@ -320,6 +324,24 @@ GLOBAL CLIENT *Client_Search( CHAR *ID )
|
||||
} /* Client_Search */
|
||||
|
||||
|
||||
GLOBAL CLIENT *Client_First( VOID )
|
||||
{
|
||||
/* Ersten Client liefern. */
|
||||
|
||||
return My_Clients;
|
||||
} /* Client_First */
|
||||
|
||||
|
||||
GLOBAL CLIENT *Client_Next( CLIENT *c )
|
||||
{
|
||||
/* Naechsten Client liefern. Existiert keiner,
|
||||
* so wird NULL geliefert. */
|
||||
|
||||
assert( c != NULL );
|
||||
return c->next;
|
||||
} /* Client_Next */
|
||||
|
||||
|
||||
LOCAL CLIENT *New_Client_Struct( VOID )
|
||||
{
|
||||
/* Neue CLIENT-Struktur pre-initialisieren */
|
||||
|
@ -9,11 +9,15 @@
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: client.h,v 1.10 2001/12/31 02:18:51 alex Exp $
|
||||
* $Id: client.h,v 1.11 2001/12/31 15:33:13 alex Exp $
|
||||
*
|
||||
* client.h: Konfiguration des ngircd (Header)
|
||||
*
|
||||
* $Log: client.h,v $
|
||||
* Revision 1.11 2001/12/31 15:33:13 alex
|
||||
* - neuer Befehl NAMES, kleinere Bugfixes.
|
||||
* - Bug bei PING behoben: war zu restriktiv implementiert :-)
|
||||
*
|
||||
* Revision 1.10 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
@ -101,6 +105,8 @@ GLOBAL CHAR *Client_Nick( CLIENT *Client );
|
||||
GLOBAL BOOLEAN Client_CheckNick( CLIENT *Client, CHAR *Nick );
|
||||
GLOBAL CHAR *Client_GetID( CLIENT *Client );
|
||||
GLOBAL CLIENT *Client_Search( CHAR *ID );
|
||||
GLOBAL CLIENT *Client_First( VOID );
|
||||
GLOBAL CLIENT *Client_Next( CLIENT *c );
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -9,11 +9,15 @@
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: irc.c,v 1.16 2001/12/31 02:18:51 alex Exp $
|
||||
* $Id: irc.c,v 1.17 2001/12/31 15:33:13 alex Exp $
|
||||
*
|
||||
* irc.c: IRC-Befehle
|
||||
*
|
||||
* $Log: irc.c,v $
|
||||
* Revision 1.17 2001/12/31 15:33:13 alex
|
||||
* - neuer Befehl NAMES, kleinere Bugfixes.
|
||||
* - Bug bei PING behoben: war zu restriktiv implementiert :-)
|
||||
*
|
||||
* Revision 1.16 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
@ -276,8 +280,6 @@ GLOBAL BOOLEAN IRC_QUIT( CLIENT *Client, REQUEST *Req )
|
||||
|
||||
GLOBAL BOOLEAN IRC_PING( CLIENT *Client, REQUEST *Req )
|
||||
{
|
||||
CLIENT *to;
|
||||
|
||||
assert( Client != NULL );
|
||||
assert( Req != NULL );
|
||||
|
||||
@ -287,10 +289,7 @@ GLOBAL BOOLEAN IRC_PING( CLIENT *Client, REQUEST *Req )
|
||||
if( Req->argc < 1 ) return IRC_WriteStrClient( Client, This_Server, ERR_NOORIGIN_MSG, Client_Nick( Client ));
|
||||
if( Req->argc > 1 ) return IRC_WriteStrClient( Client, This_Server, ERR_NEEDMOREPARAMS_MSG, Client_Nick( Client ), Req->command );
|
||||
|
||||
to = Client_Search( Req->argv[0] );
|
||||
|
||||
if( to ) return IRC_WriteStrClient( Client, This_Server, "PONG :%s", Client_Nick( Client ));
|
||||
else return IRC_WriteStrClient( Client, This_Server, ERR_NOSUCHNICK_MSG, Client_Nick( Client ), Req->argv[0] );
|
||||
return IRC_WriteStrClient( Client, This_Server, "PONG %s :%s", Client_Nick( This_Server), Client_Nick( Client ));
|
||||
} /* IRC_PING */
|
||||
|
||||
|
||||
@ -545,6 +544,51 @@ GLOBAL BOOLEAN IRC_RESTART( CLIENT *Client, REQUEST *Req )
|
||||
} /* IRC_RESTART */
|
||||
|
||||
|
||||
GLOBAL BOOLEAN IRC_NAMES( CLIENT *Client, REQUEST *Req )
|
||||
{
|
||||
CHAR rpl[COMMAND_LEN];
|
||||
CLIENT *c;
|
||||
|
||||
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_NEEDMOREPARAMS_MSG, Client_Nick( Client ), Req->command );
|
||||
|
||||
/* Noch alle User ausgeben, die in keinem Channel sind */
|
||||
rpl[0] = '\0';
|
||||
c = Client_First( );
|
||||
while( c )
|
||||
{
|
||||
if( c->type == CLIENT_USER )
|
||||
{
|
||||
/* Okay, das ist ein User */
|
||||
strcat( rpl, Client_Nick( c ));
|
||||
strcat( rpl, " " );
|
||||
}
|
||||
|
||||
/* Antwort zu lang? Splitten. */
|
||||
if( strlen( rpl ) > 480 )
|
||||
{
|
||||
if( rpl[strlen( rpl ) - 1] == ' ' ) rpl[strlen( rpl ) - 1] = '\0';
|
||||
if( ! IRC_WriteStrClient( Client, This_Server, RPL_NAMREPLY_MSG, Client_Nick( Client ), "*", "*", rpl )) return DISCONNECTED;
|
||||
rpl[0] = '\0';
|
||||
}
|
||||
|
||||
c = Client_Next( c );
|
||||
}
|
||||
if( rpl[0] )
|
||||
{
|
||||
/* es wurden User gefunden */
|
||||
if( rpl[strlen( rpl ) - 1] == ' ' ) rpl[strlen( rpl ) - 1] = '\0';
|
||||
if( ! IRC_WriteStrClient( Client, This_Server, RPL_NAMREPLY_MSG, Client_Nick( Client ), "*", "*", rpl )) return DISCONNECTED;
|
||||
}
|
||||
return IRC_WriteStrClient( Client, This_Server, RPL_ENDOFNAMES_MSG, Client_Nick( Client ), "*" );
|
||||
} /* IRC_NAMES */
|
||||
|
||||
|
||||
GLOBAL BOOLEAN IRC_ISON( CLIENT *Client, REQUEST *Req )
|
||||
{
|
||||
CHAR rpl[COMMAND_LEN];
|
||||
|
@ -9,11 +9,15 @@
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: irc.h,v 1.10 2001/12/31 02:18:51 alex Exp $
|
||||
* $Id: irc.h,v 1.11 2001/12/31 15:33:13 alex Exp $
|
||||
*
|
||||
* irc.h: IRC-Befehle (Header)
|
||||
*
|
||||
* $Log: irc.h,v $
|
||||
* Revision 1.11 2001/12/31 15:33:13 alex
|
||||
* - neuer Befehl NAMES, kleinere Bugfixes.
|
||||
* - Bug bei PING behoben: war zu restriktiv implementiert :-)
|
||||
*
|
||||
* Revision 1.10 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
@ -77,6 +81,7 @@ GLOBAL BOOLEAN IRC_NOTICE( CLIENT *Client, REQUEST *Req );
|
||||
|
||||
GLOBAL BOOLEAN IRC_MODE( CLIENT *Client, REQUEST *Req );
|
||||
|
||||
GLOBAL BOOLEAN IRC_NAMES( CLIENT *Client, REQUEST *Req );
|
||||
GLOBAL BOOLEAN IRC_ISON( CLIENT *Client, REQUEST *Req );
|
||||
GLOBAL BOOLEAN IRC_WHOIS( CLIENT *Client, REQUEST *Req );
|
||||
GLOBAL BOOLEAN IRC_USERHOST( CLIENT *Client, REQUEST *Req );
|
||||
|
@ -9,11 +9,15 @@
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: messages.h,v 1.12 2001/12/31 02:18:51 alex Exp $
|
||||
* $Id: messages.h,v 1.13 2001/12/31 15:33:13 alex Exp $
|
||||
*
|
||||
* irc.h: IRC-Befehle (Header)
|
||||
*
|
||||
* $Log: messages.h,v $
|
||||
* Revision 1.13 2001/12/31 15:33:13 alex
|
||||
* - neuer Befehl NAMES, kleinere Bugfixes.
|
||||
* - Bug bei PING behoben: war zu restriktiv implementiert :-)
|
||||
*
|
||||
* Revision 1.12 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
@ -109,6 +113,12 @@
|
||||
#define RPL_WHOISCHANNELS "319"
|
||||
#define RPL_WHOISCHANNELS_MSG RPL_WHOISCHANNELS" %s :"
|
||||
|
||||
#define RPL_NAMREPLY "353"
|
||||
#define RPL_NAMREPLY_MSG RPL_NAMREPLY" %s %s %s :%s"
|
||||
|
||||
#define RPL_ENDOFNAMES "366"
|
||||
#define RPL_ENDOFNAMES_MSG RPL_ENDOFNAMES" %s %s :End of NAMES list"
|
||||
|
||||
#define RPL_YOUREOPER "381"
|
||||
#define RPL_YOUREOPER_MSG RPL_YOUREOPER" %s :You are now an IRC Operator"
|
||||
|
||||
|
@ -9,11 +9,15 @@
|
||||
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
|
||||
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
|
||||
*
|
||||
* $Id: parse.c,v 1.9 2001/12/31 02:18:51 alex Exp $
|
||||
* $Id: parse.c,v 1.10 2001/12/31 15:33:13 alex Exp $
|
||||
*
|
||||
* parse.c: Parsen der Client-Anfragen
|
||||
*
|
||||
* $Log: parse.c,v $
|
||||
* Revision 1.10 2001/12/31 15:33:13 alex
|
||||
* - neuer Befehl NAMES, kleinere Bugfixes.
|
||||
* - Bug bei PING behoben: war zu restriktiv implementiert :-)
|
||||
*
|
||||
* Revision 1.9 2001/12/31 02:18:51 alex
|
||||
* - viele neue Befehle (WHOIS, ISON, OPER, DIE, RESTART),
|
||||
* - neuen Header "defines.h" mit (fast) allen Konstanten.
|
||||
@ -244,6 +248,7 @@ LOCAL BOOLEAN Handle_Request( CONN_ID Idx, REQUEST *Req )
|
||||
else if( strcasecmp( Req->command, "PRIVMSG" ) == 0 ) return IRC_PRIVMSG( client, Req );
|
||||
else if( strcasecmp( Req->command, "NOTICE" ) == 0 ) return IRC_NOTICE( client, Req );
|
||||
else if( strcasecmp( Req->command, "MODE" ) == 0 ) return IRC_MODE( client, Req );
|
||||
else if( strcasecmp( Req->command, "NAMES" ) == 0 ) return IRC_NAMES( client, Req );
|
||||
else if( strcasecmp( Req->command, "ISON" ) == 0 ) return IRC_ISON( client, Req );
|
||||
else if( strcasecmp( Req->command, "WHOIS" ) == 0 ) return IRC_WHOIS( client, Req );
|
||||
else if( strcasecmp( Req->command, "USERHOST" ) == 0 ) return IRC_USERHOST( client, Req );
|
||||
|
Loading…
Reference in New Issue
Block a user