~ubuntu-branches/ubuntu/trusty/kvirc/trusty

« back to all changes in this revision

Viewing changes to src/modules/options/optw_ctcpfloodprotection.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Kai Wasserbäch, Kai Wasserbäch, Raúl Sánchez Siles
  • Date: 2011-02-12 10:40:21 UTC
  • mfrom: (14.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110212104021-5mh4f75jlku20mnt
The combined "Twisted Experiment" and "Nocturnal Raid" release.

[ Kai Wasserbäch ]
* Synced to upstream's SVN revision 5467.
* debian/rules:
  - Added .PHONY line.
  - Resurrect -DMANUAL_REVISION, got lost somewhere and we build SVN
    revisions again.
  - Replace "-DWITH_NO_EMBEDDED_CODE=YES" with "-DWANT_CRYPTOPP=YES".
  - Change the remaining -DWITH/-DWITHOUT to the new -DWANT syntax.
* debian/control:
  - Removed DMUA, I'm a DD now.
  - Changed my e-mail address.
  - Removed unneeded relationships (no upgrades over two releases are
    supported).
  - Fix Suggests for kvirc-dbg.
  - kvirc-data: Make the "Suggests: kvirc" a Recommends, doesn't make much
    sense to install the -data package without the program.
* debian/source/local-options: Added with "unapply-patches".
* debian/kvirc.lintian-overrides: Updated to work for 4.1.1.
* debian/patches/21_make_shared-mime-info_B-D_superfluous.patch: Updated.
* debian/kvirc-data.install: Added .notifyrc.

[ Raúl Sánchez Siles ]
* Stating the right version where kvirc-data break and replace should happen.
* Fixing link to license file.
* Added French and Portuguese man pages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//=============================================================================
2
 
//
3
 
//   File : optw_ctcpfloodprotection.cpp
4
 
//   Creation date : Sun Jan 21 2001 14:35:06 CEST by Szymon Stefanek
5
 
//
6
 
//   This file is part of the KVirc irc client distribution
7
 
//   Copyright (C) 2001-2008 Szymon Stefanek (pragma at kvirc dot net)
8
 
//
9
 
//   This program is FREE software. You can redistribute it and/or
10
 
//   modify it under the terms of the GNU General Public License
11
 
//   as published by the Free Software Foundation; either version 2
12
 
//   of the License, or (at your opinion) any later version.
13
 
//
14
 
//   This program is distributed in the HOPE that it will be USEFUL,
15
 
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
 
//   See the GNU General Public License for more details.
18
 
//
19
 
//   You should have received a copy of the GNU General Public License
20
 
//   along with this program. If not, write to the Free Software Foundation,
21
 
//   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22
 
//
23
 
//=============================================================================
24
 
 
25
 
#include "optw_ctcpfloodprotection.h"
26
 
 
27
 
#include "kvi_options.h"
28
 
#include "kvi_locale.h"
29
 
 
30
 
#include <QLayout>
31
 
#include <QLabel>
32
 
 
33
 
 
34
 
/*
35
 
        @doc: ctcpfloodprotectionoptions
36
 
        @type:
37
 
                widget
38
 
        @title:
39
 
                CTCP flood protection options
40
 
        @short:
41
 
                Protection against CTCP flooding
42
 
        @keyterms:
43
 
                ctcp flood
44
 
        @body:
45
 
                Here, you can configure the CTCP flood protection system.[br]
46
 
                The CTCP engine in IRC clients may be subject to an attack, called "CTCP flooding".[br]
47
 
                Basically, the attackers (usually there is more than one offending client) sends a stream
48
 
                of CTCP requests to the victim's client, and the client attempts to respond to all requests
49
 
                by sending a stream of replies to the server, which causes the server to disconnect the user
50
 
                due to "excess flood" for sending too many messages before the server can process them.[br]
51
 
                Many user defined scripts choose to completely ignore all the CTCP requests in order to prevent such attacks.[br]
52
 
                KVIrc offers an alternative method that allows you to take advantage of the CTCP protocol
53
 
                and at the same time prevent the flood attacks.[br]
54
 
                The method is really simple: The client will only respond to a limited number of CTCP requests within a
55
 
                specified time interval.[br]
56
 
                The "Use flood protection" option enables this protection method.[br]
57
 
                In the "Allowed up to" field you should enter the maximum number of CTCP requests that KVIrc should
58
 
                respond to within the interval of time defined in the second field.[br]
59
 
                A strong protection against floods would be replying to 4 requests every 20 seconds.[br]
60
 
                The minimum effective setting is about 3 messages every 6 seconds.[br]
61
 
                Please note that 3 messages every 6 seconds is NOT the same as 10 messages every 20 seconds;
62
 
                the first setting would allow 3 requests within one second, but the client would
63
 
                ignore all the requests for the next 5 seconds, the second setting would allow 10 messages within one second
64
 
                and ignore everything for the next 19 seconds. Therefore, 3/6 is a safer setting.[br]
65
 
                The maximum protection you can set is 0 messages within any number of seconds; in that case any
66
 
                CTCP request will be considered a flood and ignored.[br]
67
 
                [br][br]
68
 
                You can also decide to ignore specific CTCP requests. For example, if you don't want to reply to PING
69
 
                requests, just select "PING" under the "Ignored Requests" section.[br]
70
 
                [br][br]
71
 
                Some specific protection options can be set also in other CTCP options sections:
72
 
                see the [widget:ctcpavatarprotooptions]CTCP AVATAR protocol options[/widget] and [widget:ctcpdccprotooptions]CTCP DCC protocol options[/widget].[br]
73
 
*/
74
 
 
75
 
 
76
 
KviCtcpFloodProtectionOptionsWidget::KviCtcpFloodProtectionOptionsWidget(QWidget * parent)
77
 
: KviOptionsWidget(parent)
78
 
{
79
 
        setObjectName("ctcpfloodprotection_options_widget");
80
 
 
81
 
        createLayout();
82
 
 
83
 
        KviBoolSelector * b = addBoolSelector(0,0,1,0,__tr2qs_ctx("Use flood protection for CTCP requests (recommended)","options"),KviOption_boolUseCtcpFloodProtection);
84
 
        mergeTip(b,__tr2qs_ctx("<center>This option makes KVIrc only respond to a limited number of CTCP requests within a specified time interval, to prevent \"flooding\" CTCP messages.</center>","options"));
85
 
 
86
 
        KviUIntSelector * u = addUIntSelector(0,1,0,1,__tr2qs_ctx("Allow up to:","options"),KviOption_uintMaxCtcpRequests,0,10000,3,KVI_OPTION_BOOL(KviOption_boolUseCtcpFloodProtection));
87
 
        u->setSuffix(__tr2qs_ctx(" requests","options"));
88
 
        mergeTip(u,__tr2qs_ctx("<center>Minimum value: <b>0 requests</b><br>Maximum value: <b>10000 requests</b></center>","options"));
89
 
        connect(b,SIGNAL(toggled(bool)),u,SLOT(setEnabled(bool)));
90
 
 
91
 
        u = addUIntSelector(1,1,1,1,__tr2qs_ctx("within:","options"),KviOption_uintCtcpFloodCheckInterval,1,3600,6,KVI_OPTION_BOOL(KviOption_boolUseCtcpFloodProtection));
92
 
        u->setSuffix(__tr2qs_ctx(" sec","options"));
93
 
        mergeTip(u,__tr2qs_ctx("<center>Minimum value: <b>1 sec</b><br>Maximum value: <b>3600 sec</b></center>","options"));
94
 
        connect(b,SIGNAL(toggled(bool)),u,SLOT(setEnabled(bool)));
95
 
 
96
 
        KviTalGroupBox * g = addGroupBox(0,2,1,2,Qt::Horizontal,__tr2qs_ctx("Ignored Ctcp Requests","options"));
97
 
        addBoolSelector(g,__tr2qs_ctx("PING","options"),KviOption_boolIgnoreCtcpPing);
98
 
        addBoolSelector(g,__tr2qs_ctx("FINGER","options"),KviOption_boolIgnoreCtcpFinger);
99
 
        addBoolSelector(g,__tr2qs_ctx("CLIENTINFO","options"),KviOption_boolIgnoreCtcpClientinfo);
100
 
        addBoolSelector(g,__tr2qs_ctx("USERINFO","options"),KviOption_boolIgnoreCtcpUserinfo);
101
 
        addBoolSelector(g,__tr2qs_ctx("VERSION","options"),KviOption_boolIgnoreCtcpVersion);
102
 
        addBoolSelector(g,__tr2qs_ctx("SOURCE","options"),KviOption_boolIgnoreCtcpSource);
103
 
        addBoolSelector(g,__tr2qs_ctx("TIME","options"),KviOption_boolIgnoreCtcpTime);
104
 
        addBoolSelector(g,__tr2qs_ctx("PAGE","options"),KviOption_boolIgnoreCtcpPage);
105
 
        addBoolSelector(g,__tr2qs_ctx("AVATAR","options"),KviOption_boolIgnoreCtcpAvatar);
106
 
        addBoolSelector(g,__tr2qs_ctx("DCC/TDCC","options"),KviOption_boolIgnoreCtcpDcc);
107
 
 
108
 
        addRowSpacer(0,3,1,3);
109
 
}
110
 
 
111
 
KviCtcpFloodProtectionOptionsWidget::~KviCtcpFloodProtectionOptionsWidget()
112
 
{
113
 
}
114
 
 
115
 
 
116
 
#ifndef COMPILE_USE_STANDALONE_MOC_SOURCES
117
 
#include "m_optw_ctcpfloodprotection.moc"
118
 
#endif //!COMPILE_USE_STANDALONE_MOC_SOURCES