Commit Graph

24 Commits

Author SHA1 Message Date
Alexey Sokolov
e531fe870a Replace the deprecated overload of CMessage::GetParam 2018-06-01 22:22:44 +01:00
Alexey Sokolov
5b7daac2f0 Rename one of overloads of CMessage::GetParams to GetParamsColon 2018-06-01 22:22:44 +01:00
Falk Seidel
d647eaabc0 Welcome to 2018
The same procedure as last year, Miss Sophie?
The same procedure as every year, James.

[skip ci]
2018-01-19 19:38:58 +00:00
Alexey Sokolov
023e57485b Revert "Remove several more "size - 1", none of which are dangereous."
This reverts commit bcabf9b55c.

I should test code better...
2017-10-04 04:41:50 +01:00
Alexey Sokolov
bcabf9b55c Remove several more "size - 1", none of which are dangereous. 2017-10-03 15:23:09 +01:00
Phansa
3189ce7f8a Welcome to 2017
Welcome to 2017

temp

temp2
2017-03-12 20:34:26 -04:00
Tor Arne Vestbø
02bfb9eaf5 Centralize logic to get current server time
A few different implementations of computing the current time were
spread out through the code base, most of them using gettimeofday().

This centralizes the logic in CUtil::GetTime() for easier maintenance,
and also allows all call sites to get the benefit of the clock_gettime()
code path on systems that support it.
2016-07-06 01:16:15 +02:00
Tor Arne Vestbø
852c9832a0 Fix inverted gettimeofday() return value handling
The gettimeofday function returns 0 for success, not for failure. As a
result of the inverted logic we were losing millisecond precision when
parsing incoming messages on non-HAVE_CLOCK_GETTIME systems (macOS).
2016-07-05 18:39:53 +02:00
Falk Seidel
8f73840e74 Welcome to 2016
🎆  Happy 2016 🎆
2016-01-01 20:11:21 +01:00
Alexey Sokolov
d185d6f22d clang-format: switch tabs to spaces
I like tabs, but I have to admit that spaces make source code more
consistent, because every editor/viewer tends to render tabs differently :(
2015-12-07 00:53:30 +00:00
Alexey Sokolov
33b0627d75 Add clang-format configuration.
For now, it uses tabs like before, to make the diff easier to read/check.
One of following commits will switch it to spaces.
2015-12-07 00:53:01 +00: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
cbd860c2a9 Add CMessage::Equals()
Compares sender, command, and parameters. Not timestamp nor tags.
2015-09-20 23:22:02 +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
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
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
50ed9adf8a Fix CMessage::GetParams() crash - thanks kerio 2015-09-05 23:45:26 +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
37cd61a667 Fix CMessage to prefix also empty last params with a colon 2015-08-27 12:33:47 +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
a06bf1c985 Introduce a Message type (#506) 2015-08-15 12:26:16 +02:00