commit - 3a3d6d7b9a4b5e23f187a3722cb10ca9a916169f
commit + 005391ca5bf5f8a989cf4934fe53eb3bb18a1dd1
blob - 5700f2e3d47bd8ed29c57a4970aea55f6ea07ab0
blob + aa41b7de4af527bd3bd774b122867a29c7b00c3c
--- src/ngircd/irc-channel.c
+++ src/ngircd/irc-channel.c
* Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
* der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
*
- * $Id: irc-channel.c,v 1.14 2002/09/08 00:50:25 alex Exp $
+ * $Id: irc-channel.c,v 1.15 2002/09/16 09:16:17 alex Exp $
*
* irc-channel.c: IRC-Channel-Befehle
*/
{
CHAR *pattern;
CHANNEL *chan;
+ CLIENT *from, *target;
assert( Client != NULL );
assert( Req != NULL );
- if( Client_Type( Client ) != CLIENT_USER ) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
+ if(( Client_Type( Client ) != CLIENT_USER ) && ( Client_Type( Client ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOTREGISTERED_MSG, Client_ID( Client ));
/* Falsche Anzahl Parameter? */
- if( Req->argc > 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
+ if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
if( Req->argc > 0 ) pattern = strtok( Req->argv[0], "," );
else pattern = "*";
+
+ /* From aus Prefix ermitteln */
+ if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
+ else from = Client;
+ if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->prefix );
+
+ if( Req->argc == 2 )
+ {
+ /* an anderen Server forwarden */
+ target = Client_Search( Req->argv[1] );
+ if( ! target ) return IRC_WriteStrClient( from, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
+
+ if( target != Client_ThisServer( ))
+ {
+ /* Ok, anderer Server ist das Ziel: forwarden */
+ return IRC_WriteStrClientPrefix( target, from, "LIST %s :%s", from, Req->argv[1] );
+ }
+ }
while( pattern )
{
if( Match( pattern, Channel_Name( chan )))
{
/* Treffer! */
- if( ! IRC_WriteStrClient( Client, RPL_LIST_MSG, Client_ID( Client), Channel_Name( chan ), Channel_MemberCount( chan ), Channel_Topic( chan ))) return DISCONNECTED;
+ if( ! IRC_WriteStrClient( from, RPL_LIST_MSG, from, Channel_Name( chan ), Channel_MemberCount( chan ), Channel_Topic( chan ))) return DISCONNECTED;
}
chan = Channel_Next( chan );
}
else pattern = NULL;
}
- return IRC_WriteStrClient( Client, RPL_LISTEND_MSG, Client_ID( Client ));
+ return IRC_WriteStrClient( from, RPL_LISTEND_MSG, from );
} /* IRC_LIST */