int maxbans;
public:
+ /** Creates a channel record and initialises it with default values
+ * @throw Nothing at present.
+ */
+ Channel(InspIRCd* Instance, const std::string &name, time_t ts);
+
/** The channel's name.
*/
char name[CHANMAX];
*/
bool HasUser(User* user);
- /** Creates a channel record and initialises it with default values
- * @throw Nothing at present.
- */
- Channel(InspIRCd* Instance);
-
/** Make src kick user from this channel with the given reason.
* @param src The source of the kick
* @param user The user being kicked (must be on this channel)
*/
static Channel* JoinUser(InspIRCd* ServerInstance, User *user, const char* cn, bool override, const char* key, bool bursting, time_t TS = 0);
- /*
- * Create a channel record, and insert it into the hash.
- * @param name The channel name
- * @param ts The channel timestamp
- * @return A pointer to the newly created Channel object.
- */
- static Channel *CreateChannel(InspIRCd *ServerInstance, const std::string &name, time_t ts = 0);
-
/** Write to a channel, from a user, using va_args for text
* @param user User whos details to prefix the line with
* @param text A printf-style format string which builds the output line without prefix
#include "wildcard.h"
#include "mode.h"
-Channel::Channel(InspIRCd* Instance) : ServerInstance(Instance)
+Channel::Channel(InspIRCd* Instance, const std::string &name, time_t ts) : ServerInstance(Instance)
{
- *name = *topic = *setby = *key = 0;
- maxbans = created = topicset = limit = 0;
+ (*(ServerInstance->chanlist))[name.c_str()] = this;
+ strlcpy(this->name, name.c_str(), CHANMAX);
+ this->created = ts ? ts : ServerInstance->Time(true);
+ this->age = this->created;
+
+
+
+
+ *topic = *setby = *key = 0;
+ maxbans = topicset = limit = 0;
memset(&modes,0,64);
- age = ServerInstance->Time(true);
}
void Channel::SetMode(char mode,bool mode_on)
return NULL;
}
- Ptr = Channel::CreateChannel(Instance, cname, TS);
+ Ptr = new Channel(Instance, cname, TS);
}
else
{
return Channel::ForceChan(Instance, Ptr, user, privs, bursting);
}
-Channel *Channel::CreateChannel(InspIRCd *ServerInstance, const std::string &name, time_t ts)
-{
- /* create a new one */
- Channel *c = new Channel(ServerInstance);
- (*(ServerInstance->chanlist))[name.c_str()] = c;
-
- strlcpy(c->name, name.c_str(), CHANMAX);
- c->created = ts ? ts : ServerInstance->Time();
- c->age = c->created;
- return c;
-}
-
Channel* Channel::ForceChan(InspIRCd* Instance, Channel* Ptr, User* user, const std::string &privs, bool bursting)
{
std::string nick = user->nick;