Commit Graph

145 Commits

Author SHA1 Message Date
Uli Schlachter
d128b41844 Threads: Add some undefined constructors etc
This is needed to "get rid" of the C++ default implementation. Yes, I know that
this can be done way nicer with C++11...

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-08-06 14:50:58 +02:00
Uli Schlachter
680935723f Fix typo in last commit
Thanks to drbean for reporting this in FreeNode/#znc.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-07-14 15:56:03 +02:00
Uli Schlachter
ba11b8eecf Less magic numbers for timeout settings
Currently the connection timeout handling of znc uses three magic numbers, each
of which is at least repeated in two unrelated places. This commits defines the
numbers in CIRCNetwork and makes the other places just use this number.

This also renames PING_TIMEOUT to PING_FREQUENCY because I feel that describes
this constant better.

I am not really happy about the name NO_TRAFFIC_TIMEOUT that is used for the
real timeout, but I couldn't think of a better name. PING_TIMEOUT isn't good
because that sounds like the time between sending a PING and the resulting
timeout.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-07-14 15:33:36 +02:00
Alexander Færøy
2521d64a1c Add PING_TIMEOUT constant to CIRCNetwork 2014-06-18 21:04:20 +02:00
Alexander Færøy
299f3aa637 Split CUserTimer into CIRCNetworkPingTimer and CIRCNetworkJoinTimer
This patch splits CUserTimer into two other timers:

CIRCNetworkPingTimer: This timer sends PING messages to connected
client's and IRC servers.

CIRCNetworkJoinTimer: This timer enforces the MaxJoin setting by only
allowing a specified amount of channels to join at the same time.

JoinChans() is modified to reset the ping timer once we hit the MaxJoin.
This allows us to call it from any function without breaking the timing
logic.
2014-06-18 21:04:20 +02:00
Alexey Sokolov
93d2eec4db Update Csocket to ef6bcb9d5c1aecd778c5a57604eabdcb5e1ee06e 2014-06-17 23:22:16 +01:00
Alexey Sokolov
a3f4f1ebd9 Merge commit 'refs/pull/557/head' of github.com:znc/znc 2014-06-01 21:06:25 +01:00
Vasily Fomin
4338ae5cc5 Show empty checkbox if module can be loaded by the topic column.
Fix const correctnes of the CModInfo::SupportsType method.
2014-06-01 21:37:39 +02:00
Alexander Færøy
db0e0995e2 Add OnJoining module hook.
This patch adds an OnJoining module hook that allows a module to allow
or disallow joining any given channel.
2014-05-29 23:10:30 +02:00
Kyle Fuller
ed7119b5bc Update to latest version of Csocket
Fixes #536
2014-04-24 19:28:37 +01:00
Kyle Fuller
5e90bc380b [Csocket] Support and default to TLSv1.2
Updates to 21ac28cc29e9256a21a9aa217e29638360c266d0 of Csocket
2014-04-20 23:35:29 +01:00
Alexey Sokolov
370659895b Increase the version number to 1.5 2014-04-14 22:48:50 +01:00
Alexey Sokolov
9cf61ac6d4 Argh, fuck it. Rename fixed (pointer) versions of OnMode to OnMode2 2014-04-12 08:51:04 +01:00
J-P Nurmi
2b0c47aa8e Add CChan::SendBuffer(client, buffer) overload
This allows interested parties eg. modules to to send a partial
buffer playback without reinventing the wheel.
2014-03-04 08:27:10 +01:00
J-P Nurmi
76bfa99dd0 Add module hooks for raw client and server messages 2014-03-04 00:24:15 +01:00
Alexey Sokolov
77652768c6 Merge pull request #493 from jpnurmi/server-time
Promote server-time formatting to Utils
2014-03-03 22:44:49 +00:00
Alexey Sokolov
7d2f74acf4 Merge pull request #500 from jpnurmi/find-chans
Add CIRCNetwork::FindChans()
2014-03-03 22:38:41 +00:00
J-P Nurmi
ed25ca21e6 Add CIRCNetwork::FindChans() 2014-03-02 23:24:34 +01:00
J-P Nurmi
5f8f747704 Add CUtils::Get/SetMessageTags() 2014-03-02 23:18:39 +01:00
J-P Nurmi
bbd84a06bf Promote server-time formatting to Utils 2014-03-02 02:01:40 +01:00
Alexey Sokolov
618d9c58a4 Fix chansaver's channel keys by adding other OnMode() hooks 2014-02-27 00:49:45 +00:00
Alexey Sokolov
1c8e9b9355 Merge pull request #485 from uu1101/uriprefix
Allow serving the web interface under a subpath
Fix #480
Fix #138
2014-02-17 00:44:37 +00:00
uu1101
88c85b0396 Add URIPrefix listener option 2014-02-16 12:45:09 +01:00
uu1101
d3ddb9b69d The Listener of a RealListener is never NULL 2014-02-15 14:57:33 +01:00
uu1101
7a9ce630ef Add CString::StartsWith and CString::EndsWith 2014-02-15 12:41:54 +01:00
Alexey Sokolov
b7592008af Merge pull request #484 from KiNgMaR/singleton
Allow more control over CZNC singleton
2014-02-08 18:03:06 +00:00
Ingmar Runge
4c505946ac Patch ZNC core for more control over singleton... 2014-02-08 01:25:28 +01:00
Ingmar Runge
13040d9c72 Fix AddServerThrottle. 2014-02-06 23:36:01 +01:00
Ingmar Runge
b3021f913e squash some compiler warnings 2014-02-06 17:52:42 +01:00
Alexey Sokolov
dbdfa1e612 Merge pull request #466 from dgw/fix-shell-timeout
Remove accidental timeout in shell module
2014-01-27 14:18:04 -08:00
Alexey Sokolov
c0a5ecb40b Add support for character encodings
Previous commit added support of it to Csocket.
When encoding is specified, core will convert incoming messages to UTF-8,
and outgoing messages from UTF-8.
When no encoding is specified, it will do nothing to bytes, like before.
This is to be changed somewhere in future, to have UTF-8 on wire by
default too.
When encoding's name starts with *, incoming messages will be treated as
UTF-8, if it is already correct UTF-8. Otherwise, it's converted.

