summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/channels.h18
-rw-r--r--src/channels.cpp29
2 files changed, 17 insertions, 30 deletions
diff --git a/include/channels.h b/include/channels.h
index 3c95bb7fb..268adf47b 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -135,6 +135,11 @@ class CoreExport Channel : public Extensible
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];
@@ -331,11 +336,6 @@ class CoreExport Channel : public Extensible
*/
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)
@@ -374,14 +374,6 @@ class CoreExport Channel : public Extensible
*/
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
diff --git a/src/channels.cpp b/src/channels.cpp
index e252100f1..c69f09107 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -18,12 +18,19 @@
#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)
@@ -271,7 +278,7 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool
return NULL;
}
- Ptr = Channel::CreateChannel(Instance, cname, TS);
+ Ptr = new Channel(Instance, cname, TS);
}
else
{
@@ -352,18 +359,6 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool
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;