~ubuntu-branches/ubuntu/lucid/inspircd/lucid-security

« back to all changes in this revision

Viewing changes to src/modules/m_knock.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Giacomo Catenazzi, Darren Blaber, Matt Arnold, Giacomo Catenazzi
  • Date: 2008-03-06 07:56:47 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080306075647-z8a4phxkn3vo3ajx
Tags: 1.1.17+dfsg-1
[ Darren Blaber ]
* New upstream release, fix /etc/init.d/inspircd stop.
* Fix the postrm script so there is no duplicate update-rc.d
* Fix the manpage so there are no more errors in it

[ Matt Arnold ]
*  Fix prerm so it works (Closes: #466924)

[ Giacomo Catenazzi ]
* Added me as uploader
* Add again support of dpatch in debian/rules
* Build sources only once!
* Correct make clean target, not to include generated ./inspircd on sources
* Don't change permission of configuration files, when starting inspircd
  (separation of policy and program).

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 *       | Inspire Internet Relay Chat Daemon |
3
3
 *       +------------------------------------+
4
4
 *
5
 
 *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
 
5
 *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
6
6
 * See: http://www.inspircd.org/wiki/index.php/Credits
7
7
 *
8
8
 * This program is free but copyrighted software; see
32
32
        CmdResult Handle (const char** parameters, int pcnt, userrec *user)
33
33
        {
34
34
                chanrec* c = ServerInstance->FindChan(parameters[0]);
 
35
                std::string line;
35
36
 
36
37
                if (!c)
37
38
                {
39
40
                        return CMD_FAILURE;
40
41
                }
41
42
 
42
 
                std::string line;
 
43
                if (c->HasUser(user))
 
44
                {
 
45
                        user->WriteServ("480 %s :Can't KNOCK on %s, you are already on that channel.", user->nick, c->name);
 
46
                        return CMD_FAILURE;
 
47
                }
43
48
 
44
49
                if (c->IsModeSet('K'))
45
50
                {
47
52
                        return CMD_FAILURE;
48
53
                }
49
54
 
 
55
                if (!c->modes[CM_INVITEONLY])
 
56
                {
 
57
                        user->WriteServ("480 %s :Can't KNOCK on %s, channel is not invite only so knocking is pointless!",user->nick, c->name);
 
58
                        return CMD_FAILURE;
 
59
                }
 
60
 
50
61
                for (int i = 1; i < pcnt - 1; i++)
51
62
                {
52
63
                        line = line + std::string(parameters[i]) + " ";
53
64
                }
54
65
                line = line + std::string(parameters[pcnt-1]);
55
66
 
56
 
                if (!c->modes[CM_INVITEONLY])
57
 
                {
58
 
                        user->WriteServ("480 %s :Can't KNOCK on %s, channel is not invite only so knocking is pointless!",user->nick, c->name);
59
 
                        return CMD_FAILURE;
60
 
                }
61
 
 
62
67
                c->WriteChannelWithServ((char*)ServerInstance->Config->ServerName,  "NOTICE %s :User %s is KNOCKing on %s (%s)", c->name, user->nick, c->name, line.c_str());
63
68
                user->WriteServ("NOTICE %s :KNOCKing on %s",user->nick,c->name);
64
69
                return CMD_SUCCESS;