Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go/chat/inboxsource.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (s *RemoteInboxSource) Read(ctx context.Context, uid gregor1.UID,
}
// The *rquery.TlfID is trusted source of TLF ID here since it's derived
// from the TLF name in the query.
if !signedTlfID.Eq(*rquery.TlfID) || !signedTlfID.Eq(convLocal.Info.Triple.Tlfid) {
if !signedTlfID.Eq(*rquery.TlfID) || !signedTlfID.Eq(convLocal.Info.Triple.TlfID) {
return Inbox{}, ib.RateLimit, errors.New("server returned conversations for different TLF than query")
}
}
Expand Down
12 changes: 6 additions & 6 deletions go/chat/sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ func TestNonblockChannel(t *testing.T) {

res, err := ri.NewConversationRemote2(context.TODO(), chat1.NewConversationRemote2Arg{
IdTriple: chat1.ConversationIDTriple{
Tlfid: []byte{4, 5, 6},
TlfID: []byte{4, 5, 6},
TopicType: 0,
TopicID: []byte{0},
},
TLFMessage: chat1.MessageBoxed{
TlfMessage: chat1.MessageBoxed{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer TLFMessage on the go side here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That means tLFMessage in avdl per @gabriel 's linter. But I guess we could add special handling for TLF and ID. What do you think @gabriel?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I way prefer TlfMessage over tLFMessage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For TLFMessage: keybase/node-avdl-compiler#10 PTAL Thanks!

ClientHeader: chat1.MessageClientHeader{
TlfName: u.Username,
TlfPublic: false,
Expand Down Expand Up @@ -165,11 +165,11 @@ func TestNonblockTimer(t *testing.T) {

res, err := ri.NewConversationRemote2(context.TODO(), chat1.NewConversationRemote2Arg{
IdTriple: chat1.ConversationIDTriple{
Tlfid: []byte{4, 5, 6},
TlfID: []byte{4, 5, 6},
TopicType: 0,
TopicID: []byte{0},
},
TLFMessage: chat1.MessageBoxed{
TlfMessage: chat1.MessageBoxed{
ClientHeader: chat1.MessageClientHeader{
TlfName: u.Username,
TlfPublic: false,
Expand Down Expand Up @@ -296,11 +296,11 @@ func TestFailing(t *testing.T) {

res, err := ri.NewConversationRemote2(context.TODO(), chat1.NewConversationRemote2Arg{
IdTriple: chat1.ConversationIDTriple{
Tlfid: []byte{4, 5, 6},
TlfID: []byte{4, 5, 6},
TopicType: 0,
TopicID: []byte{0},
},
TLFMessage: chat1.MessageBoxed{
TlfMessage: chat1.MessageBoxed{
ClientHeader: chat1.MessageClientHeader{
TlfName: u.Username,
TlfPublic: false,
Expand Down
2 changes: 1 addition & 1 deletion go/client/chat_cli_fetchers.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (f chatCLIConversationFetcher) fetch(ctx context.Context, g *libkb.GlobalCo
if conversationInfo == nil {
return chat1.ConversationLocal{}, nil, nil
}
f.query.ConversationId = conversationInfo.Id
f.query.ConversationID = conversationInfo.Id

gcfclres, err := chatClient.GetConversationForCLILocal(ctx, f.query)
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions go/kbtest/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func (m *ChatRemoteMock) GetInboxRemote(ctx context.Context, arg chat1.GetInboxR
if arg.Query.ConvID != nil && !conv.Metadata.ConversationID.Eq(*arg.Query.ConvID) {
continue
}
if arg.Query.TlfID != nil && !conv.Metadata.IdTriple.Tlfid.Eq(*arg.Query.TlfID) {
if arg.Query.TlfID != nil && !conv.Metadata.IdTriple.TlfID.Eq(*arg.Query.TlfID) {
continue
}
if arg.Query.TopicType != nil && conv.Metadata.IdTriple.TopicType != *arg.Query.TopicType {
Expand Down Expand Up @@ -230,7 +230,7 @@ func (m *ChatRemoteMock) GetInboxRemote(ctx context.Context, arg chat1.GetInboxR

func (m *ChatRemoteMock) GetInboxByTLFIDRemote(ctx context.Context, tlfID chat1.TLFID) (res chat1.GetInboxByTLFIDRemoteRes, err error) {
for _, conv := range m.world.conversations {
if tlfID.Eq(conv.Metadata.IdTriple.Tlfid) {
if tlfID.Eq(conv.Metadata.IdTriple.TlfID) {
convToAppend := *conv
convToAppend.ReaderInfo = m.makeReaderInfo(convToAppend.Metadata.ConversationID)
res.Convs = []chat1.Conversation{convToAppend}
Expand Down Expand Up @@ -325,14 +325,14 @@ func (m *ChatRemoteMock) NewConversationRemote(ctx context.Context, arg chat1.Co

func (m *ChatRemoteMock) NewConversationRemote2(ctx context.Context, arg chat1.NewConversationRemote2Arg) (res chat1.NewConversationRemoteRes, err error) {
for _, conv := range m.world.conversations {
if conv.Metadata.IdTriple.Tlfid.Eq(arg.IdTriple.Tlfid) &&
if conv.Metadata.IdTriple.TlfID.Eq(arg.IdTriple.TlfID) &&
conv.Metadata.IdTriple.TopicID.String() == arg.IdTriple.TopicID.String() &&
conv.Metadata.IdTriple.TopicType == arg.IdTriple.TopicType {
// Identical triple
return res, libkb.ChatConvExistsError{ConvID: conv.Metadata.ConversationID}
}
if arg.IdTriple.TopicType == chat1.TopicType_CHAT &&
conv.Metadata.IdTriple.Tlfid.Eq(arg.IdTriple.Tlfid) &&
conv.Metadata.IdTriple.TlfID.Eq(arg.IdTriple.TlfID) &&
conv.Metadata.IdTriple.TopicType == arg.IdTriple.TopicType {
// Existing CHAT conv
return res, libkb.ChatConvExistsError{ConvID: conv.Metadata.ConversationID}
Expand All @@ -341,7 +341,7 @@ func (m *ChatRemoteMock) NewConversationRemote2(ctx context.Context, arg chat1.N

res.ConvID = arg.IdTriple.ToConversationID([2]byte{0, 0})

first := m.insertMsgAndSort(res.ConvID, arg.TLFMessage)
first := m.insertMsgAndSort(res.ConvID, arg.TlfMessage)
m.world.conversations = append(m.world.conversations, &chat1.Conversation{
Metadata: chat1.ConversationMetadata{
IdTriple: arg.IdTriple,
Expand Down
2 changes: 1 addition & 1 deletion go/protocol/chat1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ type GetInboxQuery struct {
}

type ConversationIDTriple struct {
Tlfid TLFID `codec:"tlfid" json:"tlfid"`
TlfID TLFID `codec:"tlfID" json:"tlfID"`
TopicType TopicType `codec:"topicType" json:"topicType"`
TopicID TopicID `codec:"topicID" json:"topicID"`
}
Expand Down
4 changes: 2 additions & 2 deletions go/protocol/chat1/extras.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (t TopicID) String() string {
}

func (me ConversationIDTriple) Eq(other ConversationIDTriple) bool {
return me.Tlfid.Eq(other.Tlfid) &&
return me.TlfID.Eq(other.TlfID) &&
bytes.Equal([]byte(me.TopicID), []byte(other.TopicID)) &&
me.TopicType == other.TopicType
}
Expand Down Expand Up @@ -170,7 +170,7 @@ var ConversationStatusGregorRevMap = map[string]ConversationStatus{

func (t ConversationIDTriple) Hash() []byte {
h := sha256.New()
h.Write(t.Tlfid)
h.Write(t.TlfID)
h.Write(t.TopicID)
h.Write([]byte(strconv.Itoa(int(t.TopicType))))
hash := h.Sum(nil)
Expand Down
12 changes: 6 additions & 6 deletions go/protocol/chat1/gregor.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,34 @@ import (
)

type GenericPayload struct {
Action string `codec:"Action" json:"Action"`
Action string `codec:"action" json:"action"`
}

type NewConversationPayload struct {
Action string `codec:"Action" json:"Action"`
Action string `codec:"action" json:"action"`
ConvID ConversationID `codec:"convID" json:"convID"`
InboxVers InboxVers `codec:"inboxVers" json:"inboxVers"`
UnreadUpdate *UnreadUpdate `codec:"unreadUpdate,omitempty" json:"unreadUpdate,omitempty"`
}

type NewMessagePayload struct {
Action string `codec:"Action" json:"Action"`
Action string `codec:"action" json:"action"`
ConvID ConversationID `codec:"convID" json:"convID"`
Message MessageBoxed `codec:"message" json:"message"`
InboxVers InboxVers `codec:"inboxVers" json:"inboxVers"`
UnreadUpdate *UnreadUpdate `codec:"unreadUpdate,omitempty" json:"unreadUpdate,omitempty"`
}

type ReadMessagePayload struct {
Action string `codec:"Action" json:"Action"`
Action string `codec:"action" json:"action"`
ConvID ConversationID `codec:"convID" json:"convID"`
MsgID MessageID `codec:"msgID" json:"msgID"`
InboxVers InboxVers `codec:"inboxVers" json:"inboxVers"`
UnreadUpdate *UnreadUpdate `codec:"unreadUpdate,omitempty" json:"unreadUpdate,omitempty"`
}

type SetStatusPayload struct {
Action string `codec:"Action" json:"Action"`
Action string `codec:"action" json:"action"`
ConvID ConversationID `codec:"convID" json:"convID"`
Status ConversationStatus `codec:"status" json:"status"`
InboxVers InboxVers `codec:"inboxVers" json:"inboxVers"`
Expand All @@ -44,7 +44,7 @@ type SetStatusPayload struct {

type UnreadUpdate struct {
ConvID ConversationID `codec:"convID" json:"convID"`
UnreadMessages int `codec:"UnreadMessages" json:"UnreadMessages"`
UnreadMessages int `codec:"unreadMessages" json:"unreadMessages"`
}

type GregorInterface interface {
Expand Down
38 changes: 19 additions & 19 deletions go/protocol/chat1/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ type OutboxRecord struct {
State OutboxState `codec:"state" json:"state"`
OutboxID OutboxID `codec:"outboxID" json:"outboxID"`
ConvID ConversationID `codec:"convID" json:"convID"`
Msg MessagePlaintext `codec:"Msg" json:"Msg"`
Msg MessagePlaintext `codec:"msg" json:"msg"`
}

type HeaderPlaintextVersion int
Expand Down Expand Up @@ -516,9 +516,9 @@ func NewMessageUnboxedWithOutbox(v OutboxRecord) MessageUnboxed {
}

type UnreadFirstNumLimit struct {
NumRead int `codec:"NumRead" json:"NumRead"`
AtLeast int `codec:"AtLeast" json:"AtLeast"`
AtMost int `codec:"AtMost" json:"AtMost"`
NumRead int `codec:"numRead" json:"numRead"`
AtLeast int `codec:"atLeast" json:"atLeast"`
AtMost int `codec:"atMost" json:"atMost"`
}

type ConversationInfoLocal struct {
Expand Down Expand Up @@ -624,10 +624,10 @@ type GetInboxSummaryForCLILocalRes struct {

type GetConversationForCLILocalQuery struct {
MarkAsRead bool `codec:"markAsRead" json:"markAsRead"`
MessageTypes []MessageType `codec:"MessageTypes" json:"MessageTypes"`
Since *string `codec:"Since,omitempty" json:"Since,omitempty"`
MessageTypes []MessageType `codec:"messageTypes" json:"messageTypes"`
Since *string `codec:"since,omitempty" json:"since,omitempty"`
Limit UnreadFirstNumLimit `codec:"limit" json:"limit"`
ConversationId ConversationID `codec:"conversationId" json:"conversationId"`
ConversationID ConversationID `codec:"conversationID" json:"conversationID"`
}

type GetConversationForCLILocalRes struct {
Expand Down Expand Up @@ -874,7 +874,7 @@ func LocalProtocol(i LocalInterface) rpc.Protocol {
},
MethodType: rpc.MethodCall,
},
"SetConversationStatusLocal": {
"setConversationStatusLocal": {
MakeArg: func() interface{} {
ret := make([]SetConversationStatusLocalArg, 1)
return &ret
Expand Down Expand Up @@ -938,7 +938,7 @@ func LocalProtocol(i LocalInterface) rpc.Protocol {
},
MethodType: rpc.MethodCall,
},
"GetMessagesLocal": {
"getMessagesLocal": {
MakeArg: func() interface{} {
ret := make([]GetMessagesLocalArg, 1)
return &ret
Expand Down Expand Up @@ -986,7 +986,7 @@ func LocalProtocol(i LocalInterface) rpc.Protocol {
},
MethodType: rpc.MethodCall,
},
"DownloadAttachmentLocal": {
"downloadAttachmentLocal": {
MakeArg: func() interface{} {
ret := make([]DownloadAttachmentLocalArg, 1)
return &ret
Expand All @@ -1002,7 +1002,7 @@ func LocalProtocol(i LocalInterface) rpc.Protocol {
},
MethodType: rpc.MethodCall,
},
"DownloadFileAttachmentLocal": {
"downloadFileAttachmentLocal": {
MakeArg: func() interface{} {
ret := make([]DownloadFileAttachmentLocalArg, 1)
return &ret
Expand All @@ -1018,7 +1018,7 @@ func LocalProtocol(i LocalInterface) rpc.Protocol {
},
MethodType: rpc.MethodCall,
},
"CancelPost": {
"cancelPost": {
MakeArg: func() interface{} {
ret := make([]CancelPostArg, 1)
return &ret
Expand All @@ -1034,7 +1034,7 @@ func LocalProtocol(i LocalInterface) rpc.Protocol {
},
MethodType: rpc.MethodCall,
},
"RetryPost": {
"retryPost": {
MakeArg: func() interface{} {
ret := make([]RetryPostArg, 1)
return &ret
Expand Down Expand Up @@ -1100,7 +1100,7 @@ func (c LocalClient) PostLocalNonblock(ctx context.Context, __arg PostLocalNonbl
}

func (c LocalClient) SetConversationStatusLocal(ctx context.Context, __arg SetConversationStatusLocalArg) (res SetConversationStatusLocalRes, err error) {
err = c.Cli.Call(ctx, "chat.1.local.SetConversationStatusLocal", []interface{}{__arg}, &res)
err = c.Cli.Call(ctx, "chat.1.local.setConversationStatusLocal", []interface{}{__arg}, &res)
return
}

Expand All @@ -1122,7 +1122,7 @@ func (c LocalClient) GetConversationForCLILocal(ctx context.Context, query GetCo
}

func (c LocalClient) GetMessagesLocal(ctx context.Context, __arg GetMessagesLocalArg) (res GetMessagesLocalRes, err error) {
err = c.Cli.Call(ctx, "chat.1.local.GetMessagesLocal", []interface{}{__arg}, &res)
err = c.Cli.Call(ctx, "chat.1.local.getMessagesLocal", []interface{}{__arg}, &res)
return
}

Expand All @@ -1137,24 +1137,24 @@ func (c LocalClient) PostFileAttachmentLocal(ctx context.Context, __arg PostFile
}

func (c LocalClient) DownloadAttachmentLocal(ctx context.Context, __arg DownloadAttachmentLocalArg) (res DownloadAttachmentLocalRes, err error) {
err = c.Cli.Call(ctx, "chat.1.local.DownloadAttachmentLocal", []interface{}{__arg}, &res)
err = c.Cli.Call(ctx, "chat.1.local.downloadAttachmentLocal", []interface{}{__arg}, &res)
return
}

func (c LocalClient) DownloadFileAttachmentLocal(ctx context.Context, __arg DownloadFileAttachmentLocalArg) (res DownloadAttachmentLocalRes, err error) {
err = c.Cli.Call(ctx, "chat.1.local.DownloadFileAttachmentLocal", []interface{}{__arg}, &res)
err = c.Cli.Call(ctx, "chat.1.local.downloadFileAttachmentLocal", []interface{}{__arg}, &res)
return
}

func (c LocalClient) CancelPost(ctx context.Context, outboxID OutboxID) (err error) {
__arg := CancelPostArg{OutboxID: outboxID}
err = c.Cli.Call(ctx, "chat.1.local.CancelPost", []interface{}{__arg}, nil)
err = c.Cli.Call(ctx, "chat.1.local.cancelPost", []interface{}{__arg}, nil)
return
}

func (c LocalClient) RetryPost(ctx context.Context, outboxID OutboxID) (err error) {
__arg := RetryPostArg{OutboxID: outboxID}
err = c.Cli.Call(ctx, "chat.1.local.RetryPost", []interface{}{__arg}, nil)
err = c.Cli.Call(ctx, "chat.1.local.retryPost", []interface{}{__arg}, nil)
return
}

Expand Down
4 changes: 2 additions & 2 deletions go/protocol/chat1/notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func NotifyChatProtocol(i NotifyChatInterface) rpc.Protocol {
return rpc.Protocol{
Name: "chat.1.NotifyChat",
Methods: map[string]rpc.ServeHandlerDescription{
"NewChatActivity": {
"newChatActivity": {
MakeArg: func() interface{} {
ret := make([]NewChatActivityArg, 1)
return &ret
Expand All @@ -231,6 +231,6 @@ type NotifyChatClient struct {
}

func (c NotifyChatClient) NewChatActivity(ctx context.Context, __arg NewChatActivityArg) (err error) {
err = c.Cli.Notify(ctx, "chat.1.NotifyChat.NewChatActivity", []interface{}{__arg})
err = c.Cli.Notify(ctx, "chat.1.NotifyChat.newChatActivity", []interface{}{__arg})
return
}
10 changes: 5 additions & 5 deletions go/protocol/chat1/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ type NewConversationRemoteArg struct {

type NewConversationRemote2Arg struct {
IdTriple ConversationIDTriple `codec:"idTriple" json:"idTriple"`
TLFMessage MessageBoxed `codec:"TLFMessage" json:"TLFMessage"`
TlfMessage MessageBoxed `codec:"tlfMessage" json:"tlfMessage"`
}

type GetMessagesRemoteArg struct {
Expand Down Expand Up @@ -269,7 +269,7 @@ func RemoteProtocol(i RemoteInterface) rpc.Protocol {
},
MethodType: rpc.MethodCall,
},
"SetConversationStatus": {
"setConversationStatus": {
MakeArg: func() interface{} {
ret := make([]SetConversationStatusArg, 1)
return &ret
Expand Down Expand Up @@ -301,7 +301,7 @@ func RemoteProtocol(i RemoteInterface) rpc.Protocol {
},
MethodType: rpc.MethodCall,
},
"GetUnreadUpdateFull": {
"getUnreadUpdateFull": {
MakeArg: func() interface{} {
ret := make([]GetUnreadUpdateFullArg, 1)
return &ret
Expand Down Expand Up @@ -394,7 +394,7 @@ func (c RemoteClient) MarkAsRead(ctx context.Context, __arg MarkAsReadArg) (res
}

func (c RemoteClient) SetConversationStatus(ctx context.Context, __arg SetConversationStatusArg) (res SetConversationStatusRes, err error) {
err = c.Cli.Call(ctx, "chat.1.remote.SetConversationStatus", []interface{}{__arg}, &res)
err = c.Cli.Call(ctx, "chat.1.remote.setConversationStatus", []interface{}{__arg}, &res)
return
}

Expand All @@ -406,7 +406,7 @@ func (c RemoteClient) TlfFinalize(ctx context.Context, tlfID TLFID) (err error)

func (c RemoteClient) GetUnreadUpdateFull(ctx context.Context, inboxVers InboxVers) (res UnreadUpdateFull, err error) {
__arg := GetUnreadUpdateFullArg{InboxVers: inboxVers}
err = c.Cli.Call(ctx, "chat.1.remote.GetUnreadUpdateFull", []interface{}{__arg}, &res)
err = c.Cli.Call(ctx, "chat.1.remote.getUnreadUpdateFull", []interface{}{__arg}, &res)
return
}

Expand Down
4 changes: 2 additions & 2 deletions go/protocol/keybase1/tlf.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TlfProtocol(i TlfInterface) rpc.Protocol {
return rpc.Protocol{
Name: "keybase.1.tlf",
Methods: map[string]rpc.ServeHandlerDescription{
"CryptKeys": {
"cryptKeys": {
MakeArg: func() interface{} {
ret := make([]CryptKeysArg, 1)
return &ret
Expand Down Expand Up @@ -92,7 +92,7 @@ type TlfClient struct {
// CryptKeys returns TLF crypt keys from all generations.
func (c TlfClient) CryptKeys(ctx context.Context, query TLFQuery) (res GetTLFCryptKeysRes, err error) {
__arg := CryptKeysArg{Query: query}
err = c.Cli.Call(ctx, "keybase.1.tlf.CryptKeys", []interface{}{__arg}, &res)
err = c.Cli.Call(ctx, "keybase.1.tlf.cryptKeys", []interface{}{__arg}, &res)
return
}

Expand Down
Loading