Add content type for group chats

This commit is contained in:
Andrea Maria Piana 2020-01-28 12:16:28 +01:00
parent b9689fe109
commit a5874fdb21
7 changed files with 54 additions and 59 deletions

View File

@ -1 +1 @@
0.49.3
0.50.0

View File

@ -295,7 +295,7 @@ func _0006_appearanceUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "0006_appearance.up.sql", size: 67, mode: os.FileMode(0644), modTime: time.Unix(1584955991, 0)}
info := bindataFileInfo{name: "0006_appearance.up.sql", size: 67, mode: os.FileMode(0644), modTime: time.Unix(1585119952, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xae, 0x6, 0x25, 0x6c, 0xe4, 0x9d, 0xa7, 0x72, 0xe8, 0xbc, 0xe4, 0x1f, 0x1e, 0x2d, 0x7c, 0xb7, 0xf6, 0xa3, 0xec, 0x3b, 0x4e, 0x93, 0x2e, 0xa4, 0xec, 0x6f, 0xe5, 0x95, 0x94, 0xe8, 0x4, 0xfb}}
return a, nil
}

View File

@ -61,7 +61,7 @@ func eventToSystemMessage(e v1protocol.MembershipUpdateEvent, translations map[p
ChatId: e.ChatID,
Text: text,
MessageType: protobuf.ChatMessage_SYSTEM_MESSAGE_PRIVATE_GROUP,
ContentType: protobuf.ChatMessage_TEXT_PLAIN,
ContentType: protobuf.ChatMessage_SYSTEM_MESSAGE_CONTENT_PRIVATE_GROUP,
Clock: e.ClockValue,
Timestamp: timestamp,
},

View File

@ -78,12 +78,10 @@ type MessengerResponse struct {
Messages []*Message `json:"messages,omitempty"`
Contacts []*Contact `json:"contacts,omitempty"`
Installations []*multidevice.Installation `json:"installations,omitempty"`
// Raw unprocessed messages
RawMessages []*RawResponse `json:"rawMessages,omitempty"`
}
func (m *MessengerResponse) IsEmpty() bool {
return len(m.Chats) == 0 && len(m.Messages) == 0 && len(m.Contacts) == 0 && len(m.RawMessages) == 0 && len(m.Installations) == 0
return len(m.Chats) == 0 && len(m.Messages) == 0 && len(m.Contacts) == 0 && len(m.Installations) == 0
}
type featureFlags struct {
@ -1725,9 +1723,7 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte
}
logger := m.logger.With(zap.String("site", "RetrieveAll"))
rawMessages := make(map[transport.Filter][]*v1protocol.StatusMessage)
for chat, messages := range chatWithMessages {
for _, messages := range chatWithMessages {
for _, shhMessage := range messages {
// TODO: fix this to use an exported method.
statusMessages, err := m.processor.handleMessages(shhMessage, true)
@ -1899,12 +1895,9 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte
continue
}
default:
// RawMessage, not processed here, pass straight to the client
rawMessages[chat] = append(rawMessages[chat], msg)
logger.Debug("message not handled")
}
} else {
logger.Debug("Adding raw message", zap.Any("msg", msg))
rawMessages[chat] = append(rawMessages[chat], msg)
}
}
}
@ -1950,10 +1943,6 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte
}
}
for filter, messages := range rawMessages {
messageState.Response.RawMessages = append(messageState.Response.RawMessages, &RawResponse{Filter: &filter, Messages: messages})
}
// Reset installations
m.modifiedInstallations = make(map[string]bool)

View File

