repo: ngircd
action: commit
revision: 
path_from: 
revision_from: be79fabcbfdc60332aafa1c6ce4f2905dc3f724f:
path_to: 
revision_to: 
git.thebackupbox.net
ngircd
git clone git://git.thebackupbox.net/ngircd
commit be79fabcbfdc60332aafa1c6ce4f2905dc3f724f
Author: Alexander Barton 
Date:   Thu Nov 6 01:07:44 2003 +0000

    Fixed ban behavior: users which are banned from a channel can't no longer
    send PRIVMSG's to this channel (fixes Bug #47).

diff --git a/ChangeLog b/ChangeLog
index a59923c579cff259a958b2f08f569cca1a856cff..
index ..14cf0f05c9013e426f7c16d08f4fe793ea98ba9d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,8 @@

 ngIRCd CVS-HEAD

+  - Fixed ban behavior: users which are banned from a channel can't no
+    longer send PRIVMSG's to this channel (fixes Bug #47).
   - Fixed and enhanced the "penalty handling" of the server: commands that
     require more resources block the client for a short time.
   - Changed the internal time resolution to one second.
@@ -475,4 +477,4 @@ ngIRCd 0.0.1, 31.12.2001


 -- 
-$Id: ChangeLog,v 1.215 2003/11/05 23:24:48 alex Exp $
+$Id: ChangeLog,v 1.216 2003/11/06 01:07:44 alex Exp $
diff --git a/src/ngircd/channel.c b/src/ngircd/channel.c
index 0b2b1ff18afe97c528f981c14bd0deefa68ae3f5..
index ..3c740ff0d406b94e9fe438fbb93d900157eec941 100644
--- a/src/ngircd/channel.c
+++ b/src/ngircd/channel.c
@@ -17,7 +17,7 @@

 #include "portab.h"

-static char UNUSED id[] = "$Id: channel.c,v 1.42 2002/12/30 17:15:42 alex Exp $";
+static char UNUSED id[] = "$Id: channel.c,v 1.43 2003/11/06 01:07:44 alex Exp $";

 #include "imp.h"
 #include 
@@ -669,7 +669,7 @@ Channel_Write( CHANNEL *Chan, CLIENT *From, CLIENT *Client, CHAR *Text )
 {
 	BOOLEAN is_member, has_voice, is_op, ok;

-	/* Okay, Ziel ist ein Channel */
+	/* Okay, target is a channel */
 	is_member = has_voice = is_op = FALSE;
 	if( Channel_IsMemberOf( Chan, From ))
 	{
@@ -678,14 +678,21 @@ Channel_Write( CHANNEL *Chan, CLIENT *From, CLIENT *Client, CHAR *Text )
 		if( strchr( Channel_UserModes( Chan, From ), 'o' )) is_op = TRUE;
 	}

-	/* pruefen, ob Client in Channel schreiben darf */
+	/* Check weather client is allowed to write to channel */
 	ok = TRUE;
 	if( strchr( Channel_Modes( Chan ), 'n' ) && ( ! is_member )) ok = FALSE;
 	if( strchr( Channel_Modes( Chan ), 'm' ) && ( ! is_op ) && ( ! has_voice )) ok = FALSE;
+	
+	/* Is the client banned? */
+	if( Lists_CheckBanned( From, Chan ))
+	{
+		/* Client is banned, bus is he channel operator or has voice? */
+		if(( ! has_voice ) && ( ! is_op )) ok = FALSE;
+	}

 	if( ! ok ) return IRC_WriteStrClient( From, ERR_CANNOTSENDTOCHAN_MSG, Client_ID( From ), Channel_Name( Chan ));

-	/* Text senden */
+	/* Send text */
 	if( Client_Conn( From ) > NONE ) Conn_UpdateIdle( Client_Conn( From ));
 	return IRC_WriteStrChannelPrefix( Client, Chan, From, TRUE, "PRIVMSG %s :%s", Channel_Name( Chan ), Text );
 } /* Channel_Write */

-----END OF PAGE-----