Fix #151
Fix #366
2014-01-25 13:50:07 +00:00
Alexey Sokolov
6012cdee77 Update Csocket to e818c7b0d31b0ed71c74f9d0035b58efd73f3988
This adds support for character encodings, and decreases CPU usage in
some cases
2014-01-25 13:50:07 +00:00
dgw
38fc398c2a Remove accidental timeout in shell module 2014-01-21 00:26:01 +04:00
Wuggingston Wugsalot
adafe9d197 Added CString::Join and CString::Convert
CString::Join works like python's string join, except that it takes 2
iterators (or pointers) instead of a whole collection
CString::Convert casts a string to another type using an intermediary
stringstream.
2014-01-18 21:37:59 +00:00
Alexey Sokolov
e0fd211053 Merge pull request #441 from psychon/websocks-expire-oldest
WebModules: Discard sessions in LRU order
2014-01-16 15:21:27 -08:00
Falk Seidel
f19b4caa43 Welcome to 2014 - year 10 with ZNC 2013-12-31 10:10:55 +01:00
Uli Schlachter
414fa40eb5 WebModules: Discard sessions in LRU order
Currently, znc has a limit of 5 web sessions per IP address. This limit exists
to defend against some obvious DoS attacks. When this limit is hit, some session
is discarded.

Previously, we would discard the session that std::multimap::find() would give
us. The multimap used mapped from IP addresses to sessions. Thus, we would
discard the oldest session.

