Commit Graph

75 Commits

Author SHA1 Message Date
J-P Nurmi cb84ecac9c Port CIRCSock::ParseISupport() to use CMessage 2015-09-20 23:22:01 +02:00
J-P Nurmi 683379df7d CUtils::ParseServerTime(): fix handling of invalid timestamps 2015-09-18 01:16:01 +02:00
J-P Nurmi f1973fe81b MessageTest: prefer EXPECT_THAT and ContainerEq 2015-09-18 01:02:12 +02:00
J-P Nurmi 57fb58bf71 Fix CModeMessage::GetModes()
Thanks to KindOne for finding the bug. CModeMessage::GetModes()
must trim the colon that CMessage::GetParams() may include.
2015-09-17 13:26:24 +02:00
J-P Nurmi 08ad9c40cc QueryTest: fix signed vs. unsigned comparison warnings 2015-09-13 02:15:10 +02:00
J-P Nurmi 75ee9cec62 Add QueryTest 2015-09-10 01:44:06 +02:00
J-P Nurmi 1a3e9ecb86 Resolve #1045: Make CMessage retain the colon
If the colon was there when parsed, stick it back even if it would be
technically unnecessary.
2015-09-10 00:21:04 +02:00
J-P Nurmi ba76e041b9 Add OnNumericMessage() module hook (close #1069) 2015-09-07 16:41:15 +02:00
J-P Nurmi fc981fa44c MessageTest: test CTargetMessage in one place 2015-09-07 00:00:28 +02:00
J-P Nurmi f71a0a213e Add IRCSockTest 2015-09-07 00:00:28 +02:00
J-P Nurmi 5880bb4180 Add CMessage::GetType() 2015-09-07 00:00:25 +02:00
J-P Nurmi 2bee156316 CString CMessage::GetParams(): keep the colon, even at the beginning 2015-09-07 00:00:25 +02:00
J-P Nurmi 58fc0e91d7 Add CCTCPMessage::IsReply() 2015-09-07 00:00:24 +02:00
J-P Nurmi ec952024d7 Add CModeMessage 2015-09-07 00:00:24 +02:00
J-P Nurmi fa894a86b0 Add CNumericMessage 2015-09-07 00:00:24 +02:00
J-P Nurmi 50ed9adf8a Fix CMessage::GetParams() crash - thanks kerio 2015-09-05 23:45:26 +02:00
Alexey Sokolov 78ba391d70 Merge branch 'master' of github.com:znc/znc 2015-09-04 20:33:12 +01:00
Alexey Sokolov 1cc4626226 Add a test for --makeconf 2015-09-04 20:32:13 +01:00
J-P Nurmi a79acacfad Add missing CModules::OnCTCPReplyMessage() 2015-09-02 00:51:05 +02:00
J-P Nurmi 491fb50045 Cleanup MessageTest
Use CMessage::Parse(), which wasn't public when the tests were
originally written, to avoid the ugly static_casts.
2015-09-01 23:37:22 +02:00
J-P Nurmi 94055c1c82 Add ModulesTest
Just a simple unit test for CModules that checks that the legacy hooks
get called and any modifications flow back to the original CMessage
object as appropriate.
2015-08-31 00:24:30 +02:00
J-P Nurmi 55385a5d58 Add CTargetMessage: a base class for "targeted" priv/chan messages
This will be useful for implementing the upcoming OnUserXxxMessage()
module hooks, that are allowed to modify the message target.
2015-08-30 15:50:12 +02:00
J-P Nurmi 320abef756 Merge CChanMessage & CPrivMessage to... CTextMessage
This naming is a bit hairy. I chose CTextMessage because this type of
message carries a text argument. Alternatively, it could be also called
CPrivateMessage, because the IRC protocol calls it PRIVMSG. On the other
hand, ZNC module hooks use the "Priv" naming convention for private
messages. It would look a bit weird to have OnChanMsg(CPrivMessage)...

More details and reasoning of the merge in the previous commit message.
2015-08-30 15:50:12 +02:00
J-P Nurmi 3976651c35 Merge CChan+PrivAction, CChan+PrivCTCP, CChan+PrivNotice
OnUserAction(), OnUserCTCP(), and OnUserNotice() don't separate private
private and channel messages. A module could even redirect a message by
modifying its target, so technically, if they were two distinct types,
the type of a message could change on the way.

The original reason for the separation was that at some point during
CMessage development, GetChan() didn't exist in CPrivXxx, but only in
CChanXxx message types. To achieve cleaner implementation, the getter
was later promoted to CMessage and made return nullptr for non-channel
specific messages. From this point of view, the separation is also no
longer necessary since the CPrivXxx and CChanXxx types are API-wise
identical with each other.
2015-08-30 15:50:12 +02:00
J-P Nurmi 0ecc0d464f Make params optiona for the CMessage(CNick, CString, ...) ctor
Also fixes the build for Clang <= 3.4, broken by 9a7df7c.
2015-08-27 13:21:45 +02:00
J-P Nurmi 37cd61a667 Fix CMessage to prefix also empty last params with a colon 2015-08-27 12:33:47 +02:00
J-P Nurmi 9a7df7cbbe MessageTest: test also CMessage(CNick, CString, ...) 2015-08-27 12:31:57 +02:00
J-P Nurmi e1ae565e6f Fix GetText() for CTCP [ACTION]
Just like the recent problem with smileys; TrimLeft() is not the same
than TrimPrefix(), and TrimRight() is not the same than TrimSuffix().
2015-08-23 00:48:35 +02:00
J-P Nurmi 2ad2ee5620 Bring back the smileys - part II 2015-08-22 11:54:33 +02:00
J-P Nurmi b8088a5b02 Fix CMessage::ToString() to ':' -prefix the last param when appropriate
Close #1037
2015-08-21 22:08:16 +02:00
J-P Nurmi ff181a4a85 Add specialized types and hooks for the most common msgs
PRIVMSG, NOTICE, JOIN, PART, QUIT, NICK, KICK, TOPIC
2015-08-15 12:27:06 +02:00
J-P Nurmi a06bf1c985 Introduce a Message type (#506) 2015-08-15 12:26:16 +02:00
J-P Nurmi 51caa5c4cf Add CUtils::ParseServerTime() 2015-08-15 12:26:16 +02:00
J-P Nurmi 87ae630046 Merge pull request #991 from jpnurmi/initializer_list
Add initializer_list ctors for CString & MCString
2015-07-31 22:08:43 +02:00
J-P Nurmi d5cefbfb71 Fix StringTest
- EXPECT_EQ() takes the expected value first
2015-07-13 20:22:03 +02:00
J-P Nurmi 1aba508298 Add initializer_list ctors for CString & MCString 2015-07-13 19:04:14 +02:00
J-P Nurmi 56a92d4c0b Fix NetworkTest
- fix signed vs. unsigned comparison warning
- EXPECT_EQ() takes the expected value first
2015-07-13 18:32:27 +02:00
Alexey Sokolov da279f9622 Setup continuous testing on cygwin using AppVeyor 2015-05-04 10:17:58 +01:00
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