Просмотр исходного кода

icbm: send TLV(0x0B) only on IM events

This fixes a bug where you get a "client does not support chat" message
when sending a chat invite from windows aim to macos aim.
Mike 1 год назад
Родитель
Сommit
1bfc6d17e4
2 измененных файлов с 5 добавлено и 7 удалено
  1. 5 4
      foodgroup/icbm.go
  2. 0 3
      foodgroup/icbm_test.go

+ 5 - 4
foodgroup/icbm.go

@@ -142,10 +142,11 @@ func (s ICBMService) ChannelMsgToHost(ctx context.Context, sess *state.Session,
 		clientIM.Append(tlv)
 	}
 
-	// todo I forget why I added this TLV here, but it should be added
-	//  conditionally. I moved it from the beginning of the TLV list to the end
-	//  since BeAIM assumes that the first TLV is 0x02.
-	clientIM.Append(wire.NewTLVBE(wire.ICBMTLVWantEvents, []byte{}))
+	if inBody.ChannelID == wire.ICBMChannelIM || inBody.ChannelID == wire.ICBMChannelMIME {
+		// tell the receiver that we want to receive their typing events.
+		// todo: only send this TLV if the sender opts to disclose typing events
+		clientIM.Append(wire.NewTLVBE(wire.ICBMTLVWantEvents, []byte{}))
+	}
 
 	s.messageRelayer.RelayToScreenName(ctx, recipSess.IdentScreenName(), wire.SNACMessage{
 		Frame: wire.SNACFrame{

+ 0 - 3
foodgroup/icbm_test.go

@@ -500,7 +500,6 @@ func TestICBMService_ChannelMsgToHost(t *testing.T) {
 													},
 												},
 											}),
-											wire.NewTLVBE(wire.ICBMTLVWantEvents, []byte{}),
 										},
 									},
 								},
@@ -581,7 +580,6 @@ func TestICBMService_ChannelMsgToHost(t *testing.T) {
 												Type:       wire.ICBMRdvMessageCancel,
 												Capability: wire.CapFileTransfer,
 											}),
-											wire.NewTLVBE(wire.ICBMTLVWantEvents, []byte{}),
 										},
 									},
 								},
@@ -661,7 +659,6 @@ func TestICBMService_ChannelMsgToHost(t *testing.T) {
 													},
 												},
 											}),
-											wire.NewTLVBE(wire.ICBMTLVWantEvents, []byte{}),
 										},
 									},
 								},