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 #ifdef THREADED_DNS 00023 #include <pthread.h> 00024 #endif 00025 00026 #ifndef __USERS_H__ 00027 #define __USERS_H__ 00028 00029 #define STATUS_OP 4 00030 #define STATUS_HOP 2 00031 #define STATUS_VOICE 1 00032 #define STATUS_NORMAL 0 00033 00034 #define CC_ALLOW 0 00035 #define CC_DENY 1 00036 00039 class Invited : public classbase 00040 { 00041 public: 00042 char channel[CHANMAX]; 00043 }; 00044 00045 00048 class ConnectClass : public classbase 00049 { 00050 public: 00053 char type; 00056 int registration_timeout; 00059 int flood; 00062 char host[MAXBUF]; 00065 int pingtime; 00068 char pass[MAXBUF]; 00069 00072 int threshold; 00073 00076 long sendqmax; 00077 00080 long recvqmax; 00081 00082 ConnectClass() 00083 { 00084 registration_timeout = 0; 00085 flood = 0; 00086 pingtime = 0; 00087 threshold = 0; 00088 sendqmax = 0; 00089 recvqmax = 0; 00090 strlcpy(host,"",MAXBUF); 00091 strlcpy(pass,"",MAXBUF); 00092 } 00093 }; 00094 00097 typedef std::vector<Invited> InvitedList; 00098 00099 00100 00103 typedef std::vector<ConnectClass> ClassVector; 00104 00111 class userrec : public connection 00112 { 00113 private: 00114 00117 InvitedList invites; 00118 public: 00119 00124 char nick[NICKMAX]; 00125 00129 char ident[IDENTMAX+2]; 00130 00134 char dhost[160]; 00135 00138 char fullname[MAXGECOS+1]; 00139 00147 char modes[54]; 00148 00149 ucrec chans[MAXCHANS]; 00150 00153 char* server; 00154 00158 char awaymsg[MAXAWAY+1]; 00159 00164 int flood; 00165 00170 unsigned int timeout; 00171 00177 char oper[NICKMAX]; 00178 00181 bool dns_done; 00182 00185 unsigned int pingmax; 00186 00191 char password[MAXBUF]; 00192 00197 std::string recvq; 00198 00202 std::string sendq; 00203 00206 int lines_in; 00207 time_t reset_due; 00208 long threshold; 00209 00210 /* Write error string 00211 */ 00212 std::string WriteError; 00213 00216 long sendqmax; 00217 00220 long recvqmax; 00221 00222 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 00259 int ReadData(void* buffer, size_t size); 00260 00268 bool AddBuffer(std::string a); 00269 00273 bool BufferIsReady(); 00274 00277 void ClearBuffer(); 00278 00286 std::string GetBuffer(); 00287 00293 void SetWriteError(std::string error); 00294 00298 std::string GetWriteError(); 00299 00305 void AddWriteBuf(std::string data); 00306 00313 void FlushWriteBuf(); 00314 00317 InvitedList* GetInviteList(); 00318 00321 void CloseSocket(); 00322 00323 virtual ~userrec(); 00324 00325 #ifdef THREADED_DNS 00326 pthread_t dnsthread; 00327 #endif 00328 }; 00329 00332 class WhoWasUser 00333 { 00334 public: 00335 char nick[NICKMAX]; 00336 char ident[IDENTMAX+1]; 00337 char dhost[160]; 00338 char host[160]; 00339 char fullname[MAXGECOS+1]; 00340 char server[256]; 00341 time_t signon; 00342 }; 00343 00344 #endif