-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix handleTOPIC only supporting modern RPL_TOPIC (#72)
handleTOPIC was using the wrong event parameters when a TOPIC message or (old) RPL_TOPIC was received, it only handles (new) RPL_TOPIC messages correctly. TOPIC messages are defined as `TOPIC <channel> [:<topic>]` in both specs while RPL_TOPIC differs between RFC1459/RFC2812 and "Modern IRC" such that they are respectively defined as `RPC_TOPIC <channel> :<topic>` and `RPL_TOPIC <client> <channel> :<topic>`. The old code only correctly parsed the "Modern IRC" RPL_TOPIC variant and not the (old) RPL_TOPIC or TOPIC events, these were instead silently never used in state tracking of the channel topic.
- Loading branch information
Showing
2 changed files
with
15 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,12 +42,13 @@ const mockConnStartState = `:dummy.int NOTICE * :*** Looking up your hostname... | |
:dummy.int 354 nick 1 #channel nick2 other.int nick2 nick2 :realname2 | ||
:dummy.int 315 nick #channel :End of /WHO list. | ||
:[email protected] JOIN #channel2 * :realname | ||
:dummy.int 332 nick #channel2 :example topic | ||
:dummy.int 332 nick #channel2 :example init topic | ||
:dummy.int 353 nick = #channel2 :[email protected] @[email protected] | ||
:dummy.int 366 nick #channel2 :End of /NAMES list. | ||
:dummy.int 354 nick 1 #channel2 ~user local.int nick 0 :realname | ||
:dummy.int 354 nick 1 #channel2 nick2 other.int nick2 nick2 :realname2 | ||
:dummy.int 315 nick #channel2 :End of /WHO list. | ||
:dummy.int TOPIC #channel2 :example topic | ||
` | ||
|
||
const mockConnEndState = `:[email protected] QUIT :example reason | ||
|
@@ -190,6 +191,10 @@ func TestState(t *testing.T) { | |
t.Fatal("User.InChannel() returned false for existing channel") | ||
} | ||
|
||
if ch2 := c.LookupChannel("#channel2"); ch2.Topic != "example topic" { | ||
t.Fatalf("Channel.Topic == %q, want \"example topic\"", ch2.Topic) | ||
} | ||
|
||
finishStart <- true | ||
}) | ||
|
||
|