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 "inspstring.h" 00020 #include "connection.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 char type; 00053 int registration_timeout; 00056 int flood; 00059 char host[MAXBUF]; 00062 int pingtime; 00065 char pass[MAXBUF]; 00066 00069 int 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 00126 char ident[IDENTMAX+2]; 00127 00131 char dhost[160]; 00132 00135 char fullname[MAXGECOS+1]; 00136 00144 char modes[54]; 00145 00146 ucrec chans[MAXCHANS]; 00147 00150 char* server; 00151 00155 char awaymsg[MAXAWAY+1]; 00156 00161 int flood; 00162 00167 unsigned int timeout; 00168 00174 char oper[NICKMAX]; 00175 00178 bool dns_done; 00179 00182 unsigned int pingmax; 00183 00188 char password[MAXBUF]; 00189 00194 std::string recvq; 00195 00199 std::string sendq; 00200 00203 int lines_in; 00204 time_t reset_due; 00205 long threshold; 00206 00207 /* Write error string 00208 */ 00209 std::string WriteError; 00210 00213 long sendqmax; 00214 00217 long recvqmax; 00218 00219 userrec(); 00220 00221 virtual ~userrec() { } 00222 00227 virtual char* GetFullHost(); 00228 00234 virtual char* GetFullRealHost(); 00235 00238 virtual bool IsInvited(char* channel); 00239 00242 virtual void InviteTo(char* channel); 00243 00248 virtual void RemoveInvite(char* channel); 00249 00254 bool HasPermission(char* command); 00255 00258 int ReadData(void* buffer, size_t size); 00259 00267 bool AddBuffer(std::string a); 00268 00272 bool BufferIsReady(); 00273 00276 void ClearBuffer(); 00277 00285 std::string GetBuffer(); 00286 00292 void SetWriteError(std::string error); 00293 00297 std::string GetWriteError(); 00298 00304 void AddWriteBuf(std::string data); 00305 00312 void FlushWriteBuf(); 00313 00316 InvitedList* GetInviteList(); 00317 00320 void CloseSocket(); 00321 }; 00322 00325 class WhoWasUser 00326 { 00327 public: 00328 char nick[NICKMAX]; 00329 char ident[IDENTMAX+1]; 00330 char dhost[160]; 00331 char host[160]; 00332 char fullname[MAXGECOS+1]; 00333 char server[256]; 00334 time_t signon; 00335 }; 00336 00337 #endif