File tree Expand file tree Collapse file tree 3 files changed +4
-34
lines changed
Expand file tree Collapse file tree 3 files changed +4
-34
lines changed Original file line number Diff line number Diff line change @@ -95,5 +95,7 @@ Initial release
9595
9696### v2
9797
98- CTCP messages will no longer be rewritten. The decision was made that this
99- library should not rewrite messages.
98+ - CTCP messages will no longer be rewritten. The decision was made that this
99+ library should pass through all messages without mangling them.
100+ - Remove Message.FromChannel as this is not always accurate, while
101+ Client.FromChannel should always be accurate.
Original file line number Diff line number Diff line change @@ -325,25 +325,6 @@ func (m *Message) Trailing() string {
325325 return m .Params [len (m .Params )- 1 ]
326326}
327327
328- // FromChannel is mostly for PRIVMSG messages (and similar derived
329- // messages) It will check if the message came from a channel or a
330- // person. This is not always accurate, because some servers allow for
331- // other characters at the start of a channel.
332- //
333- // TODO: Remove in favor of *Client.FromChannel(*Message)
334- func (m * Message ) FromChannel () bool {
335- if len (m .Params ) < 1 || len (m .Params [0 ]) < 1 {
336- return false
337- }
338-
339- switch m .Params [0 ][0 ] {
340- case '#' , '&' :
341- return true
342- default :
343- return false
344- }
345- }
346-
347328// Copy will create a new copy of an message
348329func (m * Message ) Copy () * Message {
349330 // Create a new message
Original file line number Diff line number Diff line change @@ -68,19 +68,6 @@ func TestMessageTrailing(t *testing.T) {
6868 assert .Equal (t , "" , m .Trailing ())
6969}
7070
71- func TestMessageFromChan (t * testing.T ) {
72- t .Parallel ()
73-
74- m := MustParseMessage ("PRIVMSG #test-msg :hello world" )
75- assert .True (t , m .FromChannel (), "Wrong FromChannel value" )
76-
77- m = MustParseMessage ("PRIVMSG bot :hello world" )
78- assert .False (t , m .FromChannel (), "Wrong FromChannel value" )
79-
80- m = MustParseMessage ("PING" )
81- assert .False (t , m .FromChannel (), "Wrong FromChannel value" )
82- }
83-
8471func TestMessageCopy (t * testing.T ) {
8572 t .Parallel ()
8673
You can’t perform that action at this time.
0 commit comments