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

append user info flag TLV to buddy departure events

This is required for departure messages to work in ICQ 2000b.
Mike 2 лет назад
Родитель
Сommit
71984cf4d1
2 измененных файлов с 14 добавлено и 2 удалено
  1. 9 2
      foodgroup/buddy.go
  2. 5 0
      foodgroup/buddy_test.go

+ 9 - 2
foodgroup/buddy.go

@@ -215,8 +215,15 @@ func (s BuddyService) BroadcastBuddyDeparted(ctx context.Context, sess *state.Se
 			TLVUserInfo: wire.TLVUserInfo{
 				// don't include the TLV block, otherwise the AIM client fails
 				// to process the block event
-				ScreenName:   string(sess.DisplayScreenName()),
+				ScreenName:   sess.IdentScreenName().String(),
 				WarningLevel: sess.Warning(),
+				TLVBlock: wire.TLVBlock{
+					TLVList: wire.TLVList{
+						// this TLV needs to be set in order for departure
+						// events to work in ICQ
+						wire.NewTLV(wire.OServiceUserInfoUserFlags, uint8(0)),
+					},
+				},
 			},
 		},
 	})
@@ -234,7 +241,7 @@ func (s BuddyService) UnicastBuddyDeparted(ctx context.Context, from *state.Sess
 			TLVUserInfo: wire.TLVUserInfo{
 				// don't include the TLV block, otherwise the AIM client fails
 				// to process the block event
-				ScreenName:   string(from.DisplayScreenName()),
+				ScreenName:   from.IdentScreenName().String(),
 				WarningLevel: from.Warning(),
 			},
 		},

+ 5 - 0
foodgroup/buddy_test.go

@@ -442,6 +442,11 @@ func TestBuddyService_BroadcastDeparture(t *testing.T) {
 									TLVUserInfo: wire.TLVUserInfo{
 										ScreenName:   "user_screen_name",
 										WarningLevel: 0,
+										TLVBlock: wire.TLVBlock{
+											TLVList: wire.TLVList{
+												wire.NewTLV(wire.OServiceUserInfoUserFlags, uint8(0)),
+											},
+										},
 									},
 								},
 							},