~ubuntu-branches/ubuntu/oneiric/inspircd/oneiric

« back to all changes in this revision

Viewing changes to src/cmd_eline.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
27
27
 */
28
28
CmdResult cmd_eline::Handle (const char** parameters, int pcnt, userrec *user)
29
29
{
 
30
        std::string target = parameters[0];
 
31
 
30
32
        if (pcnt >= 3)
31
33
        {
32
 
                IdentHostPair ih = ServerInstance->XLines->IdentSplit(parameters[0]);
 
34
                IdentHostPair ih;
 
35
                userrec* find = ServerInstance->FindNick(target.c_str());
 
36
                if (find)
 
37
                {
 
38
                        ih.first = "*";
 
39
                        ih.second = find->GetIPString();
 
40
                        target = std::string("*@") + find->GetIPString();
 
41
                }
 
42
                else
 
43
                        ih = ServerInstance->XLines->IdentSplit(target.c_str());
 
44
                        
 
45
                if (ih.first.empty())
 
46
                {
 
47
                        user->WriteServ("NOTICE %s :*** Target not found", user->nick);
 
48
                        return CMD_FAILURE;
 
49
                }
 
50
 
33
51
                if (ServerInstance->HostMatchesEveryone(ih.first+"@"+ih.second,user))
34
52
                        return CMD_FAILURE;
35
53
 
36
 
                if (!strchr(parameters[0],'@'))
37
 
                {
38
 
                        user->WriteServ("NOTICE %s :*** E-Line must contain a username, e.g. *@%s",user->nick,parameters[0]);
39
 
                        return CMD_FAILURE;
40
 
                }
41
 
 
42
54
                long duration = ServerInstance->Duration(parameters[1]);
43
 
                if (ServerInstance->XLines->add_eline(duration,user->nick,parameters[2],parameters[0]))
 
55
                if (ServerInstance->XLines->add_eline(duration,user->nick,parameters[2],target.c_str()))
44
56
                {
45
 
                        FOREACH_MOD(I_OnAddELine,OnAddELine(duration, user, parameters[2], parameters[0]));
 
57
                        FOREACH_MOD(I_OnAddELine,OnAddELine(duration, user, parameters[2], target.c_str()));
46
58
 
47
59
                        if (!duration)
48
60
                        {
49
 
                                ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent E-line for %s.",user->nick,parameters[0]);
 
61
                                ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent E-line for %s.",user->nick,target.c_str());
50
62
                        }
51
63
                        else
52
64
                        {
53
65
                                time_t c_requires_crap = duration + ServerInstance->Time();
54
 
                                ServerInstance->SNO->WriteToSnoMask('x',"%s added timed E-line for %s, expires on %s",user->nick,parameters[0],
 
66
                                ServerInstance->SNO->WriteToSnoMask('x',"%s added timed E-line for %s, expires on %s",user->nick,target.c_str(),
55
67
                                                ServerInstance->TimeString(c_requires_crap).c_str());
56
68
                        }
57
69
                }
58
70
                else
59
71
                {
60
 
                        user->WriteServ("NOTICE %s :*** E-Line for %s already exists",user->nick,parameters[0]);
 
72
                        user->WriteServ("NOTICE %s :*** E-Line for %s already exists",user->nick,target.c_str());
61
73
                }
62
74
        }
63
75
        else
64
76
        {
65
 
                if (ServerInstance->XLines->del_eline(parameters[0]))
 
77
                if (ServerInstance->XLines->del_eline(target.c_str()))
66
78
                {
67
 
                        FOREACH_MOD(I_OnDelELine,OnDelELine(user, parameters[0]));
68
 
                        ServerInstance->SNO->WriteToSnoMask('x',"%s Removed E-line on %s.",user->nick,parameters[0]);
 
79
                        FOREACH_MOD(I_OnDelELine,OnDelELine(user, target.c_str()));
 
80
                        ServerInstance->SNO->WriteToSnoMask('x',"%s Removed E-line on %s.",user->nick,target.c_str());
69
81
                }
70
82
                else
71
83
                {
72
 
                        user->WriteServ("NOTICE %s :*** E-Line %s not found in list, try /stats e.",user->nick,parameters[0]);
 
84
                        user->WriteServ("NOTICE %s :*** E-Line %s not found in list, try /stats e.",user->nick,target.c_str());
73
85
                }
74
86
        }
75
87