Commit Diff


commit - 9d2407dbc50ccebc8cfc3bb1748665a51cf506a0
commit + 3c0c3c3c5f052a25494234862e21e5ecd686f3a6
blob - 87e352759d2a4f05bae3946530a6c850b0fb09e3
blob + 79ccdd9adeaf299e3d0d073f60b08e100125d339
--- src/ngircd/irc-channel.c
+++ src/ngircd/irc-channel.c
@@ -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: irc-channel.c,v 1.3 2002/03/25 17:08:54 alex Exp $
+ * $Id: irc-channel.c,v 1.4 2002/04/23 19:51:14 alex Exp $
  *
  * irc-channel.c: IRC-Channel-Befehle
  */
@@ -218,4 +218,45 @@ GLOBAL BOOLEAN IRC_TOPIC( CLIENT *Client, REQUEST *Req
 } /* IRC_TOPIC */
 
 
+GLOBAL BOOLEAN IRC_LIST( CLIENT *Client, REQUEST *Req )
+{
+	CHAR *pattern;
+	CHANNEL *chan;
+
+	assert( Client != NULL );
+	assert( Req != NULL );
+
+	if( Client_Type( Client ) != CLIENT_USER ) 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 > 0 ) pattern = strtok( Req->argv[0], "," );
+	else pattern = "*";
+	
+	while( pattern )
+	{
+		/* alle Channel durchgehen */
+		chan = Channel_First( );
+		while( chan )
+		{
+			/* Passt die Suchmaske auf diesen Channel? Bisher werden hier
+			 * "regular expressions" aber noch nicht unterstuetzt ... */
+			if(( strcasecmp( pattern, Channel_Name( chan )) == 0 ) || ( strcmp( pattern, "*" ) == 0 ))
+			{
+				/* Treffer! */
+				if( ! IRC_WriteStrClient( Client, RPL_LIST_MSG, Client_ID( Client), Channel_Name( chan ), Channel_MemberCount( chan ), Channel_Topic( chan ))) return DISCONNECTED;
+			}
+			chan = Channel_Next( chan );
+		}
+		
+		/* naechsten Namen ermitteln */
+		if( Req->argc > 0 ) pattern = strtok( NULL, "," );
+		else pattern = NULL;
+	}
+	
+	return IRC_WriteStrClient( Client, RPL_LISTEND_MSG, Client_ID( Client ));
+} /* IRC_LIST */
+
+
 /* -eof- */
blob - 81828595152119b90d449a5d920eb3097c5365cd
blob + bd85af6e3e8c5b3580f877fdd6f735d241f2becb
--- src/ngircd/irc-channel.h
+++ src/ngircd/irc-channel.h
@@ -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: irc-channel.h,v 1.2 2002/03/12 14:37:52 alex Exp $
+ * $Id: irc-channel.h,v 1.3 2002/04/23 19:51:14 alex Exp $
  *
  * irc-channel.h: IRC-Channel-Befehle (Header)
  */
@@ -26,6 +26,7 @@ GLOBAL BOOLEAN IRC_JOIN( CLIENT *Client, REQUEST *Req 
 GLOBAL BOOLEAN IRC_PART( CLIENT *Client, REQUEST *Req );
 GLOBAL BOOLEAN IRC_TOPIC( CLIENT *Client, REQUEST *Req );
 
+GLOBAL BOOLEAN IRC_LIST( CLIENT *Client, REQUEST *Req );
 
 #endif