|
@@ -549,12 +549,26 @@ func (channel *Channel) sendMessage(msgid, cmd string, requiredCaps []caps.Capab
|
549
|
549
|
if minPrefix != nil {
|
550
|
550
|
minPrefixMode = *minPrefix
|
551
|
551
|
}
|
|
552
|
+ // send echo-message
|
|
553
|
+ if client.capabilities.Has(caps.EchoMessage) {
|
|
554
|
+ var messageTagsToUse *map[string]ircmsg.TagValue
|
|
555
|
+ if client.capabilities.Has(caps.MessageTags) {
|
|
556
|
+ messageTagsToUse = clientOnlyTags
|
|
557
|
+ }
|
|
558
|
+
|
|
559
|
+ if message == nil {
|
|
560
|
+ rb.AddFromClient(msgid, client, messageTagsToUse, cmd, channel.name)
|
|
561
|
+ } else {
|
|
562
|
+ rb.AddFromClient(msgid, client, messageTagsToUse, cmd, channel.name, *message)
|
|
563
|
+ }
|
|
564
|
+ }
|
552
|
565
|
for _, member := range channel.Members() {
|
553
|
566
|
if minPrefix != nil && !channel.ClientIsAtLeast(member, minPrefixMode) {
|
554
|
567
|
// STATUSMSG
|
555
|
568
|
continue
|
556
|
569
|
}
|
557
|
|
- if member == client && !client.capabilities.Has(caps.EchoMessage) {
|
|
570
|
+ // echo-message is handled above, so skip sending the msg to the user themselves as well
|
|
571
|
+ if member == client {
|
558
|
572
|
continue
|
559
|
573
|
}
|
560
|
574
|
|
|
@@ -574,9 +588,9 @@ func (channel *Channel) sendMessage(msgid, cmd string, requiredCaps []caps.Capab
|
574
|
588
|
}
|
575
|
589
|
|
576
|
590
|
if message == nil {
|
577
|
|
- rb.AddFromClient(msgid, client, messageTagsToUse, cmd, channel.name)
|
|
591
|
+ member.SendFromClient(msgid, client, messageTagsToUse, cmd, channel.name)
|
578
|
592
|
} else {
|
579
|
|
- rb.AddFromClient(msgid, client, messageTagsToUse, cmd, channel.name, *message)
|
|
593
|
+ member.SendFromClient(msgid, client, messageTagsToUse, cmd, channel.name, *message)
|
580
|
594
|
}
|
581
|
595
|
}
|
582
|
596
|
}
|
|
@@ -602,12 +616,25 @@ func (channel *Channel) sendSplitMessage(msgid, cmd string, minPrefix *modes.Mod
|
602
|
616
|
if minPrefix != nil {
|
603
|
617
|
minPrefixMode = *minPrefix
|
604
|
618
|
}
|
|
619
|
+ // send echo-message
|
|
620
|
+ if client.capabilities.Has(caps.EchoMessage) {
|
|
621
|
+ var tagsToUse *map[string]ircmsg.TagValue
|
|
622
|
+ if client.capabilities.Has(caps.MessageTags) {
|
|
623
|
+ tagsToUse = clientOnlyTags
|
|
624
|
+ }
|
|
625
|
+ if message == nil {
|
|
626
|
+ rb.AddFromClient(msgid, client, tagsToUse, cmd, channel.name)
|
|
627
|
+ } else {
|
|
628
|
+ rb.AddSplitMessageFromClient(msgid, client, tagsToUse, cmd, channel.name, *message)
|
|
629
|
+ }
|
|
630
|
+ }
|
605
|
631
|
for _, member := range channel.Members() {
|
606
|
632
|
if minPrefix != nil && !channel.ClientIsAtLeast(member, minPrefixMode) {
|
607
|
633
|
// STATUSMSG
|
608
|
634
|
continue
|
609
|
635
|
}
|
610
|
|
- if member == client && !client.capabilities.Has(caps.EchoMessage) {
|
|
636
|
+ // echo-message is handled above, so skip sending the msg to the user themselves as well
|
|
637
|
+ if member == client {
|
611
|
638
|
continue
|
612
|
639
|
}
|
613
|
640
|
var tagsToUse *map[string]ircmsg.TagValue
|
|
@@ -615,18 +642,10 @@ func (channel *Channel) sendSplitMessage(msgid, cmd string, minPrefix *modes.Mod
|
615
|
642
|
tagsToUse = clientOnlyTags
|
616
|
643
|
}
|
617
|
644
|
|
618
|
|
- if member == client {
|
619
|
|
- if message == nil {
|
620
|
|
- rb.AddFromClient(msgid, client, tagsToUse, cmd, channel.name)
|
621
|
|
- } else {
|
622
|
|
- rb.AddSplitMessageFromClient(msgid, client, tagsToUse, cmd, channel.name, *message)
|
623
|
|
- }
|
|
645
|
+ if message == nil {
|
|
646
|
+ member.SendFromClient(msgid, client, tagsToUse, cmd, channel.name)
|
624
|
647
|
} else {
|
625
|
|
- if message == nil {
|
626
|
|
- member.SendFromClient(msgid, client, tagsToUse, cmd, channel.name)
|
627
|
|
- } else {
|
628
|
|
- member.SendSplitMsgFromClient(msgid, client, tagsToUse, cmd, channel.name, *message)
|
629
|
|
- }
|
|
648
|
+ member.SendSplitMsgFromClient(msgid, client, tagsToUse, cmd, channel.name, *message)
|
630
|
649
|
}
|
631
|
650
|
}
|
632
|
651
|
}
|