Commit Graph

49 Commits

Author SHA1 Message Date
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
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
Alexey Sokolov
0952ee82e0 Don't set ConnectDelay to zero 2014-04-26 16:45:04 +01:00
J-P Nurmi
ed25ca21e6 Add CIRCNetwork::FindChans() 2014-03-02 23:24:34 +01: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
Falk Seidel
f19b4caa43 Welcome to 2014 - year 10 with ZNC 2013-12-31 10:10:55 +01:00
Alexey Sokolov
894e0a2f18 Return old fakeonline module as modules_online
It was accidentally dropped in 0.207 because of the confusing name,
it looked too much like antiidle module.

Instead, this module tells broken clients like Colloquy that *status and
*module are "online". Otherwise those clients require user to always
prepend messages to *module with "/msg *module", even if the window of
*module's query is active.

Also fix the module to support network modules
2013-09-01 22:21:11 +04: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
KindOne
2db7307ac3 Remove unneeded headers. 2013-03-08 01:47:57 +07:00
baines
c256116d81 Catch as references 2013-02-26 22:03:15 -05:00
Un1matr1x
3a34593359 The same procedure as last year, Miss sophie?
Same procedure as every year, James.
2012-12-31 12:44:31 +01:00
Alexey Sokolov
390957723c Fix changing client nick when client connects.
If nicks are equal, it's not changed. The problem was that equality was
checked case-insensitively.

This makes some clients which compare nicks case-sensitively think that
JOINs which we send to them, are not related to the user, it's someone
else joining. So Konversation users which have lower case version of
their IRC nick configured in Konversation settings, didn't get their
channel opened when connecting to ZNC.

Thanks to Axanon for helping to investigate the issue.
2012-12-26 00:36:49 +07:00
Alexey Sokolov
4f1fd1f6db Rename controlpanel to control, fix #240
It's just a shorter name, and hopefully still not as confusing as old
"admin".

Also unrelated change: fix case of few output lines during startup.
2012-10-19 22:14:25 +07:00
Alexey Sokolov
b5102355cb Add a way to move networks between users.
It should help for migrating old multiuser setup to new multinetwork
one.

Fix #217
2012-09-30 16:23:50 +07:00
Kyle Fuller
e06c3f5e88 Broken merge 2012-08-14 21:49:48 +07:00
Kyle Fuller
67299ebfa8 Fix a bunch of conversion warnings #197 2012-08-14 19:31:14 +07:00
Kyle Fuller
e54f423ace Merge pull request #204 from kylef/nick
Send a nick change to clients connecting with a different nick
2012-08-14 05:18:16 -07:00
Alexey Sokolov
27aa7036f5 Fix #117 2012-08-10 19:32:27 +07:00
Alexey Sokolov
2370567f9c Don't show message about missing motd by default.
To enable it, load missingmotd module.
Fix #202
2012-08-09 22:58:20 +07:00
Kyle Fuller
85a3115b8d Send a nick change to clients connecting with a different nick
Before we was hoping that the client was using the nick from 001, not all
clients supported this.

