3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-22 18:52:41 +01:00

remove unnecessary helper

This commit is contained in:
Shivaram Lingamneni 2019-12-26 22:54:00 -05:00
parent 358c4b7d81
commit 47ac8e984f
2 changed files with 4 additions and 15 deletions

View File

@ -1055,17 +1055,6 @@ func msgCommandToHistType(command string) (history.ItemType, error) {
} }
} }
func histTypeToMsgCommand(t history.ItemType) string {
switch t {
case history.Notice:
return "NOTICE"
case history.Tagmsg:
return "TAGMSG"
default:
return "PRIVMSG"
}
}
func (channel *Channel) SendSplitMessage(command string, minPrefixMode modes.Mode, clientOnlyTags map[string]string, client *Client, message utils.SplitMessage, rb *ResponseBuffer) { func (channel *Channel) SendSplitMessage(command string, minPrefixMode modes.Mode, clientOnlyTags map[string]string, client *Client, message utils.SplitMessage, rb *ResponseBuffer) {
histType, err := msgCommandToHistType(command) histType, err := msgCommandToHistType(command)
if err != nil { if err != nil {

View File

@ -545,10 +545,11 @@ func batchHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Res
histType, err := msgCommandToHistType(batch.command) histType, err := msgCommandToHistType(batch.command)
if err != nil { if err != nil {
histType = history.Privmsg histType = history.Privmsg
batch.command = "PRIVMSG"
} }
// see previous caution about modifying ResponseBuffer.Label // see previous caution about modifying ResponseBuffer.Label
rb.Label = batch.responseLabel rb.Label = batch.responseLabel
dispatchMessageToTarget(client, batch.tags, histType, batch.target, batch.message, rb) dispatchMessageToTarget(client, batch.tags, histType, batch.command, batch.target, batch.message, rb)
} }
} }
@ -2137,14 +2138,13 @@ func messageHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *R
} }
// each target gets distinct msgids // each target gets distinct msgids
splitMsg := utils.MakeSplitMessage(message, !rb.session.capabilities.Has(caps.MaxLine)) splitMsg := utils.MakeSplitMessage(message, !rb.session.capabilities.Has(caps.MaxLine))
dispatchMessageToTarget(client, clientOnlyTags, histType, targetString, splitMsg, rb) dispatchMessageToTarget(client, clientOnlyTags, histType, msg.Command, targetString, splitMsg, rb)
} }
return false return false
} }
func dispatchMessageToTarget(client *Client, tags map[string]string, histType history.ItemType, target string, message utils.SplitMessage, rb *ResponseBuffer) { func dispatchMessageToTarget(client *Client, tags map[string]string, histType history.ItemType, command, target string, message utils.SplitMessage, rb *ResponseBuffer) {
server := client.server server := client.server
command := histTypeToMsgCommand(histType)
prefixes, target := modes.SplitChannelMembershipPrefixes(target) prefixes, target := modes.SplitChannelMembershipPrefixes(target)
lowestPrefix := modes.GetLowestChannelModePrefix(prefixes) lowestPrefix := modes.GetLowestChannelModePrefix(prefixes)