summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2013-08-12 20:10:06 +0200
committerattilamolnar <attilamolnar@hush.com>2013-08-12 20:10:06 +0200
commit37394a80c2b4a3948e4f0e850710c9518d9ba259 (patch)
tree9a15cf8cc9201f29ced2e510abc94e73c86db91a
parent558eea33dc323518dba505a99ffbb19b8fbe1267 (diff)
Clean up a few constructors
Do not silently correct a zero TS in Channel::Channel(); require callers to supply a valid TS instead
-rw-r--r--include/channels.h4
-rw-r--r--src/channels.cpp7
-rw-r--r--src/mode.cpp3
-rw-r--r--src/users.cpp5
4 files changed, 5 insertions, 14 deletions
diff --git a/include/channels.h b/include/channels.h
index fbb38d5da..0c7a3a20c 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -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);
diff --git a/src/channels.cpp b/src/channels.cpp
index c7913606f..cab4fb739 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -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)
diff --git a/src/mode.cpp b/src/mode.cpp
index 3206e5638..15f5c0d60 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -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));
}
diff --git a/src/users.cpp b/src/users.cpp
index 21079f0cc..0383aaaa4 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -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");
}