diff options
author | Robin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-09-30 18:45:09 +0000 |
---|---|---|
committer | Robin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-09-30 18:45:09 +0000 |
commit | c036ed1f512792bb6cf35bcc329300a522e18a0a (patch) | |
tree | 63851a9ecde77211004a1e806114f827456a9487 | |
parent | 902ef1ce040903dcfc8fe7adb54635a3681c0712 (diff) |
Move more stuff into the user class.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1189 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | include/extern.h | 1 | ||||
-rw-r--r-- | include/users.h | 5 | ||||
-rw-r--r-- | src/users.c | 36 |
3 files changed, 23 insertions, 19 deletions
diff --git a/include/extern.h b/include/extern.h index 069d217f4..709f0136a 100644 --- a/include/extern.h +++ b/include/extern.h @@ -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); diff --git a/include/users.h b/include/users.h index 2fe746bb2..87010bf04 100644 --- a/include/users.h +++ b/include/users.h @@ -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); }; diff --git a/src/users.c b/src/users.c index 83897fecf..78626c060 100644 --- a/src/users.c +++ b/src/users.c @@ -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) @@ -132,24 +150,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. */ void change_user_realname(User * user, const char *realname) |