100 Commits
Author SHA1 Message Date
J-P Nurmi d66cb36cc3 Unit test CClient message handlers 2015-09-21 23:26:50 +02:00
J-P Nurmi 3cb2834cc5 Fix STATUSMSG buffering 2015-09-21 15:41:20 +02:00
J-P Nurmi 565d04a8ef Resolve 'make test' warnings
Fix our own, and hide csocket, gtest & gmock related.
2015-09-21 15:41:20 +02:00
J-P Nurmi e879203d54 Merge branch '1.6.x'
Conflicts:
	modules/bouncedcc.cpp
2015-09-20 23:36:44 +02:00
J-P Nurmi c83a41ce89 CClient: message handlers 2015-09-20 23:22:03 +02:00
J-P Nurmi 4d3b47f2b1 Refactor CClient::ReadLine() to take advantage of CMessage::Type 2015-09-20 23:22:03 +02:00
J-P Nurmi 0c6215df9e CClient: use CModeMessage 2015-09-20 23:22:03 +02:00
J-P Nurmi 658db6bbe6 Make CMessage::ToString() use GetParams()
Avoids having the same loop in two places.

GetParams() was under consideration to be removed after the CMessage
porting work is done, but it's starting to look like it's here to stay.
There are cases, such as mode messages, where "get all params starting
from position N" is handy.
2015-09-20 23:22:03 +02:00
J-P Nurmi ecb9b21055 Move message tags related code from CUtils to CMessage 2015-09-20 23:22:03 +02:00
J-P Nurmi 7d10ad2625 CBuffer: add CMessage-based API 2015-09-20 23:22:03 +02:00
J-P Nurmi cbd860c2a9 Add CMessage::Equals()
Compares sender, command, and parameters. Not timestamp nor tags.
2015-09-20 23:22:02 +02:00
J-P Nurmi c223d3a500 Unit test CClient::PutClient(CMessage) 2015-09-20 23:22:02 +02:00
J-P Nurmi 467d48cb45 Share the unit test classes 2015-09-20 23:22:02 +02:00
J-P Nurmi dce6d4f0ea Make CClient::PutClient() handle multi-prefix 2015-09-20 23:22:02 +02:00
J-P Nurmi f7802209ae Make CClient::PutClient() handle extended-join 2015-09-20 23:22:02 +02:00
J-P Nurmi f4c22aff6c Incorporate CIRCSock::ForwardRaw353() into CClient::PutClient() 2015-09-20 23:22:02 +02:00
J-P Nurmi 69f1138052 CClient::PutClient(): handle away-notify and account-notify 2015-09-20 23:22:02 +02:00
J-P Nurmi 0f2a37707f CIRCSock::OnNumericMessage(): replace Token(n) with GetParam(m)
CMessage has already done the work to split the line to params.
2015-09-20 23:22:01 +02:00
J-P Nurmi cb84ecac9c Port CIRCSock::ParseISupport() to use CMessage 2015-09-20 23:22:01 +02:00
J-P Nurmi 6ad7cdb4a2 Resolve #818: "Got ZNC?" is a little weird real name 2015-09-20 23:22:01 +02:00
J-P Nurmi f29363752b Travis CI: reduce the amount of builds to 5
So all (max 5) builds can run in parallel. This should speedup the CI
rounds a lot.

Candidates:
- Linux/Clang/normal
  We already have address and thread sanitizer -enabled Clang builds on
  Linux, and a normal Clang build on OSX.
- OSX/USE_SYSTEM_OPENSSL
  The system OpenSSL headers have been deprecated since OSX 10.7, and
  are being removed in OSX 10.11.
2015-09-20 23:19:12 +02:00
J-P Nurmi 439ea98da9 crypt: add missing override [-Winconsistent-missing-override] 2015-09-20 23:18:31 +02:00
J-P Nurmi 3c2ec45d4c Fix more warnings [-Winconsistent-missing-override] 2015-09-20 17:30:48 +02:00
J-P Nurmi 078eef5ba9 partyline: send RPL_ISUPPORT regardless of network or IRC connection
The behavior of IRC clients is unpredictable if they don't get the
appropriate CHANTYPES for partyline channels. Thus, send RPL_ISUPPORT
with the appropriate CHANTYPES also when a client is not connected to
a network, or when the network is not connected to IRC.
2015-09-20 02:19:58 +02:00
J-P Nurmi c0f6b68c05 Merge branch '1.6.x' 2015-09-20 02:19:46 +02:00
J-P Nurmi 3058a0e69a Fix warnings [-Winconsistent-missing-override] 2015-09-19 21:01:20 +02:00
J-P Nurmi cde9053205 Fix memset() in CUtils::ParseServerTime() 2015-09-18 09:26:58 +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 74f6d3839b Merge branch '1.6.x' 2015-09-17 23:18:20 +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 6d42675a3a CMessage::SetParams(): forget the colon
1a3e9ec made CMessage try to retain the colon if the original message
contained one. We should not, however, remember that when the params
are replaced entirely. Consider for example an extended-join message
that is made suitable for a client that doesn't have extended-join
capability:

    CMessage msg(":nick!ident@host JOIN #chan account :real name");
    msg.SetParams({msg.GetParam(0)});
    msg.ToString(); // ":nick!ident@host JOIN :#chan"
