forked from External/ergo
channel history modifications
This commit is contained in:
parent
f4c03b6765
commit
711af30aa8
5 changed files with 106 additions and 41 deletions
|
|
@ -712,6 +712,14 @@ func chathistoryHandler(server *Server, client *Client, msg ircmsg.Message, rb *
|
|||
var err error
|
||||
var listTargets bool
|
||||
var targets []history.TargetListing
|
||||
var _, batchIdentifier = msg.GetTag("identifier")
|
||||
var assuredPreposition = "error"
|
||||
var limit int
|
||||
|
||||
if len(batchIdentifier) == 0 {
|
||||
batchIdentifier = "UNIDENTIFIED"
|
||||
}
|
||||
|
||||
defer func() {
|
||||
// errors are sent either without a batch, or in a draft/labeled-response batch as usual
|
||||
if err == utils.ErrInvalidParams {
|
||||
|
|
@ -731,9 +739,9 @@ func chathistoryHandler(server *Server, client *Client, msg ircmsg.Message, rb *
|
|||
target.Time.Format(IRCv3TimestampFormat))
|
||||
}
|
||||
} else if channel != nil {
|
||||
channel.replayHistoryItems(rb, items, true)
|
||||
channel.replayHistoryItems(rb, items, true, batchIdentifier, assuredPreposition, limit)
|
||||
} else {
|
||||
client.replayPrivmsgHistory(rb, items, target, true)
|
||||
client.replayPrivmsgHistory(rb, items, target, true, batchIdentifier, assuredPreposition, limit)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
|
@ -786,7 +794,6 @@ func chathistoryHandler(server *Server, client *Client, msg ircmsg.Message, rb *
|
|||
|
||||
paramPos := 2
|
||||
var start, end history.Selector
|
||||
var limit int
|
||||
switch preposition {
|
||||
case "targets":
|
||||
// use the same selector parsing as BETWEEN,
|
||||
|
|
@ -841,6 +848,7 @@ func chathistoryHandler(server *Server, client *Client, msg ircmsg.Message, rb *
|
|||
err = utils.ErrInvalidParams
|
||||
return
|
||||
}
|
||||
assuredPreposition = preposition
|
||||
|
||||
if listTargets {
|
||||
targets, err = client.listTargets(start, end, limit)
|
||||
|
|
@ -1227,29 +1235,34 @@ Get an explanation of <argument>, or "index" for a list of help topics.`), rb)
|
|||
// HISTORY alice 15
|
||||
// HISTORY #darwin 1h
|
||||
func historyHandler(server *Server, client *Client, msg ircmsg.Message, rb *ResponseBuffer) bool {
|
||||
config := server.Config()
|
||||
if !config.History.Enabled {
|
||||
rb.Notice(client.t("This command has been disabled by the server administrators"))
|
||||
return false
|
||||
}
|
||||
|
||||
items, channel, err := easySelectHistory(server, client, msg.Params)
|
||||
|
||||
if err == errNoSuchChannel {
|
||||
rb.Add(nil, server.name, ERR_NOSUCHCHANNEL, client.Nick(), utils.SafeErrorParam(msg.Params[0]), client.t("No such channel"))
|
||||
return false
|
||||
} else if err != nil {
|
||||
rb.Add(nil, server.name, ERR_UNKNOWNERROR, client.Nick(), msg.Command, client.t("Could not retrieve history"))
|
||||
return false
|
||||
}
|
||||
|
||||
if len(items) != 0 {
|
||||
if channel != nil {
|
||||
channel.replayHistoryItems(rb, items, true)
|
||||
} else {
|
||||
client.replayPrivmsgHistory(rb, items, "", true)
|
||||
rb.Notice(client.t("This command is currently disabled. Please use CHATHISTORY"))
|
||||
/*
|
||||
config := server.Config()
|
||||
if !config.History.Enabled {
|
||||
rb.Notice(client.t("This command has been disabled by the server administrators"))
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
items, channel, err := easySelectHistory(server, client, msg.Params)
|
||||
|
||||
if err == errNoSuchChannel {
|
||||
rb.Add(nil, server.name, ERR_NOSUCHCHANNEL, client.Nick(), utils.SafeErrorParam(msg.Params[0]), client.t("No such channel"))
|
||||
return false
|
||||
} else if err != nil {
|
||||
rb.Add(nil, server.name, ERR_UNKNOWNERROR, client.Nick(), msg.Command, client.t("Could not retrieve history"))
|
||||
return false
|
||||
}
|
||||
|
||||
var _, batchIdentifier = msg.GetTag("identifier")
|
||||
|
||||
if len(items) != 0 {
|
||||
if channel != nil {
|
||||
channel.replayHistoryItems(rb, items, true, batchIdentifier)
|
||||
} else {
|
||||
client.replayPrivmsgHistory(rb, items, "", true, batchIdentifier)
|
||||
}
|
||||
}
|
||||
*/
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue