Send picture in private chats
This commit is contained in:
parent
c7e758eeab
commit
c9b66d18da
|
@ -681,9 +681,9 @@ func (m *Messenger) attachChatIdentity(cca *protobuf.ContactCodeAdvertisement) e
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// handleStandaloneChatIdentity sends a standalone ChatIdentity message to a public channel if the publish criteria is met
|
// handleStandaloneChatIdentity sends a standalone ChatIdentity message to a public or private channel if the publish criteria is met
|
||||||
func (m *Messenger) handleStandaloneChatIdentity(chat *Chat) error {
|
func (m *Messenger) handleStandaloneChatIdentity(chat *Chat) error {
|
||||||
if chat.ChatType != ChatTypePublic {
|
if chat.ChatType != ChatTypePublic || chat.ChatType != ChatTypeOneToOne {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
shouldPublishChatIdentity, err := m.shouldPublishChatIdentity(chat.ID)
|
shouldPublishChatIdentity, err := m.shouldPublishChatIdentity(chat.ID)
|
||||||
|
@ -711,10 +711,22 @@ func (m *Messenger) handleStandaloneChatIdentity(chat *Chat) error {
|
||||||
}
|
}
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
if chat.ChatType == ChatTypePublic {
|
||||||
_, err = m.sender.SendPublic(ctx, chat.ID, rawMessage)
|
_, err = m.sender.SendPublic(ctx, chat.ID, rawMessage)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
pk, err := chat.PublicKey()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
_, err = m.sender.SendPrivate(ctx, pk, &rawMessage)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
img, err := m.multiAccounts.GetIdentityImage(m.account.KeyUID, userimage.SmallDimName)
|
img, err := m.multiAccounts.GetIdentityImage(m.account.KeyUID, userimage.SmallDimName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue