2 // Copyright (c) 1997, 1998 Etienne BERNARD
3 // Copyright (c) 2002,2003 Clinton Ebadi
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
34 #define VERSION_STRING PACKAGE " version " VERSION " by unknown_lamer@FreeNode <clinton@unknownlamer.org>\n1.97 and below by eb@IRCNet <eb@via.ecp.fr>"
35 #define COPYRIGHT_STRING PACKAGE " version " VERSION ", Copyright (C) 1997-2000 Etienne BERNARD\nCopyright (C) 2002,2003,2004,2005,2008,2009 Clinton Ebadi"
45 class ServerConnection;
61 String wantedNickName;
69 String userListFileName;
70 String shitListFileName;
74 std::ofstream logFile;
81 ChannelList * channelList;
84 ServerList * serverList;
86 BotInterp * botInterp;
88 std::map<std::string, class userFunction*,
89 std::less<std::string> > userFunctions;
90 std::map<String, wantedChannel *, std::less<String> > wantedChannels;
92 std::map<String, unsigned int, std::less<String> > ignoredUserhosts;
93 std::map<String, Person *, std::less<String> > spyList;
95 std::time_t startTime, currentTime, lastNickNameChange, lastChannelJoin;
97 ServerConnection * serverConnection;
98 DCCManager* dccConnections;
100 std::map<unsigned long, String, std::less<unsigned long> > userhostMap;
101 unsigned long sentUserhostID;
102 unsigned long receivedUserhostID;
104 static unsigned int MAX_MESSAGES;
105 static unsigned int MAX_NICKLENGTH;
106 static const std::time_t NICK_CHANGE = 60;
107 static const std::time_t CHANNEL_JOIN = 60;
108 static const std::time_t IGNORE_DELAY = 180;
109 static const std::time_t DCC_DELAY = 300;
110 static const std::time_t PING_TIME = 90;
111 static const std::time_t TIMEOUT = 120;
116 String configFileName;
118 String scriptLogFileName;
119 String autoexecFileName;
124 Bot(String, bool=false);
131 void logLine(String);
136 // getters and setters
137 void set_log_dir (String);
138 void set_log_file (String);
141 friend class DCCParser;
143 friend class Channel;
144 friend class ServerConnection;
145 friend class UserCommands;
146 friend class Commands;
149 bool canChangeServer();
153 enum DCC_TYPE { CHAT };
154 void addDCC(Person *, unsigned long, int, int);
157 String getUserhost(String, String);
160 void init_user_functions ();
161 void destroy_user_functions ();