summaryrefslogtreecommitdiff
path: root/src/channels.cpp
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-01-06 02:36:05 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-01-06 02:36:05 +0000
commit488cea15e8de7f1afa779728aa4af2efd548d268 (patch)
tree046e67d702e59abc5f8bd41e049b42a694f31746 /src/channels.cpp
parentd2fea45d5ad318c9cc9959843614273cf827b13f (diff)
Move CreateChannel to a constructor instead
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8647 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/channels.cpp')
-rw-r--r--src/channels.cpp29
1 files changed, 12 insertions, 17 deletions
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;