summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864>2008-09-30 18:45:09 +0000
committerRobin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864>2008-09-30 18:45:09 +0000
commita06c716766db4710f0cf81b2c6c2b0bca6e2b749 (patch)
tree6639d26802991718d5f116332f71f048e2c57283 /src
parentc036ed1f512792bb6cf35bcc329300a522e18a0a (diff)
Add User::SetIdent(). Also remove duplication by using update_host().
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1190 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r--src/users.c41
1 files changed, 15 insertions, 26 deletions
diff --git a/src/users.c b/src/users.c
index 78626c060..ff42b6d9d 100644
--- a/src/users.c
+++ b/src/users.c
@@ -120,6 +120,21 @@ void User::SetDisplayedHost(const std::string &host)
update_host(this);
}
+void User::SetIdent(const std::string &ident)
+{
+ if (ident.empty())
+ throw "empty ident in SetIdent";
+
+ if (this->vident)
+ free(this->vident);
+ this->vident = sstrdup(ident.c_str());
+
+ if (debug)
+ alog("debug: %s changed ident to %s", this->nick, username);
+
+ update_host(this);
+}
+
/*************************************************************************/
/*************************************************************************/
@@ -170,32 +185,6 @@ void change_user_realname(User * user, const char *realname)
alog("debug: %s changes its realname to %s", user->nick, realname);
}
-
-/*************************************************************************/
-
-/* Change the username of a user. */
-
-void change_user_username(User * user, const char *username)
-{
- if (user->vident)
- free(user->vident);
- user->vident = sstrdup(username);
- if (user->na && (nick_identified(user)
- || (!(user->na->nc->flags & NI_SECURE)
- && nick_recognized(user)))) {
- if (user->na->last_usermask)
- free(user->na->last_usermask);
-
- user->na->last_usermask =
- (char *)smalloc(strlen(common_get_vident(user)) +
- strlen(common_get_vhost(user)) + 2);
- sprintf(user->na->last_usermask, "%s@%s", common_get_vident(user),
- common_get_vhost(user));
- }
- if (debug)
- alog("debug: %s changes its username to %s", user->nick, username);
-}
-
/*************************************************************************/
/* Remove and free a User structure. */