+GLOBAL bool
+Channel_IsValidName( char *Name )
+{
+ /* Pruefen, ob Name als Channelname gueltig */
+
+ char *ptr, badchars[10];
+
+ assert( Name != NULL );
+
+ if(( Name[0] != '#' ) || ( strlen( Name ) >= CHANNEL_NAME_LEN )) return false;
+
+ ptr = Name;
+ strcpy( badchars, " ,:\007" );
+ while( *ptr )
+ {
+ if( strchr( badchars, *ptr )) return false;
+ ptr++;
+ }
+
+ return true;
+} /* Channel_IsValidName */
+
+
+GLOBAL bool
+Channel_ModeAdd( CHANNEL *Chan, char Mode )
+{
+ /* set Mode.
+ * If the channel already had this mode, return false.
+ * If the channel mode was newly set return true.
+ */
+
+ char x[2];
+
+ assert( Chan != NULL );
+
+ x[0] = Mode; x[1] = '\0';
+ if( ! strchr( Chan->modes, x[0] ))
+ {
+ /* Channel does not have this mode yet, set it */
+ strlcat( Chan->modes, x, sizeof( Chan->modes ));
+ return true;
+ }
+ else return false;
+} /* Channel_ModeAdd */
+
+
+GLOBAL bool
+Channel_ModeDel( CHANNEL *Chan, char Mode )
+{
+ /* Delete mode.
+ * if the mode was removed return true.
+ * if the channel did not have the mode, return false.
+ */
+ char x[2], *p;
+
+ assert( Chan != NULL );
+
+ x[0] = Mode; x[1] = '\0';
+
+ p = strchr( Chan->modes, x[0] );
+ if( ! p ) return false;
+
+ /* Channel has mode -> delete */
+ while( *p )
+ {
+ *p = *(p + 1);
+ p++;
+ }
+ return true;
+} /* Channel_ModeDel */
+
+
+GLOBAL bool
+Channel_UserModeAdd( CHANNEL *Chan, CLIENT *Client, char Mode )
+{
+ /* Set Channel-User-Mode.
+ * if mode was newly set, return true.
+ * if the User already had this channel-mode, return false.
+ */
+
+ CL2CHAN *cl2chan;
+ char x[2];
+
+ assert( Chan != NULL );
+ assert( Client != NULL );
+
+ cl2chan = Get_Cl2Chan( Chan, Client );
+ assert( cl2chan != NULL );
+
+ x[0] = Mode; x[1] = '\0';
+ if( ! strchr( cl2chan->modes, x[0] ))
+ {
+ /* mode not set, -> set it */
+ strlcat( cl2chan->modes, x, sizeof( cl2chan->modes ));
+ return true;
+ }
+ else return false;
+} /* Channel_UserModeAdd */
+
+
+GLOBAL bool
+Channel_UserModeDel( CHANNEL *Chan, CLIENT *Client, char Mode )
+{
+ /* Delete Channel-User-Mode.
+ * If Mode was removed, return true.
+ * If User did not have the Channel-Mode, return false.
+ */
+
+ CL2CHAN *cl2chan;
+ char x[2], *p;
+
+ assert( Chan != NULL );
+ assert( Client != NULL );
+
+ cl2chan = Get_Cl2Chan( Chan, Client );
+ assert( cl2chan != NULL );
+
+ x[0] = Mode; x[1] = '\0';
+
+ p = strchr( cl2chan->modes, x[0] );
+ if( ! p ) return false;
+
+ /* Client has Mode -> delete */
+ while( *p )
+ {
+ *p = *(p + 1);
+ p++;
+ }
+ return true;
+} /* Channel_UserModeDel */
+
+
+GLOBAL char *
+Channel_UserModes( CHANNEL *Chan, CLIENT *Client )
+{
+ /* return Users' Channel-Modes */
+
+ CL2CHAN *cl2chan;
+
+ assert( Chan != NULL );
+ assert( Client != NULL );
+
+ cl2chan = Get_Cl2Chan( Chan, Client );
+ assert( cl2chan != NULL );
+
+ return cl2chan->modes;
+} /* Channel_UserModes */
+
+
+GLOBAL bool
+Channel_IsMemberOf( CHANNEL *Chan, CLIENT *Client )