diff options
author | Naram Qashat <cyberbotx@cyberbotx.com> | 2010-07-25 21:58:20 -0400 |
---|---|---|
committer | Naram Qashat <cyberbotx@cyberbotx.com> | 2010-07-25 21:58:20 -0400 |
commit | ae38212c1ce829c783edf971081c90137abb49a0 (patch) | |
tree | 5c652d9cdc38103dec6fa112d57fca882b4e3e44 /src/nickalias.cpp | |
parent | 15d7f0f6fe8bb903275f603f734c13f65f3aa906 (diff) |
Epic commit to replace most of the strings in Anope with a single Anope::string class, plus some other little fixes here and there. If you follow 1.9.x development and are testing things, THIS is one of those things that NEEDS testing.
Diffstat (limited to 'src/nickalias.cpp')
-rw-r--r-- | src/nickalias.cpp | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/src/nickalias.cpp b/src/nickalias.cpp index 8ffbac891..c18f93005 100644 --- a/src/nickalias.cpp +++ b/src/nickalias.cpp @@ -1,15 +1,14 @@ #include "services.h" #include "modules.h" -NickRequest::NickRequest(const std::string &nickname) +NickRequest::NickRequest(const Anope::string &nickname) { if (nickname.empty()) throw CoreException("Empty nick passed to NickRequest constructor"); - email = NULL; requested = lastmail = 0; - this->nick = sstrdup(nickname.c_str()); + this->nick = nickname; NickRequestList[this->nick] = this; } @@ -19,45 +18,39 @@ NickRequest::~NickRequest() FOREACH_MOD(I_OnDelNickRequest, OnDelNickRequest(this)); NickRequestList.erase(this->nick); - - if (this->nick) - delete [] this->nick; - if (this->email) - delete [] this->email; } /** Default constructor * @param nick The nick * @param nickcore The nickcofe for this nick */ -NickAlias::NickAlias(const std::string &nickname, NickCore *nickcore) +NickAlias::NickAlias(const Anope::string &nickname, NickCore *nickcore) { if (nickname.empty()) throw CoreException("Empty nick passed to NickAlias constructor"); else if (!nickcore) throw CoreException("Empty nickcore passed to NickAlias constructor"); - nick = last_quit = last_realname = last_usermask = NULL; time_registered = last_seen = 0; - this->nick = sstrdup(nickname.c_str()); + this->nick = nickname; this->nc = nickcore; nc->aliases.push_back(this); NickAliasList[this->nick] = this; - for (std::list<std::pair<ci::string, ci::string> >::iterator it = Config.Opers.begin(), it_end = Config.Opers.end(); it != it_end; ++it) + for (std::list<std::pair<Anope::string, Anope::string> >::iterator it = Config.Opers.begin(), it_end = Config.Opers.end(); it != it_end; ++it) { if (nc->ot) break; - if (stricmp(it->first.c_str(), this->nick)) + if (!this->nick.equals_ci(it->first)) continue; for (std::list<OperType *>::iterator tit = Config.MyOperTypes.begin(), tit_end = Config.MyOperTypes.end(); tit != tit_end; ++tit) { OperType *ot = *tit; - if (ot->GetName() == it->second) + if (ot->GetName().equals_ci(it->second)) { Alog() << "Tied oper " << nc->display << " to type " << ot->GetName(); nc->ot = ot; @@ -99,21 +92,13 @@ NickAlias::~NickAlias() else { /* Display updating stuff */ - if (!stricmp(this->nick, this->nc->display)) + if (this->nick.equals_ci(this->nc->display)) change_core_display(this->nc); } } /* Remove us from the aliases list */ NickAliasList.erase(this->nick); - - delete [] this->nick; - if (this->last_usermask) - delete [] this->last_usermask; - if (this->last_realname) - delete [] this->last_realname; - if (this->last_quit) - delete [] this->last_quit; } /** Release a nick from being held. This can be called from the core (ns_release) @@ -127,7 +112,7 @@ void NickAlias::Release() if (ircd->svshold) ircdproto->SendSVSHoldDel(this->nick); else - ircdproto->SendQuit(this->nick, NULL); + ircdproto->SendQuit(this->nick, ""); this->UnsetFlag(NS_HELD); } @@ -148,7 +133,7 @@ void NickAlias::OnCancel(User *) ircdproto->SendSVSHold(this->nick); else { - std::string uid = (ircd->ts6 ? ts6_uid_retrieve() : ""); + Anope::string uid = ircd->ts6 ? ts6_uid_retrieve() : ""; ircdproto->SendClientIntroduction(this->nick, Config.NSEnforcerUser, Config.NSEnforcerHost, "Services Enforcer", "+", uid); new NickServRelease(this->nick, uid, Config.NSReleaseTimeout); |