1
0
Fork 0
forked from External/ergo

accounts: Add account-tag capability

This commit is contained in:
Daniel Oaks 2016-09-12 11:25:31 +10:00
parent c2aa31001a
commit 754b74c21c
4 changed files with 20 additions and 4 deletions

View file

@ -349,6 +349,21 @@ func (client *Client) destroy() {
}
}
// SendFromClient sends an IRC line coming from a specific client.
// Adds account-tag to the line as well.
func (client *Client) SendFromClient(from *Client, tags *map[string]ircmsg.TagValue, prefix string, command string, params ...string) error {
// attach account-tag
if client.capabilities[AccountTag] && from.account != &NoAccount {
if tags == nil {
tags = ircmsg.MakeTags("account", from.account.Name)
} else {
(*tags)["account"] = ircmsg.MakeTagValue(from.account.Name)
}
}
return client.Send(tags, prefix, command, params...)
}
// Send sends an IRC line to the client.
func (client *Client) Send(tags *map[string]ircmsg.TagValue, prefix string, command string, params ...string) error {
// attach server-time