Sent new message total for Group Messages
This commit is contained in:
parent
72ac4099d5
commit
dfb4f7c14e
|
@ -771,7 +771,14 @@ const groupPrefix = "torv3"
|
|||
const importBundlePrefix = "importBundle"
|
||||
|
||||
func (cp *cwtchPeer) ImportBundle(importString string) error {
|
||||
if strings.HasPrefix(importString, tofuBundlePrefix) {
|
||||
if tor.IsValidHostname(importString) {
|
||||
_,err := cp.NewContactConversation(importString, model.DefaultP2PAccessControl(), true)
|
||||
if err == nil {
|
||||
return ConstructResponse(importBundlePrefix, "success")
|
||||
} else {
|
||||
return ConstructResponse(importBundlePrefix, err.Error())
|
||||
}
|
||||
} else if strings.HasPrefix(importString, tofuBundlePrefix) {
|
||||
bundle := strings.Split(importString, "||")
|
||||
if len(bundle) == 2 {
|
||||
err := cp.ImportBundle(bundle[0][len(tofuBundlePrefix):])
|
||||
|
@ -1148,8 +1155,9 @@ func (cp *cwtchPeer) attemptInsertOrAcknowledgeLegacyGroupConversation(conversat
|
|||
} else {
|
||||
cp.mutex.Lock()
|
||||
cp.storage.InsertMessage(conversationID, 0, dm.Text, model.Attributes{constants.AttrAck: constants.True, "PreviousSignature": base64.StdEncoding.EncodeToString(dm.PreviousMessageSig), constants.AttrAuthor: dm.Onion, constants.AttrSentTimestamp: time.Unix(int64(dm.Timestamp), 0).Format(time.RFC3339Nano)}, signature, model.CalculateContentHash(dm.Onion, dm.Text))
|
||||
newTotal,_ := cp.storage.GetChannelMessageCount(conversationID, 0)
|
||||
cp.mutex.Unlock()
|
||||
cp.eventBus.Publish(event.NewEvent(event.NewMessageFromGroup, map[event.Field]string{event.ConversationID: strconv.Itoa(conversationID), event.RemotePeer: dm.Onion, event.Index: strconv.Itoa(messageID)}))
|
||||
cp.eventBus.Publish(event.NewEvent(event.NewMessageFromGroup, map[event.Field]string{event.ConversationID: strconv.Itoa(conversationID), event.TimestampSent: time.Unix(int64(dm.Timestamp), 0).Format(time.RFC3339Nano), event.RemotePeer: dm.Onion, event.Index: strconv.Itoa(newTotal)}))
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
|
|
Loading…
Reference in New Issue