X-Git-Url: https://git.hcoop.net/clinton/bobotpp.git/blobdiff_plain/cb21075d829be5ad97d026daf76061c13d4bc171..71cf268829070ae57d695fbea11404bc04113aa9:/source/Channel.H diff --git a/source/Channel.H b/source/Channel.H index 6caef38..838200d 100644 --- a/source/Channel.H +++ b/source/Channel.H @@ -1,6 +1,6 @@ // Channel.H -*- C++ -*- // Copyright (c) 1997, 1998 Etienne BERNARD -// Copyright (C) 2002 Clinton Ebadi +// Copyright (C) 2002,2008,2009 Clinton Ebadi // 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 @@ -14,24 +14,35 @@ // 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. +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +// 02110-1301, USA. #ifndef CHANNEL_H #define CHANNEL_H -#include -#include +#include +#include +#include +#include #include -#include "User.H" -#include "Person.H" -#include "ServerConnection.H" -#include "BanEntry.H" +#include + +#include "BanList.H" +#include "ChannelUserList.H" +#include "Utils.H" +class BanEntry; class Bot; -class Parser; class Commands; +class Mask; +class Parser; +class Person; +class ServerConnection; +class User; class UserCommands; +class UserList; + #define DEFAULT_KEEPMODES "iklmnpst" @@ -40,31 +51,29 @@ class UserCommands; // want to set/keep on these channels, and the // channel keys struct wantedChannel { - String mode; - String keep; - String key; + std::string mode; + std::string keep; + std::string key; - wantedChannel(String m, String kp, String ky) + wantedChannel(std::string m, std::string kp, std::string ky) : mode(m), keep(kp), key(ky) { } }; class Channel { - String channelName; - String channelTopic; + std::string channelName; + std::string channelTopic; bool lockedTopic; int channelMode; int channelLimit; - String channelKey; - String keepModes; - String wantedModes; + std::string channelKey; + std::string keepModes; + std::string wantedModes; - int count; - int countOp; bool joined; bool doMode; bool gotWho; - std::map > channelMemory; - std::vector channelBanlist; + ChannelUserList channelUserlist; + BanList channelBanlist; ServerConnection * cnx; public: @@ -80,19 +89,27 @@ public: IS_LIMITED = 128 // +l }; - Channel(ServerConnection *, String, String); + Channel(ServerConnection *, std::string, std::string); ~Channel(); - void addNick(String, String, int, UserList *, bool = false); - void delNick(String); - void changeNick(String, String); - bool hasNick(String); - User * getUser(String); + void addNick(std::string, std::string, int, UserList *, bool = false); + void delNick(std::string); + void changeNick(std::string, std::string); + void change_user_key (std::string, std::string); + bool hasNick(const std::string &) const; + const User getUser(const std::string &) const; + unsigned int user_count () const throw (); + unsigned int operator_count () const throw (); + template void for_each_channel_users (const T & fun) + { channelUserlist.foreach (fun); } - void addBan(String, std::time_t = -1); - void delBan(String); + void addBan(const Mask&, std::time_t = -1); + void delBan(const Mask&); + void purge_expired_bans (); + template void for_each_ban_entry (const T & fun) + { channelBanlist.foreach (fun); } - void parseMode(Person *, String); + void parseMode(Person *, std::string); void resynchModes(); friend class Bot;