// Channel.H -*- C++ -*-
// Copyright (c) 1997, 1998 Etienne BERNARD
-// Copyright (C) 2002,2008 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
#include <algorithm>
#include <functional>
-#include <map>
+#include <list>
+#include <string>
#include <vector>
#include <ctime>
#include "BanList.H"
-#include "String.H"
+#include "ChannelUserList.H"
+#include "Utils.H"
class BanEntry;
class Bot;
// 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<String, User *, std::less<String> > channelMemory;
+ ChannelUserList channelUserlist;
BanList channelBanlist;
ServerConnection * cnx;
IS_LIMITED = 128 // +l <limit>
};
- 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<typename T> void for_each_channel_users (const T & fun)
+ { channelUserlist.foreach (fun); }
void addBan(const Mask&, std::time_t = -1);
void delBan(const Mask&);
template<typename T> 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;