core: Track unread state of received messages

This commit is contained in:
John Brooks 2016-10-15 18:57:08 -06:00
parent 7fe2363801
commit bb530cfc2f
8 changed files with 204 additions and 163 deletions

View File

@ -219,3 +219,17 @@ func (s *RpcServer) SendMessage(ctx context.Context, req *rpc.Message) (*rpc.Mes
return message, nil
}
func (s *RpcServer) MarkConversationRead(ctx context.Context, req *rpc.MarkConversationReadRequest) (*rpc.Reply, error) {
if req.Entity == nil || req.Entity.IsSelf {
return nil, errors.New("Invalid entity")
}
contact := s.core.Identity.ContactList().ContactByAddress(req.Entity.Address)
if contact == nil || (req.Entity.ContactId != 0 && int32(contact.Id()) != req.Entity.ContactId) {
return nil, errors.New("Unknown entity")
}
contact.Conversation().MarkReadBeforeMessage(req.LastRecvIdentifier)
return &rpc.Reply{}, nil
}

View File

@ -267,5 +267,19 @@ func (c *Client) monitorConversations() {
} else if !message.Sender.IsSelf {
fmt.Fprintf(c.Input.Stdout(), "\r---- %s < %s\n", remoteContact.Nickname, message.Text)
}
if !message.Sender.IsSelf {
backend := c.Backend
message := message
go func() {
_, err := backend.MarkConversationRead(context.Background(), &ricochet.MarkConversationReadRequest{
Entity: message.Sender,
LastRecvIdentifier: message.Identifier,
})
if err != nil {
log.Printf("Mark conversation read failed: %v", err)
}
}()
}
}
}

View File

