Commit Graph

50 Commits

Author SHA1 Message Date
J-P Nurmi
aed1d61a98 Revise CChan::JoinUser() & AttachUser()
The old AttachUser() that sent JOIN without topic or names replies
would leave clients in incomplete/broken state. JoinUser() was doing
two things; depending on passed arguments it was either joining user
on the channel on IRC, or attaching clients (properly). Now JoinUser()
joins the user on IRC, and AttachUser() attaches as expected from the
method names.
2014-11-10 22:24:34 +01:00
J-P Nurmi
8d77faa260 Allow clients to specify an ID via PASS or USER
- PASS [user[@identifier][/network]:]password
- USER user[@identifier][/network] ...

NOTE: There's a slight ambiguosity with the '@' character, which happens
to be a valid character in usernames, but also acts as a marker for the
identifier. Therefore, '@' is considered as part of the username if it's
followed by non-word characters (as in an email address), otherwise as
a marker for an identifier.

This is only an enabler for #343. The rest can be done with modules:
- managing client ID specific playback buffers
- filtering channels based on the client ID

The reason this should be part of ZNC core is that only global modules
have access to OnUnknownUserRaw(), which is needed to capture USER/PASS.
First of all, the aforementioned modules shouldn't be global. Furthermore,
it would be possible to have only one module that parsed and removed the
client ID so that ZNC core woulnd't choke.
2014-11-04 00:42:28 +01:00
J-P Nurmi
382ce76ded Add self-message support
https://github.com/ircv3/ircv3-specifications/blob/master/extensions/self-message-3.2.md
2014-11-02 16:59:17 +01:00
J-P Nurmi
ba1b1da701 Make Detach, EnableChan and DisableChan accept multiple channels
These commands now take a comma/space separated list
2014-10-26 22:18:29 +01:00
Alexey Sokolov
e337cb433d Merge commit 'refs/pull/665/head' of github.com:znc/znc 2014-10-26 12:17:31 +00:00
J-P Nurmi
ef4caae6d1 const correctness fixes 2014-10-03 09:14:12 +02:00
J-P Nurmi
4fe249280e Fix GetClients() const correctness
It’s dangerous to give a non-const reference to an internal
container that the API users are not supposed to modify.
2014-10-03 09:11:03 +02:00
Alexey Sokolov
f4b8f69660 Merge pull request #689 from NuclearW/multitarget-notice+privmsg
Handle multi-receiver NOTICE and PRIVMSG
2014-09-29 23:41:14 +01:00
NuclearW
ecac78691e Handle multi-receiver NOTICE and PRIVMSG
This changes znc to handle multi-receiver messages in the same way it handles multi-channel join or parts.  This will ensure that no more than one target is ever given to a module for any given call.
2014-09-28 16:46:12 -04:00
NuclearW
73b6936d6d Add ircv3.2 batch and batch channel and query buffer playback. 2014-09-28 14:57:06 -04:00
Uli Schlachter
7704bc49d7 client auth: Switch from CSmartPtr to std::shared_ptr
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-09-12 15:12:46 +02:00
J-P Nurmi
14a534c953 Full-fledged query buffers
Store query buffers per query the same way it's done for channels.

This allows clients to implement persistent query buffers. Queries
remain open across clients and sessions until a client explicitly
sends a command to clear a (closed) query buffer.

