| 1 | // DCCManager.H -*- C++ -*- |
| 2 | // Copyright (c) 2002 Clinton Ebadi |
| 3 | |
| 4 | // This program is free software; you can redistribute it and/or modify |
| 5 | // it under the terms of the GNU General Public License as published by |
| 6 | // the Free Software Foundation; either version 2 of the License, or |
| 7 | // any later version. |
| 8 | |
| 9 | // This program is distributed in the hope that it will be useful, |
| 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | // GNU General Public License for more details. |
| 13 | |
| 14 | // You should have received a copy of the GNU General Public License |
| 15 | // along with this program; if not, write to the Free Software |
| 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | |
| 18 | #ifndef DCC_MANAGER_H |
| 19 | #define DCC_MANAGER_H |
| 20 | |
| 21 | #include <map> |
| 22 | #include <list> |
| 23 | |
| 24 | #include <sys/types.h> |
| 25 | #include <unistd.h> |
| 26 | |
| 27 | #include "DCCPerson.H" |
| 28 | #include "DCCConnection.H" |
| 29 | #include "UserCommands.H" |
| 30 | #include "String.H" |
| 31 | |
| 32 | typedef std::map<String, DCCPerson*, std::less<String> > DCC_MAP; |
| 33 | |
| 34 | // Manages all active DCC connections and allows you to send a message |
| 35 | // to each one using the string representation of the user's address |
| 36 | class DCCManager |
| 37 | { |
| 38 | DCC_MAP dcc_map; |
| 39 | public: |
| 40 | void addConnection (DCCConnection*); |
| 41 | bool sendMessage (String, String); |
| 42 | void checkStale (); |
| 43 | #ifdef _HPUX_SOURCE |
| 44 | void checkInput (int); |
| 45 | #else |
| 46 | void checkInput (fd_set); |
| 47 | #endif |
| 48 | ~DCCManager (); |
| 49 | |
| 50 | friend class Bot; |
| 51 | friend void |
| 52 | UserCommands::DCCList (ServerConnection *, Person *, |
| 53 | String, String); |
| 54 | }; |
| 55 | |
| 56 | #endif |