2015-09-13 02:17:57 +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 b3bb6fb5db GTest: force the simple internal regex engine...
...to get consistent behavior on all platforms.
2015-09-10 01:44:06 +02:00
J-P Nurmi 73d5f382f8 Docs for the CMessage-based module hooks 2015-09-10 01:38:53 +02:00
J-P Nurmi 66febcc7e8 Docs: leave out anything besides include/ and src/
Leave out various module implementation detail classes and the whole
gtest & gmock class sets from the docs. Csocket is included meanwhile
it's still exposed in the public API.
2015-09-10 01:38:53 +02:00
J-P Nurmi 7f03484899 CClient: add ATTACH command
The main benefit is that (unlike JOIN) ATTACH allows wildcards.
It's also nicely symmetric with DETACH.
2015-09-10 01:12:19 +02:00
J-P Nurmi 832430659f CClient: share the chan detaching code 2015-09-10 01:12:19 +02:00
J-P Nurmi 7916efa997 CClient: share the chan matching code 2015-09-10 01:12:19 +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 db64e34e28 Merge branch '1.6.x' 2015-09-09 18:49:47 +02:00
J-P Nurmi ba76e041b9 Add OnNumericMessage() module hook (close #1069) 2015-09-07 16:41:15 +02:00
J-P Nurmi d6a94936b9 Merge pull request #1054 from jpnurmi/cmessage-type
Add CMessage::GetType()
2015-09-07 10:13:50 +02:00
J-P Nurmi 1a7cf9d6ba CIRCSock: make the message handlers private
These should not be called from the outside of the class.
2015-09-07 00:00:29 +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 c7cb7fca3f Cleanup CIRCSock::ReadLine() 2015-09-07 00:00:28 +02:00
J-P Nurmi dae21026fa CIRCSock::OnErrorMessage() handler 2015-09-07 00:00:28 +02:00
J-P Nurmi 41b71e3a40 CIRCSock::OnPing/PongMessage() handlers 2015-09-07 00:00:28 +02:00
J-P Nurmi da06aacd4d CIRCSock::OnNumericMessage() handler 2015-09-07 00:00:28 +02:00
J-P Nurmi 0446aaa929 CIRCSock::OnModeMessage() handler 2015-09-07 00:00:27 +02:00
J-P Nurmi b8dbdb0a4b CIRCSock::OnWallopsMessage() handler 2015-09-07 00:00:27 +02:00
J-P Nurmi 1346718308 CIRCSock::OnCapabilityMessage() handler 2015-09-07 00:00:27 +02:00
J-P Nurmi d3f42cabeb CIRCSock::OnInviteMessage() handler 2015-09-07 00:00:27 +02:00
J-P Nurmi 05fbb52173 CIRCSock::OnAccountMessage() handler 2015-09-07 00:00:27 +02:00
J-P Nurmi d556a29218 CIRCSock::OnAwayMessage() handler 2015-09-07 00:00:27 +02:00
J-P Nurmi d53a2d1f24 CIRCSock::OnTextMessage() handler 2015-09-07 00:00:27 +02:00
J-P Nurmi 236bd7249f CIRCSock::OnActionMessage() handler 2015-09-07 00:00:26 +02:00
J-P Nurmi 74be5522d1 CIRCSock::OnCTCPMessage() handler 2015-09-07 00:00:26 +02:00
J-P Nurmi 30bb92fec3 CIRCSock::OnNoticeMessage() handler 2015-09-07 00:00:26 +02:00
J-P Nurmi b459cdf85b CIRCSock::OnTopicMessage() handler 2015-09-07 00:00:26 +02:00
J-P Nurmi 3349011a12 CIRCSock::OnKickMessage() handler 2015-09-07 00:00:26 +02:00
J-P Nurmi 9f9304a253 CIRCSock::OnPartMessage() handler 2015-09-07 00:00:26 +02:00
J-P Nurmi a2110da245 CIRCSock::OnJoinMessage() handler 2015-09-07 00:00:26 +02:00
J-P Nurmi a0a2b0fb4e CIRCSock::OnQuitMessage() handler 2015-09-07 00:00:25 +02:00
J-P Nurmi 41a9b36687 CIRCSock::OnNickMessage() handler 2015-09-07 00:00:25 +02:00
J-P Nurmi c4a216c554 CIRCSock::ReadLine(): use CMessage::GetType() 2015-09-07 00:00:25 +02:00
J-P Nurmi 77ddb3c420 CClient::ReadLine(): use CMessage::GetType() 2015-09-07 00:00:25 +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 17d07d5a74 CIRCSock: handle raw 352 (RPL_WHOREPLY) using CMessage 2015-09-07 00:00:25 +02:00
J-P Nurmi 795ea45f69 CIRCSock::ForwardRaw353(): use CMessage 2015-09-07 00:00:24 +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 b95f1f7fbf echo-message: status/module should echo before replies (#1022) 2015-09-06 10:45:42 +02:00
J-P Nurmi 50ed9adf8a Fix CMessage::GetParams() crash - thanks kerio 2015-09-05 23:45:26 +02:00
J-P Nurmi ce0ddd3aac Merge pull request #1059 from jpnurmi/networklesshooks
Don't require network for OnUserXxxMessage() hooks
2015-09-04 23:29:49 +02:00
J-P Nurmi 0faafbf3bf Merge pull request #1056 from jpnurmi/handlecap
Implement CClient::HandleCap() using CMessage (ref #1013)
2015-09-04 20:49:11 +02:00
J-P Nurmi 0211b34a09 Merge pull request #1057 from jpnurmi/echo-status
Fix #1022: Status and module commands not echoed back to client
2015-09-03 20:11:57 +02:00
J-P Nurmi 2880368825 Merge pull request #1055 from jpnurmi/onctcpreplymessage
Add missing CModules::OnCTCPReplyMessage()
2015-09-03 20:11:38 +02:00
J-P Nurmi 81e6d0bbf2 Don't require network for OnUserXxxMessage() hooks
- OnUserJoinMessage()
- OnUserPartMessage()
- OnUserTopicMessage()
- OnUserActionMessage()
- OnUserCTCPMessage()

Supersedes #503
2015-09-02 23:46:05 +02:00
J-P Nurmi 2a40c355f4 Fix #1022: Status and module commands not echoed back to client 2015-09-02 20:15:15 +02:00
J-P Nurmi 2b18d6ee38 Merge pull request #1020 from jpnurmi/traffic
Calculate per-network traffic (#963)
2015-09-02 01:01:13 +02:00
J-P Nurmi a79acacfad Add missing CModules::OnCTCPReplyMessage() 2015-09-02 00:51:05 +02:00
J-P Nurmi 453401eef4 Implement CClient::HandleCap() using CMessage (ref #1013) 2015-09-02 00:08:43 +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 64e39aca88 Merge pull request #1049 from kerio92/appel_du_vide
Add an %empty% substitution in ExpandString that expands to the empty string.
2015-09-01 22:14:29 +02:00
J-P Nurmi d9479189ea Merge branch '1.6.x' 2015-09-01 21:41:05 +02:00
J-P Nurmi 99349e20c9 Merge pull request #1031 from jpnurmi/user-hooks
Implement OnUserXxxMessage(CXxxMessage&) module hooks
2015-09-01 21:13:06 +02:00
J-P Nurmi 448acbe0eb Fix custom CTCP replies (close #1052) 2015-08-31 23:20:43 +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 31ba15d686 CClient::ReadLine(): use CMessage 2015-08-31 00:24:30 +02:00
J-P Nurmi e5b7f2c6df Make CBufLine hold a CMessage internally 2015-08-31 00:24:30 +02:00
J-P Nurmi f1dead9ff3 Add OnUserXxxMessage(CXxxMessage) module hooks 2015-08-30 15:50:12 +02:00
J-P Nurmi 82375eed65 Add CMessage::Clone()
Due to (intentional) lack of CFooMessage::operator=(CMessage), it was
a bit clumsy to do such copy-conversions:

    CMessage Copy = Message;
    CJoinMessage& JoinMsg = static_cast<CJoinMessage&>(Copy);
    // ...

vs.

    CJoinMessge JoinMsg;
    JoinMsg.Clone(Message);
    // ...

Alternatively, copy ctor(CMessage) and assignment operator=(CMessage)
could have been added to all CMessage subclasses. I've been trying to
avoid that, to make these operations very explicit. It has helped a
lot so far by preventing accidental copies.
2015-08-30 15:50:12 +02:00
J-P Nurmi de4ffb180c Add JoinMessage::GetKey() & SetKey()
This will be useful for implementing the upcoming OnUserJoinMessage()
module hook, that is allowed to modify the key.
2015-08-30 15:50:12 +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