summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2016-08-10 17:30:02 +0200
committerAttila Molnar <attilamolnar@hush.com>2016-08-10 17:30:02 +0200
commitc528328748444fa0f0cff1a0377a7a6b9e557905 (patch)
tree2d0352324447241761070f4889b7ea6e0d5f6f69
parentf87ad8e72c276443895720cdbf411f068cdf7cc6 (diff)
Initialize more User and LocalUser fields using the init list
-rw-r--r--src/usermanager.cpp7
-rw-r--r--src/users.cpp20
2 files changed, 12 insertions, 15 deletions
diff --git a/src/usermanager.cpp b/src/usermanager.cpp
index 95deca00a..7b4bbe281 100644
--- a/src/usermanager.cpp
+++ b/src/usermanager.cpp
@@ -83,14 +83,7 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs
this->unregistered_count++;
- /* The users default nick is their UUID */
- New->nick = New->uuid;
this->clientlist[New->nick] = New;
-
- New->registered = REG_NONE;
- New->signon = ServerInstance->Time();
- New->lastping = 1;
-
this->AddClone(New);
this->local_users.push_front(New);
diff --git a/src/users.cpp b/src/users.cpp
index 57a496c8b..24b2928ae 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -64,14 +64,14 @@ const char* User::FormatModes(bool showparameters)
}
User::User(const std::string& uid, Server* srv, int type)
- : uuid(uid)
+ : age(ServerInstance->Time())
+ , signon(0)
+ , uuid(uid)
, server(srv)
+ , registered(REG_NONE)
+ , quitting(false)
, usertype(type)
{
- age = ServerInstance->Time();
- signon = 0;
- registered = 0;
- quitting = false;
client_sa.sa.sa_family = AF_UNSPEC;
ServerInstance->Logs->Log("USERS", LOG_DEBUG, "New UUID for user: %s", uuid.c_str());
@@ -91,14 +91,18 @@ LocalUser::LocalUser(int myfd, irc::sockets::sockaddrs* client, irc::sockets::so
, bytes_out(0)
, cmds_in(0)
, cmds_out(0)
+ , quitting_sendq(false)
+ , lastping(true)
+ , exempt(false)
, nping(0)
+ , idle_lastmsg(0)
, CommandFloodPenalty(0)
, already_sent(0)
{
- exempt = quitting_sendq = false;
- idle_lastmsg = 0;
+ signon = ServerInstance->Time();
+ // The user's default nick is their UUID
+ nick = uuid;
ident = "unknown";
- lastping = 0;
eh.SetFd(myfd);
memcpy(&client_sa, client, sizeof(irc::sockets::sockaddrs));
memcpy(&server_sa, servaddr, sizeof(irc::sockets::sockaddrs));