summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-01-01 20:57:42 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-01-01 20:57:42 +0000
commit2cfcca8007d5fe3af11f51614d7b6c56e3cb242e (patch)
treed361839c3197362034775d7c4553f658bb5d0a4f
parent710777b2a78eef3654224fd659a7bac717691008 (diff)
Fixes to typos and change to return by reference on GetClass
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2725 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/helperfuncs.h2
-rw-r--r--src/cmd_pass.cpp4
-rw-r--r--src/helperfuncs.cpp6
-rw-r--r--src/users.cpp6
4 files changed, 9 insertions, 9 deletions
diff --git a/include/helperfuncs.h b/include/helperfuncs.h
index 9e1d511cb..5153620db 100644
--- a/include/helperfuncs.h
+++ b/include/helperfuncs.h
@@ -68,7 +68,7 @@ char* chanmodes(chanrec *chan);
void userlist(userrec *user,chanrec *c);
int usercount_i(chanrec *c);
int usercount(chanrec *c);
-ConnectClass* GetClass(userrec *user);
+ConnectClass GetClass(userrec *user);
void send_error(char *s);
void Error(int status);
int usercnt(void);
diff --git a/src/cmd_pass.cpp b/src/cmd_pass.cpp
index 0e40fea81..9bc6c1ae7 100644
--- a/src/cmd_pass.cpp
+++ b/src/cmd_pass.cpp
@@ -70,9 +70,9 @@ void cmd_pass::Handle (char **parameters, int pcnt, userrec *user)
WriteServ(user->fd,"462 %s :You may not reregister",user->nick);
return;
}
- ConnectClass* a = GetClass(user);
+ ConnectClass a = GetClass(user);
strlcpy(user->password,parameters[0],MAXBUF);
- if (!strcmp(parameters[0],a->pass.c_str()))
+ if (!strcmp(parameters[0],a.pass.c_str()))
{
user->haspassed = true;
}
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index 2ff939dc6..fd39aa0b1 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -1153,16 +1153,16 @@ int usercount(chanrec *c)
// looks up a users password for their connection class (<ALLOW>/<DENY> tags)
-ConnectClass* GetClass(userrec *user)
+ConnectClass GetClass(userrec *user)
{
for (ClassVector::iterator i = Config->Classes.begin(); i != Config->Classes.end(); i++)
{
if (match(user->host,i->host.c_str()))
{
- return (ConnectClass*)i->second;
+ return *i;
}
}
- return "";
+ return *(Config->Classes.begin());
}
/* sends out an error notice to all connected clients (not to be used
diff --git a/src/users.cpp b/src/users.cpp
index fd7efb7aa..e913086c2 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -642,14 +642,14 @@ void FullConnectUser(userrec* user, CullList* Goners)
user->idle_lastmsg = TIME;
log(DEBUG,"ConnectUser: %s",user->nick);
- ConnectClass* a = GetClass(user);
+ ConnectClass a = GetClass(user);
- if (a->type == CC_DENY)
+ if (a.type == CC_DENY)
{
Goners->AddItem(user,"Unauthorised connection");
return;
}
- if ((*(a->pass.c_str())) && (!user->haspassed))
+ if ((*(a.pass.c_str())) && (!user->haspassed))
{
Goners->AddItem(user,"Invalid password");
return;