1
0
mirror of https://github.com/anope/anope.git synced 2026-07-07 11:23:13 +02:00

Add User::SetRealname().

git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1193 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
Robin Burchell w00t@inspircd.org
2008-09-30 18:45:09 +00:00
parent 726b74f355
commit 253d5824c4
2 changed files with 25 additions and 16 deletions
+4
View File
@@ -82,5 +82,9 @@ class User
/** Update the displayed ident (username) of a user record.
*/
void SetIdent(const std::string &ident);
/** Updates the realname of the user record.
*/
void SetRealname(const std::string &realname);
};
+21 -16
View File
@@ -103,6 +103,9 @@ void User::SetNewNick(const std::string &newnick)
if (this->na)
this->na->u = this;
}
if (debug)
alog("debug: %s changed nick to %s", this->nick, newnick.c_str());
}
void User::SetDisplayedHost(const std::string &host)
@@ -115,7 +118,7 @@ void User::SetDisplayedHost(const std::string &host)
this->vhost = sstrdup(host.c_str());
if (debug)
alog("debug: %s changes its vhost to %s", this->nick, host.c_str());
alog("debug: %s changed vhost to %s", this->nick, host.c_str());
update_host(this);
}
@@ -135,25 +138,27 @@ void User::SetIdent(const std::string &ident)
update_host(this);
}
void change_user_realname(User * user, const char *realname)
void User::SetRealname(const std::string &realname)
{
if (user->realname)
free(user->realname);
user->realname = sstrdup(realname);
if (realname.empty())
throw "realname empty in SetRealname";
if (user->na && (nick_identified(user)
|| (!(user->na->nc->flags & NI_SECURE)
&& nick_recognized(user)))) {
if (user->na->last_realname)
free(user->na->last_realname);
user->na->last_realname = sstrdup(realname);
}
if (this->realname)
free(this->realname);
this->realname = sstrdup(realname);
if (debug)
alog("debug: %s changes its realname to %s", user->nick, realname);
if (this->na && (nick_identified(this) ||
(!(this->na->nc->flags & NI_SECURE) && nick_recognized(this))))
{
if (this->na->last_realname)
free(this->na->last_realname);
this->na->last_realname = sstrdup(realname);
}
if (debug)
alog("debug: %s changed realname to %s", this->nick, realname);
}
/*************************************************************************/
/*************************************************************************/