mirror of
https://github.com/gissleh/irc.git
synced 2026-10-19 04:12:53 +00:00
Added channel targetting based on target name for notices.
This commit is contained in:
@@ -977,20 +977,33 @@ func (client *Client) handleEvent(event *Event) {
|
|||||||
|
|
||||||
case "packet.notice":
|
case "packet.notice":
|
||||||
{
|
{
|
||||||
// Try to target by mentioned channel name
|
// Find channel target
|
||||||
for _, token := range strings.Fields(event.Text) {
|
targetName := event.Arg(0)
|
||||||
if client.isupport.IsChannel(token) {
|
if client.isupport.IsChannel(targetName) {
|
||||||
channel := client.Channel(token)
|
channel := client.Channel(targetName)
|
||||||
if channel == nil {
|
if channel != nil {
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if user, ok := channel.UserList().User(event.Nick); ok {
|
if user, ok := channel.UserList().User(event.Nick); ok {
|
||||||
event.RenderTags["prefixedNick"] = user.PrefixedNick
|
event.RenderTags["prefixedNick"] = user.PrefixedNick
|
||||||
}
|
}
|
||||||
|
|
||||||
client.handleInTarget(channel, event)
|
client.handleInTarget(channel, event)
|
||||||
break
|
}
|
||||||
|
} else {
|
||||||
|
// Try to target by mentioned channel name
|
||||||
|
for _, token := range strings.Fields(event.Text) {
|
||||||
|
if client.isupport.IsChannel(token) {
|
||||||
|
channel := client.Channel(token)
|
||||||
|
if channel == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if user, ok := channel.UserList().User(event.Nick); ok {
|
||||||
|
event.RenderTags["prefixedNick"] = user.PrefixedNick
|
||||||
|
}
|
||||||
|
|
||||||
|
client.handleInTarget(channel, event)
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user