00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "inspircd_config.h"
00018 #include "base.h"
00019 #include <time.h>
00020 #include <vector>
00021 #include <string>
00022
00023 #ifndef __CHANNELS_H__
00024 #define __CHANNELS_H__
00025
00026 #define CM_TOPICLOCK 1
00027 #define CM_NOEXTERNAL 2
00028 #define CM_INVITEONLY 4
00029 #define CM_MODERATED 8
00030 #define CM_SECRET 16
00031 #define CM_PRIVATE 32
00032
00033 class userrec;
00034
00038 class HostItem : public classbase
00039 {
00040 public:
00041 time_t set_time;
00042 char set_by[NICKMAX];
00043 char data[MAXBUF];
00044
00045 HostItem() { }
00046 virtual ~HostItem() { }
00047 };
00048
00049
00050
00051
00054 class BanItem : public HostItem
00055 {
00056 };
00057
00058
00059
00062 class ExemptItem : public HostItem
00063 {
00064 };
00065
00066
00067
00070 class InviteItem : public HostItem
00071 {
00072 };
00073
00074
00079 class ModeParameter : public classbase
00080 {
00081 public:
00082 char mode;
00083 char parameter[MAXBUF];
00084 char channel[CHANMAX];
00085 };
00086
00089 typedef std::vector<BanItem> BanList;
00090
00093 typedef std::vector<ExemptItem> ExemptList;
00094
00097 typedef std::vector<InviteItem> InviteList;
00098
00103 class chanrec : public Extensible
00104 {
00105 public:
00108 char name[CHANMAX];
00112 char custom_modes[MAXMODES];
00113
00117 std::vector<char*> internal_userlist;
00118
00122 char topic[MAXBUF];
00125 time_t created;
00129 time_t topicset;
00133 char setby[NICKMAX];
00134
00138 short int limit;
00139
00143 char key[32];
00144
00147 char binarymodes;
00148
00151 BanList bans;
00152
00157 void SetCustomMode(char mode,bool mode_on);
00158
00164 void SetCustomModeParam(char mode,char* parameter,bool mode_on);
00165
00170 bool IsCustomModeSet(char mode);
00171
00182 std::string GetModeParameter(char mode);
00183
00191 long GetUserCounter();
00192
00200 void AddUser(char* castuser);
00201
00209 void DelUser(char* castuser);
00210
00220 std::vector<char*> *GetUsers();
00221
00224 chanrec();
00225
00226 virtual ~chanrec() { }
00227 };
00228
00229
00230
00231
00232 #define UCMODE_OP 1
00233 #define UCMODE_VOICE 2
00234 #define UCMODE_HOP 4
00235 #define UCMODE_PROTECT 8
00236 #define UCMODE_FOUNDER 16
00237
00243 class ucrec : public classbase
00244 {
00245 public:
00249 char uc_modes;
00250
00254 chanrec *channel;
00255
00256 ucrec() { }
00257 virtual ~ucrec() { }
00258 };
00259
00260 chanrec* add_channel(userrec *user, const char* cn, const char* key, bool override);
00261 chanrec* del_channel(userrec *user, const char* cname, const char* reason, bool local);
00262 void kick_channel(userrec *src,userrec *user, chanrec *Ptr, char* reason);
00263
00264 #endif
00265