Added channel targetting based on target name for notices.

This commit is contained in:
2018-08-05 10:59:20 +02:00
parent 901ff240df
commit 6cc8ae37c9
+13
View File
@@ -977,6 +977,18 @@ func (client *Client) handleEvent(event *Event) {
case "packet.notice": case "packet.notice":
{ {
// Find channel target
targetName := event.Arg(0)
if client.isupport.IsChannel(targetName) {
channel := client.Channel(targetName)
if channel != nil {
if user, ok := channel.UserList().User(event.Nick); ok {
event.RenderTags["prefixedNick"] = user.PrefixedNick
}
client.handleInTarget(channel, event)
}
} else {
// Try to target by mentioned channel name // Try to target by mentioned channel name
for _, token := range strings.Fields(event.Text) { for _, token := range strings.Fields(event.Text) {
if client.isupport.IsChannel(token) { if client.isupport.IsChannel(token) {
@@ -993,6 +1005,7 @@ func (client *Client) handleEvent(event *Event) {
break break
} }
} }
}
// Otherwise, it belongs in the status target // Otherwise, it belongs in the status target
if len(event.targets) == 0 { if len(event.targets) == 0 {