summaryrefslogtreecommitdiff
path: root/src/channels.cpp
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-01-06 02:24:26 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-01-06 02:24:26 +0000
commitd2fea45d5ad318c9cc9959843614273cf827b13f (patch)
tree3180ab6e003f0a152ee0d18bd1603177d1c23b87 /src/channels.cpp
parentc244f3ecd52a850a7ced20be3ea29da79b7b62d2 (diff)
Move channel creation to a seperate Channel::CreateChannel (y'know, perhaps this might go into a constructor sometime) in preperation for permanent channels
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8646 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/channels.cpp')
-rw-r--r--src/channels.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index 14f0f55f1..e252100f1 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -271,21 +271,7 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool
return NULL;
}
- /* create a new one */
- Ptr = new Channel(Instance);
- (*(Instance->chanlist))[cname] = Ptr;
-
- strlcpy(Ptr->name, cname,CHANMAX);
-
- /* As spotted by jilles, dont bother to set this on remote users */
- if (IS_LOCAL(user))
- Ptr->SetDefaultModes();
-
- Ptr->created = TS ? TS : Instance->Time();
- Ptr->age = Ptr->created;
- *Ptr->topic = 0;
- *Ptr->setby = 0;
- Ptr->topicset = 0;
+ Ptr = Channel::CreateChannel(Instance, cname, TS);
}
else
{
@@ -359,9 +345,25 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool
}
}
+ /* As spotted by jilles, dont bother to set this on remote users */
+ if (IS_LOCAL(user) && Ptr->GetUserCounter() == 1)
+ Ptr->SetDefaultModes();
+
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;