#ifndef _H_CCHANNEL
#define _H_CCHANNEL

class CChannel;

#include "mbot.h"

class CChannel {
public:
  CChannel (c_char, c_char, CNetServer *);
  ~CChannel (void);

  void irc_join (void);
  void irc_part (void);
  void irc_topic (c_char);
  void irc_invite (c_char);
  void irc_kick (c_char, c_char);
  void irc_mode (c_char, c_char);
  void irc_op (c_char);
  void irc_deop (c_char);
  void irc_voice (c_char);
  void irc_devoice (c_char);
  void irc_deopban (c_char, c_char);
  void irc_ban_nick (c_char);
  void irc_ban_mask (c_char);
  void irc_unban_nick (c_char);
  void irc_unban_mask (c_char);
  
  int user_index (c_char);
  void user_add (c_char, bool, bool);
  void user_del (c_char);
  void user_change_op (c_char, bool);
  void user_change_voice (c_char, bool);
  void user_change_nick (c_char, c_char);

  CString name;				// channel name
  CString topic;			// channel topic

  char last_msg[MSG_SIZE+1];		// last privmsg
  char last_mask[MASK_SIZE+1];		// mask who said it
  u_int msg_num;			// num of equal msg/mask in a row
  u_int mask_num;			// num of equal masks in a row
  u_int warn_num;	// num of msgs, after the others, to kick
			// if !0, send flood_kick_msg to pvt on the 1st time
  bool joined;				// if it's inside the channel

  CString kick_nick;			// to kick who kicked it
  CString last_deleted_nick;		// mainly to log quit and nick events

  struct user_type {
    CString nick;			// nick
    CString mask;			// mask
    bool is_op;				// if has op
    bool is_voice;			// if has voice
    user_type () : nick (NICK_SIZE), mask (MASK_SIZE) {}
  } *users[C_USERS_MAX];		// users inside the channel
  int user_num;				// how many

private:

  CString key;				// channel key
  CNetServer *s;			// server to which belongs

};

#endif
