1
0
mirror of https://github.com/anope/anope.git synced 2026-07-03 05:53:12 +02:00

Move more stuff into the user class.

git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1189 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
Robin Burchell w00t@inspircd.org
2008-09-30 18:45:09 +00:00
parent 902ef1ce04
commit c036ed1f51
3 changed files with 23 additions and 19 deletions
-1
View File
@@ -1149,7 +1149,6 @@ E char *TS6SID;
E char *TS6UPLINK;
E void update_host(User * user);
E void change_user_host(User * user, const char *host);
E void change_user_username(User * user, const char *username);
E void change_user_realname(User * user, const char *realname);
+5
View File
@@ -73,5 +73,10 @@ class User
* called from ircd protocol.
*/
void SetNewNick(const std::string &newnick);
/** Update the displayed (vhost) of a user record.
* This is used (if set) instead of real host.
*/
void SetDisplayedHost(const std::string &host);
};
+18 -18
View File
@@ -105,10 +105,28 @@ void User::SetNewNick(const std::string &newnick)
}
}
void User::SetDisplayedHost(const std::string &host)
{
if (host.empty())
throw "empty host? in MY services? it seems it's more likely than I thought.";
if (this->vhost)
free(this->vhost);
this->vhost = sstrdup(host.c_str());
if (debug)
alog("debug: %s changes its vhost to %s", this->nick, host.c_str());
update_host(this);
}
/*************************************************************************/
/*************************************************************************/
/*
* XXX: I don't like how this "smells". I think it belongs in NickAlias/NickCore.
* -- w00t
*/
void update_host(User * user)
{
if (user->na && (nick_identified(user)
@@ -130,24 +148,6 @@ void update_host(User * user)
}
/*************************************************************************/
/* Change the (virtual) hostname of a user. */
void change_user_host(User * user, const char *host)
{
if (user->vhost)
free(user->vhost);
user->vhost = sstrdup(host);
if (debug)
alog("debug: %s changes its vhost to %s", user->nick, host);
update_host(user);
}
/*************************************************************************/
/* Change the realname of a user. */