]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/cmd_pass.cpp
Change to use std::string::iterator rather than making a copy of the pointer and...
[user/henk/code/inspircd.git] / src / cmd_pass.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
6  * See: http://www.inspircd.org/wiki/index.php/Credits
7  *
8  * This program is free but copyrighted software; see
9  *            the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 #include "users.h"
15 #include "commands/cmd_pass.h"
16
17
18
19 extern "C" command_t* init_command(InspIRCd* Instance)
20 {
21         return new cmd_pass(Instance);
22 }
23
24 CmdResult cmd_pass::Handle (const char** parameters, int pcnt, userrec *user)
25 {
26         // Check to make sure they havnt registered -- Fix by FCS
27         if (user->registered == REG_ALL)
28         {
29                 user->WriteServ("462 %s :You may not reregister",user->nick);
30                 return CMD_FAILURE;
31         }
32         ConnectClass* a = user->GetClass();
33         if (!a)
34                 return CMD_FAILURE;
35
36         strlcpy(user->password,parameters[0],63);
37         if (a->GetPass() == parameters[0])
38         {
39                 user->haspassed = true;
40         }
41
42         return CMD_SUCCESS;
43 }