@ -64,6 +64,8 @@ const (
ChatMessage_STATUS ChatMessage_ContentType = 3
ChatMessage_EMOJI ChatMessage_ContentType = 4
ChatMessage_TRANSACTION_COMMAND ChatMessage_ContentType = 5
// Only local
ChatMessage_SYSTEM_MESSAGE_CONTENT_PRIVATE_GROUP ChatMessage_ContentType = 6
)
var ChatMessage_ContentType_name = map[int32]string{
@ -73,15 +75,17 @@ var ChatMessage_ContentType_name = map[int32]string{
3: "STATUS",
4: "EMOJI",
5: "TRANSACTION_COMMAND",
6: "SYSTEM_MESSAGE_CONTENT_PRIVATE_GROUP",
}
var ChatMessage_ContentType_value = map[string]int32{
"UNKNOWN_CONTENT_TYPE": 0,
"TEXT_PLAIN": 1,
"STICKER": 2,
"STATUS": 3,
"EMOJI": 4,
"TRANSACTION_COMMAND": 5,
"UNKNOWN_CONTENT_TYPE": 0,
"TEXT_PLAIN": 1,
"STICKER": 2,
"STATUS": 3,
"EMOJI": 4,
"TRANSACTION_COMMAND": 5,
"SYSTEM_MESSAGE_CONTENT_PRIVATE_GROUP": 6,
}
func (x ChatMessage_ContentType) String() string {
@ -290,34 +294,35 @@ func init() {
func init() { proto.RegisterFile("chat_message.proto", fileDescriptor_263952f55fd35689) }
var fileDescriptor_263952f55fd35689 = []byte{
// 460 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0x4d, 0x6f, 0xd3, 0x4c,
0x10, 0xc7, 0xeb, 0xc4, 0x89, 0x93, 0x71, 0x9f, 0xc8, 0xcf, 0x52, 0xa9, 0x8b, 0x54, 0x89, 0x90,
0x53, 0x4e, 0x39, 0x14, 0x0e, 0x5c, 0x5d, 0x77, 0x55, 0x4c, 0xeb, 0xb5, 0xb5, 0xde, 0x00, 0x3d,
0xad, 0xb6, 0xce, 0x42, 0xa2, 0xd4, 0x2f, 0x8a, 0x17, 0x89, 0x5c, 0xf8, 0xc6, 0x7c, 0x07, 0xe4,
0x75, 0x42, 0xdc, 0x0b, 0xa7, 0x9d, 0x97, 0xff, 0xfc, 0xc6, 0xf3, 0x37, 0xa0, 0x6c, 0x2d, 0xb5,
0xc8, 0x55, 0x5d, 0xcb, 0xef, 0x6a, 0x51, 0xed, 0x4a, 0x5d, 0xa2, 0x91, 0x79, 0x9e, 0x7e, 0x7c,
0x9b, 0x7d, 0x80, 0x49, 0xaa, 0x37, 0xd9, 0x56, 0xed, 0xa2, 0x56, 0x81, 0x10, 0xd8, 0x6b, 0x59,
0xaf, 0xb1, 0x35, 0xb5, 0xe6, 0x63, 0x66, 0xe2, 0xa6, 0x56, 0xc9, 0x6c, 0x8b, 0x7b, 0x53, 0x6b,
0x3e, 0x60, 0x26, 0x9e, 0xfd, 0xb6, 0xc1, 0x0d, 0xd6, 0x52, 0x1f, 0xe7, 0x2e, 0x60, 0x90, 0x3d,
0x97, 0xd9, 0xd6, 0x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9, 0xf2, 0xe6, 0x21, 0x0c,
0xc4, 0x1d, 0x8b, 0x97, 0x89, 0xd7, 0x43, 0xff, 0xc3, 0x7f, 0x09, 0x0b, 0x3f, 0xfb, 0x9c, 0x1c,
0x4a, 0x7d, 0x34, 0x85, 0xab, 0xf4, 0x31, 0xe5, 0x24, 0xfa, 0x4b, 0x7b, 0xa9, 0xb0, 0x67, 0x1a,
0xdc, 0xce, 0x45, 0xdd, 0xfd, 0x41, 0x4c, 0x39, 0xa1, 0xbc, 0xb3, 0x9f, 0x93, 0xaf, 0x5c, 0x24,
0x0f, 0x7e, 0x48, 0x3d, 0x0b, 0xb9, 0xe0, 0xa4, 0x3c, 0x0c, 0xee, 0x09, 0xf3, 0x7a, 0x08, 0x60,
0x98, 0x72, 0x9f, 0x2f, 0x53, 0xaf, 0x8f, 0xc6, 0x30, 0x20, 0x51, 0xfc, 0x29, 0xf4, 0x6c, 0x74,
0x09, 0xaf, 0x38, 0xf3, 0x69, 0xea, 0x07, 0x3c, 0x8c, 0x1b, 0x62, 0x14, 0xf9, 0xf4, 0xd6, 0x1b,
0xdc, 0x8c, 0xc1, 0xa9, 0xe4, 0xfe, 0xb9, 0x94, 0xab, 0xa7, 0xa1, 0x31, 0xe9, 0xdd, 0x9f, 0x00,
0x00, 0x00, 0xff, 0xff, 0x54, 0x6d, 0xd5, 0x10, 0xd0, 0x02, 0x00, 0x00,
// 472 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xcd, 0x6e, 0xd3, 0x40,
0x10, 0xc7, 0xeb, 0xc6, 0x8e, 0x93, 0x71, 0x89, 0xcc, 0x50, 0xa9, 0x46, 0xaa, 0x44, 0x88, 0x38,
0xe4, 0x94, 0x43, 0xe1, 0xc0, 0xd5, 0x75, 0x57, 0xc5, 0xb4, 0x5e, 0x47, 0xf6, 0x06, 0xe8, 0x69,
0xb5, 0x75, 0x16, 0x12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, 0x4b, 0x7c, 0x9a, 0xfa, 0x01, 0x0b, 0xe3, 0x86, 0x18, 0x45, 0x3e, 0xbd,
0x71, 0x2d, 0x1c, 0xc3, 0x9b, 0x7f, 0x84, 0xed, 0xa6, 0x1d, 0x0b, 0xec, 0x5e, 0xf7, 0xc1, 0xae,
0xc4, 0xe6, 0xa9, 0x14, 0xf3, 0xc7, 0xae, 0xbe, 0xe7, 0xdb, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff,
0x0e, 0x1e, 0x7b, 0x43, 0xfb, 0x02, 0x00, 0x00,
}

View File

@ -40,8 +40,7 @@ message ChatMessage {
PUBLIC_GROUP = 2;
PRIVATE_GROUP = 3;
// Only local
SYSTEM_MESSAGE_PRIVATE_GROUP = 4;
}
SYSTEM_MESSAGE_PRIVATE_GROUP = 4;}
enum ContentType {
UNKNOWN_CONTENT_TYPE = 0;
TEXT_PLAIN = 1;
@ -49,5 +48,7 @@ message ChatMessage {
STATUS = 3;
EMOJI = 4;
TRANSACTION_COMMAND = 5;
// Only local
SYSTEM_MESSAGE_CONTENT_PRIVATE_GROUP = 6;
}
}

View File

@ -117,7 +117,7 @@ func ConfigCliFleetEthProdJson() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "../config/cli/fleet-eth.prod.json", size: 3625, mode: os.FileMode(0644), modTime: time.Unix(1584604725, 0)}
info := bindataFileInfo{name: "../config/cli/fleet-eth.prod.json", size: 3625, mode: os.FileMode(0644), modTime: time.Unix(1585119952, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1c, 0x86, 0x93, 0x3b, 0x8c, 0xb4, 0x1b, 0x8b, 0x70, 0xe6, 0x90, 0x3, 0xc9, 0x93, 0x99, 0x97, 0x18, 0xb7, 0x49, 0xbf, 0x2d, 0x35, 0x98, 0xb8, 0x49, 0xa8, 0x73, 0x30, 0xf5, 0x2d, 0x7f, 0x5c}}
return a, nil
}
@ -137,7 +137,7 @@ func ConfigCliFleetEthStagingJson() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "../config/cli/fleet-eth.staging.json", size: 1846, mode: os.FileMode(0644), modTime: time.Unix(1584604725, 0)}
info := bindataFileInfo{name: "../config/cli/fleet-eth.staging.json", size: 1846, mode: os.FileMode(0644), modTime: time.Unix(1585119952, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd1, 0xef, 0x3d, 0x5c, 0x41, 0xb1, 0xc8, 0x54, 0xd3, 0x82, 0x60, 0xcf, 0x5f, 0x8b, 0x92, 0xd0, 0x41, 0xa7, 0xff, 0xfd, 0x2c, 0x95, 0x44, 0x68, 0xd3, 0xad, 0x16, 0x8c, 0x49, 0x10, 0x4e, 0xb7}}
return a, nil
}
@ -157,7 +157,7 @@ func ConfigCliFleetEthTestJson() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "../config/cli/fleet-eth.test.json", size: 1855, mode: os.FileMode(0644), modTime: time.Unix(1584604725, 0)}
info := bindataFileInfo{name: "../config/cli/fleet-eth.test.json", size: 1855, mode: os.FileMode(0644), modTime: time.Unix(1585119952, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe4, 0x90, 0x4, 0x6, 0x2b, 0xe4, 0x67, 0x7a, 0xfc, 0x70, 0xa9, 0xb, 0x85, 0x8c, 0xb3, 0x8, 0x8e, 0xee, 0xec, 0x64, 0xb7, 0xac, 0x4c, 0x6, 0x4d, 0xcc, 0x4f, 0xda, 0xbd, 0xed, 0x17, 0x53}}
return a, nil
}