]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Move CreateChannel to a constructor instead
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 6 Jan 2008 02:36:05 +0000 (02:36 +0000)
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 6 Jan 2008 02:36:05 +0000 (02:36 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8647 e03df62e-2008-0410-955e-edbf42e46eb7

include/channels.h
src/channels.cpp

index 3c95bb7fbb961dfd37d5ecd5e19477cd175dc02d..268adf47b1f642f0bc25c84a2f0456f39c05d77f 100644 (file)
@@ -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
index e252100f169a53e27d0528283042c373723ec2d9..c69f09107d8a113bd1e3f9e51b6724b33400f6c7 100644 (file)
 #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;