+ size_t len;
+ assert( Chan != NULL );
+ assert( Topic != NULL );
+
+ len = strlen(Topic);
+ if (len < array_bytes(&Chan->topic))
+ array_free(&Chan->topic);
+
+ if (!array_copyb(&Chan->topic, Topic, len))
+ Log(LOG_WARNING, "could not set new Topic %s: %s", Topic, strerror(errno));
+
+ array_cat0(&Chan->topic);
+} /* Channel_SetTopic */
+
+
+GLOBAL void
+Channel_SetModes( CHANNEL *Chan, char *Modes )
+{
+ 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 ));
+ Log( LOG_DEBUG, "Channel %s: Key is now \"%s\".", Chan->name, Chan->key );
+} /* Channel_SetKey */
+
+
+GLOBAL void
+Channel_SetMaxUsers( CHANNEL *Chan, long Count )
+{
+ assert( Chan != NULL );
+
+ Chan->maxusers = Count;
+ Log( LOG_DEBUG, "Channel %s: Member limit is now %ld.", 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;