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

make java aim client 1.1.19 work

Mike 1 год назад
Родитель
Сommit
9702696346

+ 4 - 0
foodgroup/buddy.go

@@ -154,6 +154,7 @@ func (s buddyNotifier) BroadcastBuddyArrived(ctx context.Context, sess *state.Se
 		Frame: wire.SNACFrame{
 			FoodGroup: wire.Buddy,
 			SubGroup:  wire.BuddyArrived,
+			RequestID: wire.ReqIDFromServer,
 		},
 		Body: wire.SNAC_0x03_0x0B_BuddyArrived{
 			TLVUserInfo: userInfo,
@@ -181,6 +182,7 @@ func (s buddyNotifier) BroadcastBuddyDeparted(ctx context.Context, sess *state.S
 		Frame: wire.SNACFrame{
 			FoodGroup: wire.Buddy,
 			SubGroup:  wire.BuddyDeparted,
+			RequestID: wire.ReqIDFromServer,
 		},
 		Body: wire.SNAC_0x03_0x0C_BuddyDeparted{
 			TLVUserInfo: wire.TLVUserInfo{
@@ -295,6 +297,7 @@ func (s buddyNotifier) unicastBuddyDeparted(ctx context.Context, from *state.Ses
 		Frame: wire.SNACFrame{
 			FoodGroup: wire.Buddy,
 			SubGroup:  wire.BuddyDeparted,
+			RequestID: wire.ReqIDFromServer,
 		},
 		Body: wire.SNAC_0x03_0x0C_BuddyDeparted{
 			TLVUserInfo: wire.TLVUserInfo{
@@ -316,6 +319,7 @@ func (s buddyNotifier) unicastBuddyArrived(ctx context.Context, userInfo wire.TL
 		Frame: wire.SNACFrame{
 			FoodGroup: wire.Buddy,
 			SubGroup:  wire.BuddyArrived,
+			RequestID: wire.ReqIDFromServer,
 		},
 		Body: wire.SNAC_0x03_0x0B_BuddyArrived{
 			TLVUserInfo: userInfo,

+ 3 - 0
foodgroup/buddy_test.go

@@ -425,6 +425,7 @@ func TestBuddyService_BroadcastDeparture(t *testing.T) {
 								Frame: wire.SNACFrame{
 									FoodGroup: wire.Buddy,
 									SubGroup:  wire.BuddyDeparted,
+									RequestID: wire.ReqIDFromServer,
 								},
 								Body: wire.SNAC_0x03_0x0C_BuddyDeparted{
 									TLVUserInfo: wire.TLVUserInfo{
@@ -872,6 +873,7 @@ func newBuddyDepartedNotif(me *state.Session) wire.SNACMessage {
 		Frame: wire.SNACFrame{
 			FoodGroup: wire.Buddy,
 			SubGroup:  wire.BuddyDeparted,
+			RequestID: wire.ReqIDFromServer,
 		},
 		Body: wire.SNAC_0x03_0x0C_BuddyDeparted{
 			TLVUserInfo: wire.TLVUserInfo{
@@ -889,6 +891,7 @@ func newBuddyArrivedNotif(userInfo wire.TLVUserInfo) wire.SNACMessage {
 		Frame: wire.SNACFrame{
 			FoodGroup: wire.Buddy,
 			SubGroup:  wire.BuddyArrived,
+			RequestID: wire.ReqIDFromServer,
 		},
 		Body: wire.SNAC_0x03_0x0B_BuddyArrived{
 			TLVUserInfo: userInfo,

+ 1 - 0
foodgroup/icbm.go

@@ -148,6 +148,7 @@ func (s ICBMService) ChannelMsgToHost(ctx context.Context, sess *state.Session,
 		Frame: wire.SNACFrame{
 			FoodGroup: wire.ICBM,
 			SubGroup:  wire.ICBMChannelMsgToClient,
+			RequestID: wire.ReqIDFromServer,
 		},
 		Body: clientIM,
 	})

+ 2 - 0
foodgroup/icbm_test.go

@@ -63,6 +63,7 @@ func TestICBMService_ChannelMsgToHost(t *testing.T) {
 								Frame: wire.SNACFrame{
 									FoodGroup: wire.ICBM,
 									SubGroup:  wire.ICBMChannelMsgToClient,
+									RequestID: wire.ReqIDFromServer,
 								},
 								Body: wire.SNAC_0x04_0x07_ICBMChannelMsgToClient{
 									TLVUserInfo: newTestSession("sender-screen-name", sessOptWarning(10)).TLVUserInfo(),
@@ -150,6 +151,7 @@ func TestICBMService_ChannelMsgToHost(t *testing.T) {
 								Frame: wire.SNACFrame{
 									FoodGroup: wire.ICBM,
 									SubGroup:  wire.ICBMChannelMsgToClient,
+									RequestID: wire.ReqIDFromServer,
 								},
 								Body: wire.SNAC_0x04_0x07_ICBMChannelMsgToClient{
 									TLVUserInfo: newTestSession("sender-screen-name", sessOptWarning(10)).TLVUserInfo(),

+ 4 - 0
foodgroup/oservice.go

@@ -592,6 +592,7 @@ func (s OServiceService) HostOnline() wire.SNACMessage {
 		Frame: wire.SNACFrame{
 			FoodGroup: wire.OService,
 			SubGroup:  wire.OServiceHostOnline,
+			RequestID: wire.ReqIDFromServer,
 		},
 		Body: wire.SNAC_0x01_0x03_OServiceHostOnline{
 			FoodGroups: s.foodGroups,
@@ -628,6 +629,9 @@ func NewOServiceServiceForBOS(
 				wire.OService,
 				wire.PermitDeny,
 				wire.UserLookup,
+				wire.Invite,
+				wire.Popup,
+				wire.Stats,
 			},
 		},
 	}

+ 7 - 0
foodgroup/oservice_test.go

@@ -1559,6 +1559,7 @@ func TestOServiceServiceForBOS_OServiceHostOnline(t *testing.T) {
 		Frame: wire.SNACFrame{
 			FoodGroup: wire.OService,
 			SubGroup:  wire.OServiceHostOnline,
+			RequestID: wire.ReqIDFromServer,
 		},
 		Body: wire.SNAC_0x01_0x03_OServiceHostOnline{
 			FoodGroups: []uint16{
@@ -1572,6 +1573,9 @@ func TestOServiceServiceForBOS_OServiceHostOnline(t *testing.T) {
 				wire.OService,
 				wire.PermitDeny,
 				wire.UserLookup,
+				wire.Invite,
+				wire.Popup,
+				wire.Stats,
 			},
 		},
 	}
@@ -1587,6 +1591,7 @@ func TestOServiceServiceForChat_OServiceHostOnline(t *testing.T) {
 		Frame: wire.SNACFrame{
 			FoodGroup: wire.OService,
 			SubGroup:  wire.OServiceHostOnline,
+			RequestID: wire.ReqIDFromServer,
 		},
 		Body: wire.SNAC_0x01_0x03_OServiceHostOnline{
 			FoodGroups: []uint16{
@@ -1901,6 +1906,7 @@ func TestOServiceServiceForChatNav_HostOnline(t *testing.T) {
 		Frame: wire.SNACFrame{
 			FoodGroup: wire.OService,
 			SubGroup:  wire.OServiceHostOnline,
+			RequestID: wire.ReqIDFromServer,
 		},
 		Body: wire.SNAC_0x01_0x03_OServiceHostOnline{
 			FoodGroups: []uint16{
@@ -1921,6 +1927,7 @@ func TestOServiceServiceForAlert_HostOnline(t *testing.T) {
 		Frame: wire.SNACFrame{
 			FoodGroup: wire.OService,
 			SubGroup:  wire.OServiceHostOnline,
+			RequestID: wire.ReqIDFromServer,
 		},
 		Body: wire.SNAC_0x01_0x03_OServiceHostOnline{
 			FoodGroups: []uint16{

+ 6 - 0
wire/frames.go

@@ -43,6 +43,12 @@ type SNACFrame struct {
 	RequestID uint32
 }
 
+// ReqIDFromServer is the SNAC frame Request ID value that indicates the SNAC
+// is initiated by the server. Some clients, such as the Java AIM 1.1.19,
+// completely fail to process some server SNACs if the high bit is not set on
+// request ID.
+const ReqIDFromServer = 1 << 31
+
 type FLAPSignonFrame struct {
 	FLAPVersion uint32
 	TLVRestBlock