1 // ChannelUserList.H -*- C++ -*-
2 // Copyright (c) 1997, 1998 Etienne BERNARD
3 // Copyright (C) 2002,2005,2008,2009 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 #ifndef CHANNEL_USER_LIST_H
21 #define CHANNEL_USER_LIST_H
27 #include "BotThreading.H"
35 std::list<User> users;
36 mutable BotMutex users_mutex;
37 std::string channel_name;
39 std::equal_to<User> user_equal_p;
40 std::less<User> user_less_p;
42 std::list<User>::iterator get_user_i_ (const std::string &);
43 void add_ (std::string, std::string, int, UserListItem*, bool) throw ();
49 user_not_found (const std::string &n)
60 ChannelUserList (const std::string &) throw ();
61 ~ChannelUserList () throw ();
63 void add (std::string, std::string, int, UserList*, bool = false) throw ();
64 void del (const std::string &) throw ();
65 User get (const std::string &) const throw (user_not_found);
66 void change_nickname (const std::string &, std::string) throw (user_not_found);
67 void change_user_mode (const std::string &, int, bool) throw ();
68 void change_user_key (const std::string &, const std::string &) throw ();
69 bool in_channel_p (const std::string &) const throw ();
70 unsigned int user_count () const throw ();
71 unsigned int operator_count () const throw ();
74 void foreach (T & fun)
76 BotLock foreach_lock (users_mutex);
77 std::for_each (users.begin (), users.end (), fun);