Commit Graph

11 Commits

Author SHA1 Message Date
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