A new config option AutoClearQueryBuffer that default to false
ensures behavioral backwards compatibility, and another config
MaxQueries protects from OOM eg. due to PM attacks.
2014-08-04 10:04:21 +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
J-P Nurmi
76bfa99dd0 Add module hooks for raw client and server messages 2014-03-04 00:24:15 +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
Nicolas Martyanoff
f215ec602f Include the command name in ERR_INVALIDCAPCMD messages
As described in the IRCv3 Client Capability Negotiation document
(http://ircv3.org/specification/capability-negotiation-3.1).
2014-01-23 12:44:07 +01:00
Falk Seidel
f19b4caa43 Welcome to 2014 - year 10 with ZNC 2013-12-31 10:10:55 +01: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
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
Kyle Fuller
9e7110175a DETACH should support the same syntax as PART (except no message)
Closes #225, this isn't the same as #225, but `/msg *status detach` is
something different, since it supports wildcard matching.
2012-12-22 17:16:57 +00:00
Alexey Sokolov
1c8485cebe Update server-time to new specs with ISO 8601 2012-11-24 01:45:36 +07:00
Alexey Sokolov
f54d4d443f Merge commit 'refs/pull/206/head' of github.com:znc/znc 2012-11-07 21:40:37 +07:00
Alexey Sokolov
ed83ac632d Hide current impl of server-time to znc.in/ namespace
The specs are going to change to support leap seconds properly,
so ZNC implementation will need to be updated.
But it would be too big change now, when 1.0-beta is out.

So support for this capability is delayed for 1.2
2012-10-16 19:50:16 +07:00
Alexey Sokolov
9b2898f603 Implement setting "Max number of networks" for user.
Fix #226
2012-09-20 01:24:47 +07:00
Alexey Sokolov
27aa7036f5 Fix #117 2012-08-10 19:32:27 +07:00
Alexey Sokolov
d37cb447a0 Use gettimeofday instead of clock_gettime.
POSIX.1-2008 deprecates gettimeofday...
So perhaps it will be changed back in future.

For now gettimeofday is more portable :(
2012-08-09 00:37:16 +07:00
Alexey Sokolov
44b382c6fc Update server-time implementation to match new standard. #181 2012-08-05 09:45:48 +07:00
Austin Morton
be76679065 change PutModule to handle multiple lines if need be. fixes #205 2012-07-28 02:11:00 -04:00
Alexey Sokolov
62c9ac1a0b using in headers is evil :( 2012-07-26 20:46:11 +07:00
Alexey Sokolov
07cb02c5d8 Show 410 to client for unknown CAP subcommand.
It's in CAP specs.
2012-07-24 19:51:53 +07:00
Alexey Sokolov
cebc093254 Per-network bind hosts.
Fix #147
2012-07-19 00:59:41 +07:00
Kyle Fuller
4ae6cb3061 DETACH: Don't show Detached from <channel> 2012-07-04 02:21:31 +01:00
Kyle Fuller
981963a41e Don't send our password required notice until after CAP negotiation 2012-06-28 21:15:12 +01:00
Kyle Fuller
283fe7a72b Send a 464 ERR_PASSWDMISMATCH to clients which do not supply a password
"Returned to indicate a failed attempt at registering a connection for
which a password was required and was either not given or incorrect."
2012-06-02 13:31:49 +01:00
Kyle Fuller
623ba081b3 rfc1459 states that PART can take multiple channels
Parameters: <channel>{,<channel>}

Fixes #175
2012-05-14 19:38:51 +01:00
Alexey Sokolov
27f42d1118 Rename (non-) KeepBuffer to AutoClearChanBuffer.
It should be a less confusing name...
2012-05-09 22:32:12 +07:00
Kyle Fuller
8863d853c9 Allow disabling the use of adding networks for non admins
Closes #122
2012-02-15 16:27:47 +00:00
Alexey Sokolov
b811ea83d5 Describe how to use networks. 2012-01-30 00:38:51 +07:00
Alexey Sokolov
fa287ef791 Make networks a bit less confusing.
If user is connected without network, try "default" network first, if it
exists. If not, try "user" network. If it doesn't exist too, just use
the first one.

Also configs converted from old configs have "default" network instead
of "user" one.
2012-01-27 22:51:09 +07:00
Kyle Fuller
13cfb161c9 Add outgoing lines to the buffer if we are "offline" 2012-01-15 03:54:52 +00:00
Un1matr1x
73270ff023 Welcome in 2012 2012-01-01 09:30:19 +01: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
cb4131e320 Unify channel buffers and CBuffer. 2011-10-27 18:25:25 +02:00
Stéphan Kochen
f7e5b41ab1 Add server time CAP and Client flag. 2011-10-27 18:25:24 +02:00
Kyle Fuller
7e5144df04 Make sure a IRCSock is authed before we use the nick
This fixes a bug where an unauthed IRC connection will cause your
clients nick to be the default nick. But this is before we update
the client to use this nick. If a client tried another nick when
connecting then they are still expecting this nick.
2011-10-19 11:24:39 +00:00
Kyle Fuller
eb1abb50e8 Fix the OnUserCTCP() module hook
This was broken when CClient was made network aware with ef2b2cf601
2011-10-16 23:27:10 +00:00
Alexey Sokolov
2c1ca45353 Merge branch 'headers' 2011-09-28 20:15:20 +07:00
Alexey Sokolov
afeab4a9e6 Move core .cpp files to src/ 2011-09-23 03:33:13 +07:00