This commit changes this into some least-recently-used logic. Whenever a session
is used, we record the timestamp of this. Then when a session has to be picked
for discarding, the one with the oldest timestamp is used.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-12-07 20:56:27 +01:00
Alexey Sokolov
3e56f093f2 X-Forwarded-For: verify the whole chain, from the end 2013-11-14 22:37:36 +04:00
Alexey Sokolov
ccbc469168 Merge commit 'refs/pull/349/head' of github.com:znc/znc 2013-11-14 08:27:50 +04:00
Alexey Sokolov
e8e95d770e Increase the version number to 1.3 2013-11-04 16:25:07 +04:00
Alexey Sokolov
49cf40b19c Increase the version number to 1.2 2013-11-04 16:07:13 +04:00
Alexey Sokolov
feca415c23 Fix a random crash with module hooks
How to reproduce:
1. have a global module which in a hook does something which calls
hooks too, e.g. Broadcast()
2. have another global module loaded after the first one which uses
m_pNetwork in that hook
3. enjoy the crash (or just weird behavior if you're unlucky)

So, when ZNC is setup with the "proper" global modules and in a special
order, one can crash it just from IRC, by triggering the needed module hooks.

Affected version: 1.0

Thanks to ChauffeR (Simone Esposito) for reporting the issue
and helping to debug it.
2013-10-20 22:33:57 +04:00
Alexey Sokolov
11efcee422 Merge commit 'refs/pull/422/head' of github.com:znc/znc 2013-10-20 17:42:45 +04:00
Ingmar Runge
b5c898eaff modules: add OnAddNetwork, OnDeleteNetwork hooks. 2013-10-18 20:35:21 +02:00
Toon Schoenmakers
9166f5a250 Renamed IsNick to NickEquals
Also added a TODO to add proper IRC case comparing.

Signed-off-by: Toon Schoenmakers <nighteyes1993@gmail.com>
2013-10-10 18:36:03 +02:00
Toon Schoenmakers
83b9a28e4c Implemented a nick compare function
As suggested by the todos in IRCSock, added IsNick(CString) method
so the ugly Nick.GetNick().Equals(GetNick()) could be simplified.

Signed-off-by: Toon Schoenmakers <nighteyes1993@gmail.com>
2013-10-10 17:22:16 +02:00
Stéphan Kochen
3d3ca53bf1 Add missing include for sys/stat.h. 2013-09-10 22:37:24 +02:00
Alexey Sokolov
d5e03cb736 Fix support for /msg @#chan :hi
005 STATUSMSG defines list of characters prependable to channel name,
but we used simple modes instead.

See
https://tools.ietf.org/html/draft-brocklesby-irc-isupport-03#section-3.16

Fix #272

Thanks to grawity for the link to 005 docs draft, and to carrot for
testing the patch.
2013-08-29 22:31:25 +04:00
Alexey Sokolov
b2dcad5fd4 Change ZNC license to Apache 2.0
The following people agreed with the change, in alphabetical order:
(people who approved in several ways are listed only once)
By email:
- Adam (from Anope)
- Austin Morton
- Brian Campbell
- Christian Walde
- Daniel Holbert
- Daniel Wallace
- Falk Seidel
- Heiko Hund
- Ingmar Runge
- Jim Hull
- Kyle Fuller
- Lee Aylward
- Martin Martimeo
- Matt Harper
- Michael J Edgar
- Michael Ziegler
- Nick Bebout
- Paul Driver
- Perry Nguyen
- Philippe (cycomate)
- Reuben Morais
- Roland Hieber
- Sebastian Ramacher
- Stefan Rado
- Stéphan Kochen
- Thomas Ward
- Toon Schoenmakers
- Veit Wahlich
- Wulf C. Krueger

By IRC:
- CNU
- Jonas Gorski
- Joshua M. Clulow
- Prozac/SHiZNO
- SilverLeo
- Uli Schlachter

At https://github.com/znc/znc/issues/311 :
- Alexey Sokolov
- Elizabeth Myers
- flakes
- Jens-Andre Koch
- Jyzee
- KindOne/ineedalifetoday
- Lee Williams
- Mantas Mikulėnas
- md-5
- Reed Loden

At the last few pull requests' comments:
- Allan Odgaard
- Jacob Baines
- Lluís Batlle i Rossell
- ravomavain
- protomouse

The following commits' authors didn't respond:
Trivial changes:
- f70f1086fd
- 4ca8b50e45

The changes which are not presented in master anymore:
- 5512ed2ea0
- 960a4498f7
- 0f739de2c0
- 7f53cc810b

Fix #311
Fix #218
2013-06-14 00:43:34 +04:00
Alexey Sokolov
a06b6495e8 Revert "Rewrite the JOIN channel logic, dropping MaxJoins"
This reverts commit db7c47f97d.

Too many joined channels at once started to cause disconnect because of
"Max SendQ Exceeded", which is not much better than previous Flood.

Now MaxJoins is 0 by default, which preserves the current behavior of
joining all channels at once. If someone experiences those disconnects
due to SendQ, they can tune MaxJoins.

Fix #329

Conflicts:
	include/znc/User.h
	modules/controlpanel.cpp
	modules/webadmin.cpp
	src/User.cpp
2013-06-09 23:39:10 +04:00