Closes #170
2012-07-28 03:09:08 +07:00
Kyle Fuller
721d603383 Support messages directed to specific user prefixes
Closes #195
2012-07-28 00:07:46 +07:00
Alexey Sokolov
62c9ac1a0b using in headers is evil :( 2012-07-26 20:46:11 +07:00
Alexey Sokolov
cebc093254 Per-network bind hosts.
Fix #147
2012-07-19 00:59:41 +07:00
Alexey Sokolov
f557d4b805 Rename away/autoaway module to awaystore.
Now it at least tries to explain what it does...
2012-04-15 00:06:26 +07:00
Kyle Fuller
db7c47f97d Rewrite the JOIN channel logic, dropping MaxJoins
Instead we fill the JOIN line up with as many channels as we can fit in
an IRC line. Rate limiting is done per command now, making MaxJoins
unnecessary.
2012-03-21 22:06:54 +00:00
Alexey Sokolov
c98abf00a5 Implement protection from flood.
For ZNC-server connection
2012-03-21 19:48:26 +07:00
Kyle Fuller
b447169011 Allow setting a network-specific settings the same as the user setting
Fixes #94
2012-01-17 22:01:19 +00:00
Kyle Fuller
3d7d1793aa Move IRCConnectEnabled to each network instead of a global user setting 2012-01-11 14:49:17 +00:00
Un1matr1x
73270ff023 Welcome in 2012 2012-01-01 09:30:19 +01:00
Uli Schlachter
01341cfb0a Fix some invalid iterator uses
This fixes #96. When the last user in a partyline channel is deleted, the
channel is deleted, too. This invalidates the iterator used in OnDeleteUser().
This fix is to increase the iterator before the channel can be deleted.

After the above fix, znc still crashed due to another broken use of iterators.
When a network is deleted, it takes all its clients with it (why aren't they
just moved into the "no network"-state?"). However, deleting a CClient removes
it from the network's list of clients via CClient::Disconnect(). This resulted
in another invalid use of iterators.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-12-29 13:54:24 +01:00
Uli Schlachter
cdc27e1434 Automatically load autoaway if away is requested
This module was renamed in f604709cf0.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-12-29 13:54:24 +01:00
Alexey Sokolov
57a51dfd78 Fix codestyle. 2011-12-29 11:52:41 +07:00
Lee Aylward
f4019b6740 send 422 event if MOTD buffer is empty 2011-12-07 19:09:23 -06:00
Kyle Fuller
01b15bfb5b Fix webadmin when editing a user
Since this creates a new user, and then clones it. It would clear all
the networks. To fix this, I have made an option bCloneNetworks to
CUser::Clone. This replaces the bCloneChans because this is unnessecery
now.

Fixes #88
2011-11-13 00:28:44 +00:00
Kyle Fuller
0b57b7d437 Properly handle CIRCNetwork's when we rehash
This commit does the following:
- Do not segfault on rehash
- Delete CIRCNetwork's when they are removed from config
- Update to the configs nick/altnick/realname/ident
2011-11-09 20:02:41 +00:00
Stéphan Kochen
c36480c8a1 Store and format time in CBufLine.
Buflines need to know which part of text to wrap with the timestamp. The
second parameter to `AddLine` (and shorthands) is that text, which after
wrapping is added as the `text` parameter to `NamedFormat`.

Timestamps are formatted at the moment buffers are flushed to the
client. The client parameter to `GetLine` provides access to the User
and the new server-time capability.
2011-10-27 18:25:25 +02:00
Stéphan Kochen
c3d677a4d8 Slight refactor of CBuffer & CBufLine.
This is in preparation of adding more attributes to a CBufLine. Going
forward, at least savebuf will need access to all of these to properly
serialize buffers.

Basically, instead of relying on `GetLine()` to return `false`, the
caller is now expected to check bounds himself using `Size()`.
2011-10-27 18:25:25 +02:00
Stéphan Kochen
cb4131e320 Unify channel buffers and CBuffer. 2011-10-27 18:25:25 +02:00
Stéphan Kochen
948ae2510c Rewrite Buffer to store a format string.
Will use this to allow more parameters to be inserted at the time the
buffers are flushed to the client.
2011-10-27 18:25:24 +02:00
Kyle Fuller
200940756b Update Csocket to d7206c6aa88bd7988f 2011-10-21 01:40:36 +00:00
Kyle Fuller
bce4e60c08 Allow a client to become "away"
The result of CIRCNetwork::IsUserOnline() will only show clients which
do not have the away state set. This value is not set from the IRC
command AWAY, but a future module could use this behaviour.

Some CIRCNetwork::IsUserAttached() checks are now moved into of
CIRCNetwork::IsUserOnline() checks.

This allows "away" clients to store buffer even if KeepBuffer is false.
2011-10-18 19:26:37 +00:00
Kyle Fuller
af24f7b9a7 Fix the "Connecting user/network" message
This debug line was printing the network twice instead of the username
2011-10-09 19:09:25 +00:00
Kyle Fuller
c7d171bfa1 Don't connect to SSLed IRC servers when ZNC is not compiled with SSL 2011-10-04 15:59:33 +00:00
Kyle Fuller
a4aedc90d3 Create a connection queue including all the networks we need to connect 2011-10-04 15:59:28 +00:00
Alexey Sokolov
afeab4a9e6 Move core .cpp files to src/ 2011-09-23 03:33:13 +07:00