+ assert( Chan != NULL );
+ assert( Modes != NULL );
+
+ strlcpy( Chan->modes, Modes, sizeof( Chan->modes ));
+} /* Channel_SetModes */
+
+
+GLOBAL void
+Channel_SetKey( CHANNEL *Chan, char *Key )
+{
+ assert( Chan != NULL );
+ assert( Key != NULL );
+
+ strlcpy( Chan->key, Key, sizeof( Chan->key ));
+ LogDebug("Channel %s: Key is now \"%s\".", Chan->name, Chan->key );
+} /* Channel_SetKey */
+
+
+GLOBAL void
+Channel_SetMaxUsers(CHANNEL *Chan, unsigned long Count)
+{
+ assert( Chan != NULL );
+
+ Chan->maxusers = Count;
+ LogDebug("Channel %s: Member limit is now %lu.", Chan->name, Chan->maxusers );
+} /* Channel_SetMaxUsers */
+
+
+GLOBAL bool
+Channel_Write( CHANNEL *Chan, CLIENT *From, CLIENT *Client, char *Text )
+{
+ bool is_member, has_voice, is_op, ok;
+
+ /* Okay, target is a channel */
+ is_member = has_voice = is_op = false;
+ if( Channel_IsMemberOf( Chan, From ))
+ {
+ is_member = true;
+ if( strchr( Channel_UserModes( Chan, From ), 'v' )) has_voice = true;
+ if( strchr( Channel_UserModes( Chan, From ), 'o' )) is_op = true;
+ }
+
+ /* Is the client 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_Check(&Chan->list_bans, From))
+ {
+ /* Client is banned, but 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 ));
+
+ /* 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 */
+
+
+GLOBAL CHANNEL *
+Channel_Create( char *Name )
+{
+ /* Create new CHANNEL structure and add it to linked list */