mirror of
https://git.mills.io/saltyim/saltyim.git
synced 2024-06-25 00:08:26 +00:00
feat: set outbox nick@domain to destination (#113)
Co-authored-by: Jon Lundy <jon@xuu.cc> Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/113 Reviewed-by: James Mills <james@mills.io>
This commit is contained in:
parent
4544b1c4cf
commit
9da59f133d
@ -218,10 +218,14 @@ func (cli *Client) Outbox() *url.URL {
|
||||
return ep
|
||||
}
|
||||
|
||||
func (cli *Client) OutboxAddr() *Addr {
|
||||
func (cli *Client) OutboxAddr(to *Addr) *Addr {
|
||||
return &Addr{
|
||||
User: to.User,
|
||||
Domain: to.Domain,
|
||||
|
||||
endpoint: cli.Outbox(),
|
||||
key: cli.me.key,
|
||||
capabilities: cli.me.capabilities,
|
||||
}
|
||||
}
|
||||
|
||||
@ -352,7 +356,7 @@ func (cli *Client) Send(user, msg string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
return cli.SendToAddr(cli.OutboxAddr(), msg)
|
||||
return cli.SendToAddr(cli.OutboxAddr(addr), msg)
|
||||
}
|
||||
|
||||
func (cli *Client) SendToAddr(addr *Addr, msg string) error {
|
||||
|
@ -133,7 +133,7 @@ func (a *Addr) String() string {
|
||||
|
||||
// Hash returns the Hex(SHA256Sum()) of the Address
|
||||
func (a *Addr) Hash() string {
|
||||
return fmt.Sprintf("%x", sha256.Sum256([]byte(a.String())))
|
||||
return fmt.Sprintf("%x", sha256.Sum256([]byte(strings.ToLower(a.String()))))
|
||||
}
|
||||
|
||||
// Formatted returns a formatted user used in the Salty Message Format
|
||||
|
Loading…
Reference in New Issue
Block a user