]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Clean up a few constructors
authorattilamolnar <attilamolnar@hush.com>
Mon, 12 Aug 2013 18:10:06 +0000 (20:10 +0200)
committerattilamolnar <attilamolnar@hush.com>
Mon, 12 Aug 2013 18:10:06 +0000 (20:10 +0200)
Do not silently correct a zero TS in Channel::Channel(); require callers to supply a valid TS instead

include/channels.h
src/channels.cpp
src/mode.cpp
src/users.cpp

index fbb38d5da9e4f53e0a9ae225dafb43f52cd46c11..0c7a3a20c96df484e3ed25321182e2cd521d0bae 100644 (file)
@@ -63,7 +63,9 @@ class CoreExport Channel : public Extensible, public InviteBase
 
  public:
        /** Creates a channel record and initialises it with default values
-        * @throw Nothing at present.
+        * @param name The name of the channel
+        * @param ts The creation time of the channel
+        * @throw CoreException if this channel name is in use
         */
        Channel(const std::string &name, time_t ts);
 
index c7913606f44ecdbce5907d66d88897c9a8d40575..cab4fb73964b9188b92b0c6c52a92faf87ce6f73 100644 (file)
@@ -40,15 +40,10 @@ namespace
 }
 
 Channel::Channel(const std::string &cname, time_t ts)
+       : name(cname), age(ts), topicset(0)
 {
        if (!ServerInstance->chanlist->insert(std::make_pair(cname, this)).second)
                throw CoreException("Cannot create duplicate channel " + cname);
-
-       this->name = cname;
-       this->age = ts ? ts : ServerInstance->Time();
-
-       topicset = 0;
-       modes.reset();
 }
 
 void Channel::SetMode(ModeHandler* mh, bool on)
index 3206e5638ca8efeac57a07b0d1ac0d9da55b40d2..15f5c0d60aec6e5bfaf892ae6f500df1ceaf980d 100644 (file)
@@ -893,9 +893,6 @@ ModeParser::ModeParser()
        /* Clear mode handler list */
        memset(modehandlers, 0, sizeof(modehandlers));
 
-       /* Last parse string */
-       LastParse.clear();
-
        seq = 0;
        memset(&sent, 0, sizeof(sent));
 }
index 21079f0cc2e7adc12b114e404ae8ed8138a6314b..0383aaaa413fc93e32a5ceb3e8b141b4d68cf1aa 100644 (file)
@@ -80,10 +80,7 @@ User::User(const std::string &uid, const std::string& sid, int type)
 
        ServerInstance->Logs->Log("USERS", LOG_DEBUG, "New UUID for user: %s", uuid.c_str());
 
-       user_hash::iterator finduuid = ServerInstance->Users->uuidlist->find(uuid);
-       if (finduuid == ServerInstance->Users->uuidlist->end())
-               (*ServerInstance->Users->uuidlist)[uuid] = this;
-       else
+       if (!ServerInstance->Users->uuidlist->insert(std::make_pair(uuid, this)).second)
                throw CoreException("Duplicate UUID "+std::string(uuid)+" in User constructor");
 }