Add MessageForwardOriginMessageImport support

This commit is contained in:
Bohdan Horbeshko 2022-02-03 15:25:45 -05:00
parent fe5ca09c7c
commit 10e5f31b74

View file

@ -204,7 +204,7 @@ func (c *Client) ProcessStatusUpdate(chatID int64, status string, show string, a
c.cache.SetStatus(chatID, show, status) c.cache.SetStatus(chatID, show, status)
gateway.SendPresence( return gateway.SendPresence(
c.xmpp, c.xmpp,
c.jid, c.jid,
gateway.SPFrom(strconv.FormatInt(chatID, 10)), gateway.SPFrom(strconv.FormatInt(chatID, 10)),
@ -213,8 +213,6 @@ func (c *Client) ProcessStatusUpdate(chatID int64, status string, show string, a
gateway.SPPhoto(photo), gateway.SPPhoto(photo),
gateway.SPImmed(gateway.SPImmed.Get(args)), gateway.SPImmed(gateway.SPImmed.Get(args)),
) )
return nil
} }
func (c *Client) formatContact(chatID int64) string { func (c *Client) formatContact(chatID int64) string {
@ -330,6 +328,9 @@ func (c *Client) formatForward(fwd *client.MessageForwardInfo) string {
signature = fmt.Sprintf(" (%s)", channel.AuthorSignature) signature = fmt.Sprintf(" (%s)", channel.AuthorSignature)
} }
return c.formatContact(channel.ChatId)+signature return c.formatContact(channel.ChatId)+signature
case client.TypeMessageForwardOriginMessageImport:
originImport := fwd.Origin.(*client.MessageForwardOriginMessageImport)
return originImport.SenderName
} }
return "Unknown forward type" return "Unknown forward type"
} }
@ -659,6 +660,7 @@ func (c *Client) roster(resource string) {
c.addResource(resource) c.addResource(resource)
} }
// get last messages from specified chat
func (c *Client) getLastMessages(id int64, query string, from int64, count int32) (*client.Messages, error) { func (c *Client) getLastMessages(id int64, query string, from int64, count int32) (*client.Messages, error) {
return c.client.SearchChatMessages(&client.SearchChatMessagesRequest{ return c.client.SearchChatMessages(&client.SearchChatMessagesRequest{
ChatId: id, ChatId: id,