1 // UserListItem.H -*- C++ -*-
2 // Copyright (c) 1997, 1998 Etienne BERNARD
3 // Copyright (c) 2002 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
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
20 // An UserListItem object is the object that is stored in the UserList.
22 #ifndef USERLISTITEM_H
23 #define USERLISTITEM_H
37 // Mask on the channel
39 // Level (from 0 to 4)
41 // Protection (from 0 to 2)
45 // Date until which the UserListItem is valid
46 time_t expirationDate;
49 // How many channels are we identified on ?
51 // Is this item automatically added ?
55 UserListItem(String m, String mc, int l, int p, bool a,
56 std::time_t e = -1, String pass= "", bool ae = false)
57 : mask(m), channelMask(mc), level(l), prot(p), aop(a),
58 expirationDate(e), passwd(pass), identified(0), autoEntry(ae) { }
60 // Returns true if it matches <m> on channel(s) <mc>
61 bool matches(String m, String mc)
62 { if (mc.length()==0) return mask.matches(m);
63 else return mask.matches(m) && channelMask.matches(mc); }
65 // Returns true if it matches <m>
66 bool matches(String m)
67 { return mask.matches(m); }
69 // Is the item still valid ? (-1 means infinity)
71 { return expirationDate == -1 || std::time(NULL) <= expirationDate; }
76 friend class UserList;
77 friend class Commands;
78 friend class UserCommands;