#ifndef _H_CMODULE
#define _H_CMODULE

class CModule;

#include "CBot.h"

class CModule {
public:

  CModule (CBot *, c_char);
  ~CModule (void);

  CString filename;			// path, as provided to CModule()

  void *handle;				// handle returned by dlopen()

  struct module_type {
    u_char version;			// module version
    const char *name;			// module name
    void (*start) (CModule *);		// executed when loading the module
    void (*stop) (CModule *);		// executed when unloading the module
    void (*conf) (CNetServer *, c_char);// configuration parser
    void (*set) (CNetServer *, c_char, char *, size_t);	// !set handler
  };
  struct module_type *module;

  bool initialized;			// if the constructor was succesful

  CBot *b;				// bot to which belongs

};

#endif
