/*************************************************************************** * Copyright (C) 2004 by Daniel Muller * * dan at verliba dot cz * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef CMGSLIST_H #define CMGSLIST_H #ifdef HAVE_CONFIG_H #include #endif #include #include #include using namespace nConfig; namespace nDirectConnect { class cConnDC; class cServerDC; }; using namespace nDirectConnect; namespace nIPLog { enum { eLT_CONNECT = 0, eLT_LOGIN = 1, eLT_LOGOUT = 2, eLT_DISCONNECT = 3, eLT_DEFAULT = 1 << eLT_CONNECT | 1 << eLT_LOGOUT, eLT_ALL = 255 }; struct sUserStruct { sUserStruct() { mDate=0; mIP = 0; mType=0; mInfo=0; } long mDate; unsigned long mIP; int mType; int mInfo; string mNick; }; /** @author Daniel Muller */ class cIPLog : public cConfMySQL { public: //time_t mTime; cServerDC * mS; cIPLog(cServerDC *server); //bool SetVar(const string &nick, string &field, string &value); /** log that user logged in */ bool Log(cConnDC *conn, int action, int info); void AddFields(); virtual void CleanUp(); virtual ~cIPLog(); void GetIPHistory(const string &ip, int limit, ostream &os); void GetNickHistory(const string &nick, int limit, ostream &os); void GetHistory(const string &who, bool isNick, int limit, ostream &os); void GetLastIP(const string &nick, int limit, ostream &os); void GetLastNick(const string &ip, int limit, ostream &os); void GetLastLogin(const string &who, bool isNick, int limit, ostream &os); void MakeSearchQuery(const string &who, bool IsNick, int action, int limit); struct sUserStruct mModel; }; }; #endif