Commit Graph

37 Commits

Author SHA1 Message Date
J-P Nurmi 75b210e841 Search'n'replace remaining NULL occurrences (#816) 2015-02-26 20:58:01 +01:00
Alexey Sokolov 962cb945eb Merge pull request #869 from jpnurmi/wildcmp
CString::WildCmp(): add an optional case-sensitivity argument
2015-02-23 00:05:25 -08:00
J-P Nurmi afaf255246 CString::WildCmp(): add an optional case-sensitivity argument
It's getting a common pattern to call AsLower() or MakeLower() on
the arguments passed to WildCmp(), we might as well add this for
convenience. It's tempting to make it case-insensitive by default,
since pretty much any IRC related comparison should be, but that
could potentially break some existing code.
2015-02-23 08:45:52 +01:00
J-P Nurmi 7345a6ee3a Fix CIRCNetwork::FindChans() and FindQueries() to be case-insensitive
The playback module failed to clear a buffer, because it tried to
clear "NickServ" whereas ZNC had internally stored it has "nickserv".
2015-02-19 08:45:58 +01:00
Falk Seidel 2e29d49a53 Welcome to 2015 2014-12-31 11:28:38 +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 8fdf51dfeb Fix CNick::Parse()
If the mask started with ':', the following '!' was included to nick.
2014-11-01 13:17:32 +01:00
Alexey Sokolov 213c3839a8 Merge pull request #693 from jpnurmi/tags
Valueless & escaped message tags
2014-09-29 23:53:55 +01:00
J-P Nurmi e20ac1a31e Add CString::Contains() for convenience
This is more convenient and readable than comparing Find() to npos,
which is a common task:

$ git grep "find(" | grep "npos" | wc -l
49
2014-09-30 00:15:34 +02:00
J-P Nurmi 5507e9a290 Add CString::Find() with case sensitivity support 2014-09-30 00:15:22 +02:00
J-P Nurmi 92c9a2e6ae Escape message tag values (ref #684) 2014-09-30 00:02:22 +02:00
J-P Nurmi 65f739980d CString::Starts/EndsWith(): allow specifying case sensitivity 2014-09-29 16:41:07 +02:00
J-P Nurmi e86f43d841 Introduce CaseSensitivity enum class
The enum is a bit more verbose, but leads to more readable code:

str.Equals("foo", true)
// vs.
str.Equals("foo", CString::CaseSensitive)

Deprecate the old Equals() and leave out the length parameter
from the new version => use StartsWith() or StrCmp() instead.
2014-09-29 16:30:45 +02:00
J-P Nurmi 615801c40e Fix valueless message tags (closes #684) 2014-09-29 14:06:41 +02:00
Uli Schlachter 74fdd97a52 CJob: Even cancel finished jobs
When a job was cancelled after its runThread() method finished, but before the
main thread noticed this and reacted, we would just run runMain() before and
pretend the job finished normally.

However, with CModuleJob this means that runMain() might get called for a module
which is currently being destructed. This has bad effects with virtual functions
and thus causes problems. It's better to just really cancel the job instead.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-08-11 09:09:38 +02:00
Uli Schlachter 1d67e87d90 CThreadPool: Add cancellation support
This adds CThreadPool::cancelJob() and cancelJobs() which can cancel a set of
jobs synchronously. These functions only return when the job was successfully
cancelled.

It tries to cancel the jobs as quickly as possible, skipping any callbacks on
CJob that were not yet called. A job that is already running can use
CJob::wasCancelled() to check if it should quit.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-08-06 15:15:57 +02:00
Uli Schlachter 0e057702db Add a ThreadTest to the testsuite
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-08-06 14:50:59 +02:00
Uli Schlachter d4fefd1888 StringTest: Make a local function static
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-08-06 14:50:58 +02:00
Alexey Sokolov 5237e89bc3 Fix message tags parser and add test of it 2014-03-03 22:35:56 +00:00
Alexey Sokolov 0696a6ed23 Cleanup old tests (pre-gtest) 2014-03-03 21:38:18 +00:00
Falk Seidel f19b4caa43 Welcome to 2014 - year 10 with ZNC 2013-12-31 10:10:55 +01:00
Alexey Sokolov 256be59ffe Test CConfig too 2013-10-13 21:00:44 +04:00
Alexey Sokolov 91e5330db5 More string tests. 2013-10-13 21:00:43 +04:00
Alexey Sokolov 257e681036 Rename EscapeTest to StringTest 2013-10-13 21:00:43 +04:00
Alexey Sokolov e13bfa1110 Use gtest for EscapeTest 2013-10-05 23:30:27 +04:00
KindOne 2db7307ac3 Remove unneeded headers. 2013-03-08 01:47:57 +07:00
baines 82a708d6a1 Cleaned up more warnings. 2013-02-27 20:53:14 -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
Wulf C. Krueger 3be9c7a9db Fix the tests for out-of-source builds. 2012-09-09 18:31:10 +07:00
Wulf C. Krueger 2c23c45cc4 Fix the tests... again. 2012-09-08 16:17:05 +07:00
Wulf C. Krueger 4f3094e6c7 Fix the tests.
Due to the restructure directory layout, header files weren't found
anymore.

CConfigEntry was moved out of CConfig which had to be reflected in
ConfigTest.
2012-06-02 21:48:07 +02:00
Un1matr1x 73270ff023 Welcome in 2012 2012-01-01 09:30:19 +01:00
Uli Schlachter 013d0d2773 Drop @DEFS@ from the build system
This will only ever be set to -DHAVE_CONFIG_H. However, we shouldn't give this
flag to other people's code (e.g. through znc-config). Since we don't need it,
it's best to just drop it completely.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-09-02 18:21:50 +02:00
Uli Schlachter da0ba75549 Fix CString::Escape_n() and add some tests for it
This bug was originally reported by someone on irc, but sadly I forgot who it
was. Sorry!

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-08-05 16:09:22 +02:00
Kyle Fuller 5cf5775bbc Fix ConfigTest.cpp and cert.cpp so they compile
This was broken since ZNCDebug.cpp was introduced
2011-04-04 19:19:29 +01:00
Uli Schlachter 2003465489 Config: Fix some errors in the comment handling
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-04-01 21:46:14 +02:00
Uli Schlachter 70c7745899 Overhaul the config parsing
This moves stuff to a two-step model. First, the new class CConfig reads the
config file, parses it and creates a in-memory model of stuff. Only then do we
actually go forward and apply the stuff.

The upside of this is that some config errors are caught before we change
anything on the running upside.

Let's see how much stuff this broke...

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-04-01 21:43:05 +02:00