@ -13,12 +13,6 @@ import (
// XXX should have limits on backlog size/duration
// XXX populate will bring clients up to date, but they have no way
// of knowing which messages have been seen before. Likewise, if multiple
// clients are attached, there is no way to sync unread state between
// them. Implies that it makes sense for clients to report to backend
// when a message is "seen".
type Conversation struct {
Contact *Contact
@ -62,7 +56,7 @@ func (c *Conversation) Receive(id uint64, timestamp int64, text string) {
Recipient: c.localEntity,
Timestamp: timestamp,
Identifier: id,
Status: ricochet.Message_RECEIVED,
Status: ricochet.Message_UNREAD,
Text: text,
}
@ -194,3 +188,30 @@ func sendMessageToConnection(conn *protocol.OpenConnection, message *ricochet.Me
// XXX no message IDs
conn.SendMessage(channelId, message.Text)
}
// XXX This is inefficient -- it'll usually only be marking the last message
// or few messages. Need a better way to know what's unread.
func (c *Conversation) MarkReadBeforeMessage(msgId uint64) int {
c.mutex.Lock()
defer c.mutex.Unlock()
marked := 0
for _, message := range c.messages {
if message.Status == ricochet.Message_UNREAD {
message.Status = ricochet.Message_READ
marked++
event := ricochet.ConversationEvent{
Type: ricochet.ConversationEvent_UPDATE,
Msg: message,
}
c.events.Publish(event)
}
if message.Identifier == msgId && message.Recipient.IsSelf {
break
}
}
return marked
}

View File

@ -1,90 +0,0 @@
// Code generated by protoc-gen-go.
// source: config.proto
// DO NOT EDIT!
/*
Package ricochet is a generated protocol buffer package.
It is generated from these files:
config.proto
contact.proto
conversation.proto
core.proto
identity.proto
network.proto
It has these top-level messages:
Config
ConfigRequest
Contact
ContactRequest
MonitorContactsRequest
ContactEvent
AddContactReply
DeleteContactRequest
DeleteContactReply
RejectInboundRequestReply
ConversationEvent
MonitorConversationsRequest
Entity
Message
ServerStatusRequest
ServerStatusReply
Identity
IdentityRequest
MonitorNetworkRequest
TorProcessStatus
TorControlStatus
TorConnectionStatus
NetworkStatus
StartNetworkRequest
StopNetworkRequest
*/
package ricochet
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type Config struct {
}
func (m *Config) Reset() { *m = Config{} }
func (m *Config) String() string { return proto.CompactTextString(m) }
func (*Config) ProtoMessage() {}
func (*Config) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
type ConfigRequest struct {
}
func (m *ConfigRequest) Reset() { *m = ConfigRequest{} }
func (m *ConfigRequest) String() string { return proto.CompactTextString(m) }
func (*ConfigRequest) ProtoMessage() {}
func (*ConfigRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
func init() {
proto.RegisterType((*Config)(nil), "ricochet.Config")
proto.RegisterType((*ConfigRequest)(nil), "ricochet.ConfigRequest")
}
func init() { proto.RegisterFile("config.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 73 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x49, 0xce, 0xcf, 0x4b,
0xcb, 0x4c, 0xd7, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x28, 0xca, 0x4c, 0xce, 0x4f, 0xce,
0x48, 0x2d, 0x51, 0xe2, 0xe0, 0x62, 0x73, 0x06, 0xcb, 0x28, 0xf1, 0x73, 0xf1, 0x42, 0x58, 0x41,
0xa9, 0x85, 0xa5, 0xa9, 0xc5, 0x25, 0x49, 0x6c, 0x60, 0xb5, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff,
0xff, 0xad, 0xf5, 0x95, 0x4e, 0x3b, 0x00, 0x00, 0x00,
}

View File

@ -46,29 +46,34 @@ func (ConversationEvent_Type) EnumDescriptor() ([]byte, []int) { return fileDesc
type Message_Status int32
const (
Message_NULL Message_Status = 0
Message_RECEIVED Message_Status = 1
Message_NULL Message_Status = 0
Message_ERROR Message_Status = 1
// Outbound
Message_QUEUED Message_Status = 2
Message_SENDING Message_Status = 3
Message_DELIVERED Message_Status = 4
Message_ERROR Message_Status = 5
// Inbound
Message_UNREAD Message_Status = 5
Message_READ Message_Status = 6
)
var Message_Status_name = map[int32]string{
0: "NULL",
1: "RECEIVED",
1: "ERROR",
2: "QUEUED",
3: "SENDING",
4: "DELIVERED",
5: "ERROR",
5: "UNREAD",
6: "READ",
}
var Message_Status_value = map[string]int32{
"NULL": 0,
"RECEIVED": 1,
"ERROR": 1,
"QUEUED": 2,
"SENDING": 3,
"DELIVERED": 4,
"ERROR": 5,
"UNREAD": 5,
"READ": 6,
}
func (x Message_Status) String() string {
@ -144,11 +149,29 @@ func (m *Message) GetRecipient() *Entity {
return nil
}
type MarkConversationReadRequest struct {
Entity *Entity `protobuf:"bytes,1,opt,name=entity" json:"entity,omitempty"`
LastRecvIdentifier uint64 `protobuf:"varint,2,opt,name=lastRecvIdentifier" json:"lastRecvIdentifier,omitempty"`
}
func (m *MarkConversationReadRequest) Reset() { *m = MarkConversationReadRequest{} }
func (m *MarkConversationReadRequest) String() string { return proto.CompactTextString(m) }
func (*MarkConversationReadRequest) ProtoMessage() {}
func (*MarkConversationReadRequest) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{4} }
func (m *MarkConversationReadRequest) GetEntity() *Entity {
if m != nil {
return m.Entity
}
return nil
}
func init() {
proto.RegisterType((*ConversationEvent)(nil), "ricochet.ConversationEvent")
proto.RegisterType((*MonitorConversationsRequest)(nil), "ricochet.MonitorConversationsRequest")
proto.RegisterType((*Entity)(nil), "ricochet.Entity")
proto.RegisterType((*Message)(nil), "ricochet.Message")
proto.RegisterType((*MarkConversationReadRequest)(nil), "ricochet.MarkConversationReadRequest")
proto.RegisterEnum("ricochet.ConversationEvent_Type", ConversationEvent_Type_name, ConversationEvent_Type_value)
proto.RegisterEnum("ricochet.Message_Status", Message_Status_name, Message_Status_value)
}
@ -156,31 +179,34 @@ func init() {
func init() { proto.RegisterFile("conversation.proto", fileDescriptor2) }
var fileDescriptor2 = []byte{
// 413 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x64, 0x92, 0xcf, 0x6e, 0xd3, 0x40,
0x10, 0xc6, 0xf1, 0xdf, 0xd8, 0x13, 0x40, 0xee, 0x1c, 0x90, 0x25, 0xfe, 0xa8, 0x32, 0x97, 0x9e,
0x2c, 0x14, 0x78, 0x81, 0xaa, 0x5e, 0xa1, 0x48, 0x6e, 0x1a, 0xd6, 0x35, 0xe2, 0x6a, 0xec, 0x6d,
0x59, 0x89, 0xd8, 0xc6, 0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, 0xaa, 0xa6, 0x19, 0xc8, 0x9c, 0xb1,
0x1c, 0xf2, 0xc3, 0x15, 0x5f, 0x81, 0x2f, 0x55, 0x21, 0x7e, 0xde, 0xc5, 0x0e, 0x09, 0x01, 0x9f,
0x6e, 0xc9, 0x5f, 0x1b, 0x16, 0xd3, 0x30, 0x78, 0x01, 0xbe, 0x12, 0x6d, 0x23, 0x06, 0xf3, 0xe1,
0xe5, 0x2a, 0x9a, 0xe7, 0xdd, 0xbf, 0xce, 0x27, 0x1d, 0x53, 0x08, 0x07, 0x51, 0xcb, 0x5e, 0xd2,
0xba, 0xa6, 0xe5, 0x9c, 0xc2, 0x33, 0x32, 0xba, 0xd6, 0x72, 0x47, 0x93, 0x54, 0xbb, 0xde, 0x18,
0x70, 0xf8, 0x5c, 0xc0, 0x77, 0x00, 0xb2, 0x21, 0x4c, 0xde, 0x49, 0x7a, 0xdb, 0x25, 0xd9, 0xe5,
0x47, 0x15, 0xfc, 0x40, 0xbe, 0x74, 0xa5, 0x1f, 0x54, 0xec, 0x99, 0xf0, 0xe2, 0x93, 0x1c, 0xd2,
0xc2, 0xe8, 0x7c, 0xe2, 0x10, 0x29, 0x6c, 0xf1, 0x5b, 0xc7, 0xbe, 0x59, 0x82, 0x39, 0x27, 0x05,
0xf8, 0x7b, 0xea, 0xff, 0x9c, 0xa6, 0x64, 0x32, 0xca, 0x89, 0x02, 0xf9, 0x52, 0xb2, 0x92, 0xce,
0xf6, 0x98, 0xd9, 0x18, 0xd3, 0x7a, 0xf3, 0x99, 0x92, 0x7a, 0x01, 0x61, 0xc6, 0x72, 0xa2, 0x38,
0x69, 0x2e, 0x86, 0xe0, 0x31, 0xce, 0x6f, 0x78, 0xe4, 0x7d, 0xf7, 0xcd, 0xcf, 0xf7, 0xf1, 0x5f,
0x00, 0x00, 0x00, 0xff, 0xff, 0x58, 0x7a, 0x99, 0xbe, 0x92, 0x02, 0x00, 0x00,
// 462 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 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3e, 0xa5, 0x22, 0x15, 0x09, 0x33, 0x62, 0x60, 0x35, 0xa3, 0xc5, 0xea, 0x23,
0x63, 0x7a, 0x06, 0x93, 0x44, 0x2c, 0x19, 0x1e, 0xb1, 0xe6, 0x39, 0x6a, 0x2b, 0x12, 0xf3, 0x24,
0x18, 0xd6, 0x17, 0xb9, 0x2f, 0x3f, 0xfa, 0xc5, 0xfc, 0x64, 0xf5, 0xa3, 0x0b, 0x8f, 0x94, 0xcc,
0x1b, 0x7e, 0x75, 0xb3, 0xca, 0x95, 0xf2, 0x78, 0xb3, 0x07, 0x9d, 0x9b, 0xc5, 0x5b, 0x69, 0x2c,
0xa9, 0x6c, 0xbf, 0x68, 0x3b, 0xe9, 0xbb, 0x4e, 0xfe, 0xa3, 0x7c, 0xf3, 0xdd, 0xdf, 0xff, 0xfe,
0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa0, 0x5b, 0x0f, 0xe6, 0x13, 0x03, 0x00, 0x00,
}

View File

@ -35,14 +35,22 @@ message Message {
enum Status {
NULL = 0;
RECEIVED = 1;
ERROR = 1;
// Outbound
QUEUED = 2;
SENDING = 3;
DELIVERED = 4;
ERROR = 5;
// Inbound
UNREAD = 5;
READ = 6;
}
Status status = 5;
string text = 6;
}
message MarkConversationReadRequest {
Entity entity = 1;
uint64 lastRecvIdentifier = 2;
}

View File

@ -18,6 +18,14 @@ var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
type Reply struct {
}
func (m *Reply) Reset() { *m = Reply{} }
func (m *Reply) String() string { return proto.CompactTextString(m) }
func (*Reply) ProtoMessage() {}
func (*Reply) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{0} }
type ServerStatusRequest struct {
RpcVersion int32 `protobuf:"varint,1,opt,name=rpcVersion" json:"rpcVersion,omitempty"`
}
@ -25,7 +33,7 @@ type ServerStatusRequest struct {
func (m *ServerStatusRequest) Reset() { *m = ServerStatusRequest{} }
func (m *ServerStatusRequest) String() string { return proto.CompactTextString(m) }
func (*ServerStatusRequest) ProtoMessage() {}
func (*ServerStatusRequest) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{0} }
func (*ServerStatusRequest) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{1} }
type ServerStatusReply struct {
RpcVersion int32 `protobuf:"varint,1,opt,name=rpcVersion" json:"rpcVersion,omitempty"`
@ -35,9 +43,10 @@ type ServerStatusReply struct {
func (m *ServerStatusReply) Reset() { *m = ServerStatusReply{} }
func (m *ServerStatusReply) String() string { return proto.CompactTextString(m) }
func (*ServerStatusReply) ProtoMessage() {}
func (*ServerStatusReply) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{1} }
func (*ServerStatusReply) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{2} }
func init() {
proto.RegisterType((*Reply)(nil), "ricochet.Reply")
proto.RegisterType((*ServerStatusRequest)(nil), "ricochet.ServerStatusRequest")
proto.RegisterType((*ServerStatusReply)(nil), "ricochet.ServerStatusReply")
}
@ -85,6 +94,7 @@ type RicochetCoreClient interface {
// Open a stream to monitor messages in conversations with contacts.
MonitorConversations(ctx context.Context, in *MonitorConversationsRequest, opts ...grpc.CallOption) (RicochetCore_MonitorConversationsClient, error)
SendMessage(ctx context.Context, in *Message, opts ...grpc.CallOption) (*Message, error)
MarkConversationRead(ctx context.Context, in *MarkConversationReadRequest, opts ...grpc.CallOption) (*Reply, error)
}
type ricochetCoreClient struct {
@ -281,6 +291,15 @@ func (c *ricochetCoreClient) SendMessage(ctx context.Context, in *Message, opts
return out, nil
}
func (c *ricochetCoreClient) MarkConversationRead(ctx context.Context, in *MarkConversationReadRequest, opts ...grpc.CallOption) (*Reply, error) {
out := new(Reply)
err := grpc.Invoke(ctx, "/ricochet.RicochetCore/MarkConversationRead", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for RicochetCore service
type RicochetCoreServer interface {
@ -316,6 +335,7 @@ type RicochetCoreServer interface {
// Open a stream to monitor messages in conversations with contacts.
MonitorConversations(*MonitorConversationsRequest, RicochetCore_MonitorConversationsServer) error
SendMessage(context.Context, *Message) (*Message, error)
MarkConversationRead(context.Context, *MarkConversationReadRequest) (*Reply, error)
}
func RegisterRicochetCoreServer(s *grpc.Server, srv RicochetCoreServer) {
@ -565,6 +585,24 @@ func _RicochetCore_SendMessage_Handler(srv interface{}, ctx context.Context, dec
return interceptor(ctx, in, info, handler)
}
func _RicochetCore_MarkConversationRead_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MarkConversationReadRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RicochetCoreServer).MarkConversationRead(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/ricochet.RicochetCore/MarkConversationRead",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RicochetCoreServer).MarkConversationRead(ctx, req.(*MarkConversationReadRequest))
}
return interceptor(ctx, in, info, handler)
}
var _RicochetCore_serviceDesc = grpc.ServiceDesc{
ServiceName: "ricochet.RicochetCore",
HandlerType: (*RicochetCoreServer)(nil),
@ -609,6 +647,10 @@ var _RicochetCore_serviceDesc = grpc.ServiceDesc{
MethodName: "SendMessage",
Handler: _RicochetCore_SendMessage_Handler,
},
{
MethodName: "MarkConversationRead",
Handler: _RicochetCore_MarkConversationRead_Handler,
},
},
Streams: []grpc.StreamDesc{
{
@ -633,32 +675,34 @@ var _RicochetCore_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("core.proto", fileDescriptor3) }
var fileDescriptor3 = []byte{
// 429 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x54, 0x5d, 0xaf, 0xd2, 0x40,
0x10, 0x0d, 0x26, 0x7e, 0xcd, 0xbd, 0xbd, 0x86, 0x95, 0xe8, 0xb5, 0x22, 0x12, 0xd4, 0x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, 0xa8,
0x75, 0xf2, 0x0d, 0xcb, 0xe9, 0x5b, 0x28, 0xac, 0x43, 0xab, 0x5b, 0x87, 0x3f, 0x96, 0xd1, 0xdf,
0x00, 0x00, 0x00, 0xff, 0xff, 0xa3, 0x96, 0xd5, 0x66, 0xb2, 0x04, 0x00, 0x00,
// 457 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x54, 0x5f, 0x6f, 0xd3, 0x30,
0x10, 0x57, 0x91, 0x06, 0xe3, 0xb6, 0x6c, 0xaa, 0xa9, 0x60, 0x84, 0x31, 0xa6, 0x02, 0x12, 0x4f,
0x15, 0x62, 0xda, 0x1b, 0x0f, 0x4c, 0x1d, 0xa0, 0x49, 0x64, 0x0f, 0xa9, 0x8a, 0x84, 0xc4, 0x4b,
0xea, 0x9c, 0x20, 0xb4, 0xb2, 0x83, 0x7d, 0x2d, 0xea, 0x87, 0xe0, 0x3b, 0xe3, 0x36, 0x76, 0xed,
0x28, 0xa9, 0x8a, 0xf6, 0x56, 0xff, 0xfe, 0xe5, 0xee, 0x7c, 0x2e, 0x00, 0x97, 0x0a, 0x07, 0xa5,
0x92, 0x24, 0xd9, 0xbe, 0x2a, 0xb8, 0xe4, 0x3f, 0x91, 0xe2, 0x48, 0x20, 0xfd, 0x91, 0x6a, 0x5a,
0x11, 0xf1, 0x51, 0x91, 0xa3, 0xa0, 0x82, 0x96, 0xf6, 0x1c, 0x71, 0x29, 0x28, 0xe3, 0x64, 0x8f,
0xcc, 0x1c, 0x17, 0xa8, 0x74, 0x46, 0x85, 0x14, 0x15, 0xd6, 0x7f, 0x00, 0x7b, 0x29, 0x96, 0xb3,
0x65, 0xff, 0x12, 0x1e, 0x8d, 0x50, 0x19, 0x7a, 0x44, 0x19, 0xcd, 0x75, 0x8a, 0xbf, 0xe7, 0xa8,
0x89, 0x9d, 0x01, 0xa8, 0x92, 0x7f, 0x35, 0x2e,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 0x38, 0x43, 0x6f, 0x3b, 0xf3, 0x9a, 0x1a, 0xe1, 0x3e, 0x7d, 0xba, 0x95, 0x5f, 0x2d, 0xcc,
0x10, 0x7a, 0x57, 0x9c, 0x63, 0x49, 0x37, 0x62, 0x22, 0xe7, 0x22, 0xbf, 0x53, 0x2b, 0x63, 0xe8,
0xa5, 0xf8, 0x0b, 0xf9, 0xff, 0x87, 0xbc, 0xf4, 0x4c, 0x9b, 0xb3, 0xaa, 0xed, 0x3b, 0xf4, 0xfc,
0xbd, 0x6c, 0x1e, 0xb9, 0x66, 0xaf, 0xdb, 0xee, 0xcd, 0xf3, 0x2d, 0x0f, 0x25, 0xe4, 0xdd, 0x0d,
0x5e, 0x98, 0xa5, 0x44, 0x91, 0x27, 0xa8, 0x75, 0xf6, 0x03, 0xc3, 0xe9, 0x5b, 0x28, 0x6e, 0x42,
0xec, 0xd6, 0x94, 0x94, 0xa9, 0x69, 0x98, 0x97, 0x62, 0x96, 0xd7, 0x4a, 0x6a, 0xe1, 0x5d, 0x49,
0xc7, 0x61, 0xdb, 0xa6, 0xc5, 0xc9, 0xfd, 0xf5, 0x3f, 0xd6, 0xc5, 0xbf, 0x00, 0x00, 0x00, 0xff,
0xff, 0xa5, 0xe8, 0x3e, 0x1e, 0x0b, 0x05, 0x00, 0x00,
}

View File

@ -45,6 +45,10 @@ service RicochetCore {
// Open a stream to monitor messages in conversations with contacts.
rpc MonitorConversations (MonitorConversationsRequest) returns (stream ConversationEvent);
rpc SendMessage (Message) returns (Message);
rpc MarkConversationRead (MarkConversationReadRequest) returns (Reply);
}
message Reply {
}
message ServerStatusRequest {