Commit Graph

56 Commits

Author SHA1 Message Date
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
Uli Schlachter 29564f1c7e CFile: Make sure errno is always set correctly
This fixes weird problems were strerror() made us print garbage.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-01-22 18:51:01 +01:00
Uli Schlachter beacc0180c TDNS: Fix a use-after-free-race-with-threads
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-01-19 19:41:21 +01: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 f5dbe86543 CTCP's with no values should not be passed to the client
Fixes #105
2012-01-17 21:40:14 +00:00
Alexey Sokolov 937998d4a5 Merge branch 'master' into tdns 2012-01-15 13:12:28 +07:00
Alexey Sokolov ff8065ed32 TDNS: Fix few incompabilities with last Csocket. 2012-01-15 13:11:56 +07:00
Alexey Sokolov 0a7ef76de3 Use @t=time instead of @time for server-time capability.
It's incompatible change, but it makes protocol more flexible.
Version with @time was never released anyway.
2012-01-15 12:51:03 +07:00
Kyle Fuller 2d9a537c33 "no" should be false in CString::ToBool() 2012-01-15 05:18:13 +00:00
Kyle Fuller 13cfb161c9 Add outgoing lines to the buffer if we are "offline" 2012-01-15 03:54:52 +00:00
Stéphan Kochen 4bb365cda3 Update to Csocket 6da41d339f
Fixes build on OS X.
2012-01-15 02:36:03 +01:00
Uli Schlachter 10ece5d2cc CHTTPSock: Remove some useless member methods
The defaults from Csock / CSocket will be fine.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-01-14 12:09:25 +01:00
Uli Schlachter c87e7cf5ba Update Csocket to e00323f9f18
This breaks API for Csock::SockError()!

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-01-14 11:33:38 +01:00
Uli Schlachter 02e42958f0 Make certs valid for 10 years
Previously, a certificate generated with --makepem expired after a year which is
weird and pointless (come on, it's self-signed!).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-01-13 20:57:10 +01:00
Kyle Fuller c2316321b8 JUMPNETWORK: Tell the user we have switched network before we do
The reason for this is so that any messages sent in *status by attaching
a new network will show up after the switched message.

<*status> Switched to efnet
<*status> You are currently disconnected from IRC. Use 'connect' to reconnect.
2012-01-11 14:49:25 +00:00
Kyle Fuller 3d7d1793aa Move IRCConnectEnabled to each network instead of a global user setting 2012-01-11 14:49:17 +00:00
Kyle Fuller 4abf3feae4 Remove trailing whitespace 2012-01-11 13:18:54 +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
Alexey Sokolov 6bf026599c Change c-ares to tdns in output of /znc version 2011-12-28 10:39:12 +07:00
Alexey Sokolov 717d0596e3 Use threads for resolving DNS.
Drop support for c-ares. Though Csocket still supports it, ZNC's
configure script doesn't enable it anymore.

This should fix big brokenness of c-ares library, which tried to
connect via IPv6 even when IPv6 is disabled on the system.

Also should fix github issue #37
2011-12-27 00:29:51 +07:00
Lee Aylward f4019b6740 send 422 event if MOTD buffer is empty 2011-12-07 19:09:23 -06:00
Alexey Sokolov 9e047a3beb Store all 005 values in a map.
Thanks to jayne for requesting this.
2011-12-04 19:53:26 +07:00
Kyle Fuller 3945d435d9 Move delete networks out of looping over the clients in CUser::Clone
This was moved in the previous commit when I tried to merge it to the
commit below.
2011-11-13 03:30:30 +00: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
Alexey Sokolov 2ffcbed5bb Clarify the last commit a bit using a comment. 2011-11-12 09:46:14 +07: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
Kyle Fuller 74738a20b7 Fix a NULL pointer issue on CChan::SaveBuff
I also cleaned up a little and loop over vClients once instead of twice
2011-11-07 16:55:55 +00:00
Kyle Fuller 94ffcbed59 Don't forward a 670 to a client
This might result in the client switching to SSL if it supports it.
Breaking the current connection
2011-11-07 16:28:12 +00:00
Reuben Morais 6ed3b27af4 Clear text colors before appending timestamps to buffer lines 2011-11-04 00:35:35 -02:00
Alexey Sokolov 0b6d609014 Fix CZNC::Broadcast...
We need a good way to speak to users, not just sending some clients some
stuff...

Thanks to Cronus` for reporting this, as notify_connect failed for him
when using broken broadcast.
2011-11-04 00:04:32 +07:00
Uli Schlachter 9140a0dbd5 CZNC::WriteConfig(): Better --debug output
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-10-30 13:42:36 +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 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
Stéphan Kochen 2fdf54d43d Add string formatting function with named params.
In addition to the formatting function, a matching Escape type is added.
2011-10-27 18:25:24 +02:00
Stéphan Kochen f7e5b41ab1 Add server time CAP and Client flag. 2011-10-27 18:25:24 +02:00
Kyle Fuller a25316710d Respond to 670 from the server by switching to TLS
If a client sends STARTTLS to the IRC server, once the IRC server responds
with a 670 then it will expect all future communications to happen over
TLS.
2011-10-21 01:44:42 +00:00
Kyle Fuller 200940756b Update Csocket to d7206c6aa88bd7988f 2011-10-21 01:40:36 +00:00
Kyle Fuller 131a06594c Macro NETWORKMODULECALL to IRCSOCKMODULECALL inside CIRCSock
This saves a lot of repetitive lines (m_pNetwork->GetUser, m_pNetwork,
NULL)
2011-10-21 00:48:00 +00:00
Kyle Fuller b8c2da95f1 Make the OnInvite hook return EModRet so we can ignore invites 2011-10-21 00:20:58 +00:00
Kyle Fuller e11d338040 Pass the nick who send an invite with the OnInvite hook 2011-10-20 23:44:03 +00: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 8659d7224a Make UpdateModule reload the module for every module type
UpdateModule has been moved to CZNC because it doesn't really fit into
CUser. The new UpdateModule will reload the module for global modules,
user modules and network modules.

Fixes #69
2011-10-19 10:47:55 +00:00
Kyle Fuller 3a7d0150cf Don't include Modules.h from User.h 2011-10-19 09:56:21 +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 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