00001 /* +------------------------------------+ 00002 * | Inspire Internet Relay Chat Daemon | 00003 * +------------------------------------+ 00004 * 00005 * Inspire is copyright (C) 2002-2004 ChatSpike-Dev. 00006 * E-mail: 00007 * <brain@chatspike.net> 00008 * <Craig@chatspike.net> 00009 * 00010 * Written by Craig Edwards, Craig McLure, and others. 00011 * This program is free but copyrighted software; see 00012 * the file COPYING for details. 00013 * 00014 * --------------------------------------------------- 00015 */ 00016 00017 #include "inspircd_config.h" 00018 #include "channels.h" 00019 #include "connection.h" 00020 #include "inspstring.h" 00021 #include <string> 00022 00023 #ifndef __USERS_H__ 00024 #define __USERS_H__ 00025 00026 #define STATUS_OP 4 00027 #define STATUS_HOP 2 00028 #define STATUS_VOICE 1 00029 #define STATUS_NORMAL 0 00030 00031 #define CC_ALLOW 0 00032 #define CC_DENY 1 00033 00036 class Invited : public classbase 00037 { 00038 public: 00039 char channel[CHANMAX]; 00040 }; 00041 00042 00045 class ConnectClass : public classbase 00046 { 00047 public: 00050 int type; 00053 int registration_timeout; 00056 int flood; 00059 char host[MAXBUF]; 00062 int pingtime; 00065 char pass[MAXBUF]; 00066 00069 long threshold; 00070 00073 long sendqmax; 00074 00077 long recvqmax; 00078 00079 ConnectClass() 00080 { 00081 registration_timeout = 0; 00082 flood = 0; 00083 pingtime = 0; 00084 threshold = 0; 00085 sendqmax = 0; 00086 recvqmax = 0; 00087 strlcpy(host,"",MAXBUF); 00088 strlcpy(pass,"",MAXBUF); 00089 } 00090 }; 00091 00094 typedef std::vector<Invited> InvitedList; 00095 00096 00097 00100 typedef std::vector<ConnectClass> ClassVector; 00101 00108 class userrec : public connection 00109 { 00110 private: 00111 00114 InvitedList invites; 00115 public: 00116 00121 char nick[NICKMAX]; 00122 00125 char ident[64]; 00126 00130 char dhost[256]; 00131 00134 char fullname[128]; 00135 00140 char modes[MAXBUF]; 00141 00142 ucrec chans[MAXCHANS]; 00143 00146 char server[256]; 00147 00151 char awaymsg[512]; 00152 00156 char result[256]; 00157 00162 int flood; 00163 00168 unsigned long timeout; 00169 00175 char oper[NICKMAX]; 00176 00179 bool dns_done; 00180 00183 unsigned long pingmax; 00184 00189 char password[MAXBUF]; 00190 00195 std::string recvq; 00196 00200 std::string sendq; 00201 00204 long lines_in; 00205 time_t reset_due; 00206 long threshold; 00207 00208 /* Write error string 00209 */ 00210 std::string WriteError; 00211 00214 long sendqmax; 00215 00218 long recvqmax; 00219 00220 userrec(); 00221 00222 virtual ~userrec() { } 00223 00228 virtual char* GetFullHost(); 00229 00235 virtual char* GetFullRealHost(); 00236 00239 virtual bool IsInvited(char* channel); 00240 00243 virtual void InviteTo(char* channel); 00244 00249 virtual void RemoveInvite(char* channel); 00250 00255 bool HasPermission(char* command); 00256 00264 bool AddBuffer(std::string a); 00265 00269 bool BufferIsReady(); 00270 00273 void ClearBuffer(); 00274 00282 std::string GetBuffer(); 00283 00289 void SetWriteError(std::string error); 00290 00294 std::string GetWriteError(); 00295 00301 void AddWriteBuf(std::string data); 00302 00309 void FlushWriteBuf(); 00310 00311 }; 00312 00313 00314 #endif