1
0
Fork 0
forked from External/ergo
Record INVITE in DM history for the benefit of offline always-on clients
This commit is contained in:
Shivaram Lingamneni 2020-11-29 22:12:06 -05:00
parent 0e470763a2
commit 32bbde49a8
4 changed files with 60 additions and 32 deletions

View file

@ -2138,37 +2138,20 @@ func dispatchMessageToTarget(client *Client, tags map[string]string, histType hi
}
}
if !allowedPlusR {
return
}
config := server.Config()
if !config.History.Enabled {
return
}
item := history.Item{
Type: histType,
Message: message,
Nick: nickMaskString,
AccountName: accountName,
Tags: tags,
}
if !itemIsStorable(&item, config) || !allowedPlusR {
return
}
targetedItem := item
targetedItem.Params[0] = tnick
cStatus, _ := client.historyStatus(config)
tStatus, _ := user.historyStatus(config)
// add to ephemeral history
if cStatus == HistoryEphemeral {
targetedItem.CfCorrespondent = tDetails.nickCasefolded
client.history.Add(targetedItem)
}
if tStatus == HistoryEphemeral && client != user {
item.CfCorrespondent = details.nickCasefolded
user.history.Add(item)
}
if cStatus == HistoryPersistent || tStatus == HistoryPersistent {
targetedItem.CfCorrespondent = ""
server.historyDB.AddDirectMessage(details.nickCasefolded, details.account, tDetails.nickCasefolded, tDetails.account, targetedItem)
Type: histType,
Message: message,
Tags: tags,
}
client.addHistoryItem(user, item, &details, &tDetails, config)
}
}