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
|
|
@ -35,8 +35,8 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
// maximum IRC line length, not including tags
|
||||
DefaultMaxLineLen = 512
|
||||
// Set to 4096 because CEF doesn't care about compatibility
|
||||
DefaultMaxLineLen = 4096
|
||||
|
||||
// IdentTimeout is how long before our ident (username) check times out.
|
||||
IdentTimeout = time.Second + 500*time.Millisecond
|
||||
|
|
@ -649,6 +649,17 @@ func (client *Client) run(session *Session) {
|
|||
|
||||
firstLine := !isReattach
|
||||
|
||||
correspondents, _ := client.server.historyDB.GetPMs(client.NickCasefolded())
|
||||
// For safety, let's keep this within the 4096 character barrier
|
||||
var lineBuilder utils.TokenLineBuilder
|
||||
lineBuilder.Initialize(MaxLineLen, ",")
|
||||
for username, timestamp := range correspondents {
|
||||
lineBuilder.Add(fmt.Sprintf("%s %d", client.server.getCurrentNick(username), timestamp))
|
||||
}
|
||||
for _, message := range lineBuilder.Lines() {
|
||||
session.Send(nil, client.server.name, "PMS", message)
|
||||
}
|
||||
|
||||
for {
|
||||
var invalidUtf8 bool
|
||||
line, err := session.socket.Read()
|
||||
|
|
@ -862,14 +873,14 @@ func (session *Session) Ping() {
|
|||
session.Send(nil, "", "PING", session.client.Nick())
|
||||
}
|
||||
|
||||
func (client *Client) replayPrivmsgHistory(rb *ResponseBuffer, items []history.Item, target string, chathistoryCommand bool) {
|
||||
func (client *Client) replayPrivmsgHistory(rb *ResponseBuffer, items []history.Item, target string, chathistoryCommand bool, identifier string, preposition string, limit int) {
|
||||
var batchID string
|
||||
details := client.Details()
|
||||
nick := details.nick
|
||||
if target == "" {
|
||||
target = nick
|
||||
}
|
||||
batchID = rb.StartNestedBatch("chathistory", target)
|
||||
batchID = rb.StartNestedBatch("chathistory", target, identifier, preposition, strconv.Itoa(limit))
|
||||
|
||||
isSelfMessage := func(item *history.Item) bool {
|
||||
// XXX: Params[0] is the message target. if the source of this message is an in-memory
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue