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-10-01 22:07:10 +0000
committerRobin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864>2008-10-01 22:07:10 +0000
commit60b861ee251a7d9cc351545fe2314a400a4e81b3 (patch)
tree12412fc5d6571769605379b43b8e8d4f420d8c36 /src
parente46bc26a06cecb72ffe8587ec84997d89b75d852 (diff)
Nuke struct Uid from the core. (hooray!)
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1296 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r--src/bots.cpp2
-rw-r--r--src/botserv.c31
-rw-r--r--src/users.c85
3 files changed, 29 insertions, 89 deletions
diff --git a/src/bots.cpp b/src/bots.cpp
index fb77e0381..fe2c0e1ce 100644
--- a/src/bots.cpp
+++ b/src/bots.cpp
@@ -16,7 +16,6 @@ BotInfo::BotInfo(const char *nnick)
this->nick = sstrdup(nnick);
this->lastmsg = time(NULL);
this->uid = ts6_uid_retrieve(); // XXX is this safe? has ts6 been setup yet?
- new_uid(nnick, (char *)this->uid.c_str()); // XXX: this is required because we still pass nick prefix to protocol modules, DO AWAY WITH IT.
insert_bot(this); // XXX, this is ugly, but it needs to stay until hashing of bots is redone in STL.
nbots++;
}
@@ -29,7 +28,6 @@ BotInfo::BotInfo(const char *nnick, const char *nuser, const char *nhost, const
this->real = sstrdup(nreal);
this->lastmsg = time(NULL);
this->uid = ts6_uid_retrieve(); // XXX is this safe? has ts6 been setup yet?
- new_uid(nnick, (char *)this->uid.c_str()); // XXX: this is required because we still pass nick prefix to protocol modules, DO AWAY WITH IT.
insert_bot(this); // XXX, this is ugly, but it needs to stay until hashing of bots is redone in STL.
nbots++;
}
diff --git a/src/botserv.c b/src/botserv.c
index 745acb47c..ea31d70f7 100644
--- a/src/botserv.c
+++ b/src/botserv.c
@@ -589,30 +589,21 @@ void insert_bot(BotInfo * bi)
BotInfo *findbot(const char *nick)
{
- BotInfo *bi;
- Uid *ud;
+ BotInfo *bi;
- /* to keep make strict happy */
- ud = NULL;
+ if (!nick || !*nick)
+ return NULL;
- if (!nick || !*nick)
- return NULL;
+ for (bi = botlists[tolower(*nick)]; bi; bi = bi->next)
+ {
+ if (!stricmp(nick, bi->nick))
+ return bi;
- for (bi = botlists[tolower(*nick)]; bi; bi = bi->next) {
- if (UseTS6 && ircd->ts6) {
- ud = find_nickuid(nick);
- }
- if (!stricmp(nick, bi->nick)) {
- return bi;
- }
- if (ud && UseTS6 && ircd->ts6) {
- if (!stricmp(ud->nick, bi->nick)) {
- return bi;
- }
- }
- }
+ if (nick == bi->uid)
+ return bi;
+ }
- return NULL;
+ return NULL;
}
/*************************************************************************/
diff --git a/src/users.c b/src/users.c
index f203222fe..97af11136 100644
--- a/src/users.c
+++ b/src/users.c
@@ -18,7 +18,6 @@
User *userlist[1024];
#define HASH2(nick) (((nick)[0]&31)<<5 | ((nick)[1]&31))
-Uid *uidlist[1024];
int32 usercnt = 0, opcnt = 0;
uint32 maxusercnt = 0;
@@ -27,11 +26,11 @@ time_t maxusertime;
/*************************************************************************/
/*************************************************************************/
-User::User(const std::string &nick)
+User::User(const std::string &snick)
{
User **list;
// XXX: we could do well to steal CoreException from insp
- if (nick.empty())
+ if (snick.empty())
throw "what the craq, empty nick passed to constructor";
// XXX: we should also duplicate-check here.
@@ -47,7 +46,7 @@ User::User(const std::string &nick)
moduleData = NULL;
timestamp = my_signon = svid = mode = invalid_pw_time = lastmemosend = lastnickreg = lastmail = 0;
- strscpy(this->nick, nick.c_str(), NICKMAX);
+ strscpy(this->nick, snick.c_str(), NICKMAX);
list = &userlist[HASH(this->nick)];
this->next = *list;
@@ -56,7 +55,7 @@ User::User(const std::string &nick)
*list = this;
- this->na = findnick(nick);
+ this->na = findnick(snick);
if (this->na)
this->na->u = this;
@@ -119,17 +118,17 @@ void User::SetNewNick(const std::string &newnick)
alog("debug: %s changed nick to %s", this->nick, newnick.c_str());
}
-void User::SetDisplayedHost(const std::string &host)
+void User::SetDisplayedHost(const std::string &shost)
{
- if (host.empty())
+ if (shost.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());
+ this->vhost = sstrdup(shost.c_str());
if (debug)
- alog("debug: %s changed vhost to %s", this->nick, host.c_str());
+ alog("debug: %s changed vhost to %s", this->nick, shost.c_str());
update_host(this);
}
@@ -149,51 +148,51 @@ void User::SetIdent(const std::string &ident)
update_host(this);
}
-void User::SetRealname(const std::string &realname)
+void User::SetRealname(const std::string &srealname)
{
- if (realname.empty())
+ if (srealname.empty())
throw "realname empty in SetRealname";
if (this->realname)
free(this->realname);
- this->realname = sstrdup(realname.c_str());
+ this->realname = sstrdup(srealname.c_str());
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.c_str());
+ this->na->last_realname = sstrdup(srealname.c_str());
}
if (debug)
- alog("debug: %s changed realname to %s", this->nick, realname.c_str());
+ alog("debug: %s changed realname to %s", this->nick, srealname.c_str());
}
User::~User()
{
struct u_chanlist *c, *c2;
struct u_chaninfolist *ci, *ci2;
- char *realname;
+ char *srealname;
if (LogUsers)
{
- realname = normalizeBuffer(this->realname);
+ srealname = normalizeBuffer(this->realname);
if (ircd->vhost)
{
alog("LOGUSERS: %s (%s@%s => %s) (%s) left the network (%s).",
this->nick, this->username, this->host,
- (this->vhost ? this->vhost : "(none)"), realname, this->server->name);
+ (this->vhost ? this->vhost : "(none)"), srealname, this->server->name);
}
else
{
alog("LOGUSERS: %s (%s@%s) (%s) left the network (%s).",
this->nick, this->username, this->host,
- realname, this->server->name);
+ srealname, this->server->name);
}
- free(realname);
+ free(srealname);
}
send_event(EVENT_USER_LOGOFF, 1, this->nick);
@@ -486,54 +485,6 @@ User *next_uid(void)
return current_uid;
}
-Uid *new_uid(const char *nick, char *uid)
-{
- Uid *u, **list;
-
- u = (Uid *)scalloc(sizeof(Uid), 1);
- if (!nick || !uid) {
- return NULL;
- }
- strscpy(u->nick, nick, NICKMAX);
- list = &uidlist[HASH2(u->nick)];
- u->next = *list;
- if (*list)
- (*list)->prev = u;
- *list = u;
- u->uid = sstrdup(uid);
- return u;
-}
-
-Uid *find_uid(const char *nick)
-{
- Uid *u;
- int i;
-
- for (i = 0; i < 1024; i++) {
- for (u = uidlist[i]; u; u = u->next) {
- if (!stricmp(nick, u->nick)) {
- return u;
- }
- }
- }
- return NULL;
-}
-
-Uid *find_nickuid(const char *uid)
-{
- Uid *u;
- int i;
-
- for (i = 0; i < 1024; i++) {
- for (u = uidlist[i]; u; u = u->next) {
- if (!stricmp(uid, u->uid)) {
- return u;
- }
- }
- }
- return NULL;
-}
-
/*************************************************************************/
/*************************************************************************/