Mike 1 год назад
Родитель
Сommit
d31d36f10a
8 измененных файлов с 48 добавлено и 0 удалено
  1. 4 0
      foodgroup/buddy.go
  2. 3 0
      foodgroup/buddy_test.go
  3. 1 0
      foodgroup/icbm.go
  4. 5 0
      foodgroup/icbm_test.go
  5. 8 0
      foodgroup/oservice.go
  6. 11 0
      foodgroup/oservice_test.go
  7. 6 0
      wire/frames.go
  8. 10 0
      wire/snacs.go

+ 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

@@ -151,6 +151,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,
 	})

+ 5 - 0
foodgroup/icbm_test.go

@@ -65,6 +65,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{
 									ChannelID:   wire.ICBMChannelIM,
@@ -155,6 +156,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{
 									ChannelID:   wire.ICBMChannelIM,
@@ -480,6 +482,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{
 									ChannelID:   wire.ICBMChannelRendezvous,
@@ -567,6 +570,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{
 									ChannelID:   wire.ICBMChannelRendezvous,
@@ -640,6 +644,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{
 									ChannelID:   wire.ICBMChannelRendezvous,

+ 8 - 0
foodgroup/oservice.go

@@ -244,6 +244,9 @@ func init() {
 			wire.ICBMClientEvent,
 			wire.ICBMSinReply,
 		},
+		wire.Invite: {
+			wire.InviteRequestQuery,
+		},
 		wire.ChatNav: {
 			wire.ChatNavErr,
 			wire.ChatNavRequestChatRights,
@@ -416,6 +419,7 @@ func init() {
 		wire.Locate,
 		wire.Buddy,
 		wire.ICBM,
+		wire.Invite,
 		wire.ChatNav,
 		wire.Chat,
 		wire.BART,
@@ -592,6 +596,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 +633,9 @@ func NewOServiceServiceForBOS(
 				wire.OService,
 				wire.PermitDeny,
 				wire.UserLookup,
+				wire.Invite,
+				wire.Popup,
+				wire.Stats,
 			},
 		},
 	}

+ 11 - 0
foodgroup/oservice_test.go

@@ -845,6 +845,10 @@ func TestOServiceService_RateParamsQuery(t *testing.T) {
 					FoodGroup: wire.ICBM,
 					SubGroup:  wire.ICBMSinReply,
 				},
+				{
+					FoodGroup: wire.Invite,
+					SubGroup:  wire.InviteRequestQuery,
+				},
 				{
 					FoodGroup: wire.ChatNav,
 					SubGroup:  wire.ChatNavErr,
@@ -1559,6 +1563,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 +1577,9 @@ func TestOServiceServiceForBOS_OServiceHostOnline(t *testing.T) {
 				wire.OService,
 				wire.PermitDeny,
 				wire.UserLookup,
+				wire.Invite,
+				wire.Popup,
+				wire.Stats,
 			},
 		},
 	}
@@ -1587,6 +1595,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 +1910,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 +1931,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

+ 10 - 0
wire/snacs.go

@@ -796,6 +796,16 @@ type SNAC_0x04_0x14_ICBMClientEvent struct {
 	Event      uint16
 }
 
+//
+// 0x06: Invite
+//
+
+const (
+	InviteErr          uint16 = 0x0001
+	InviteRequestQuery uint16 = 0x0002
+	InviteRequestReply uint16 = 0x0003
+)
+
 //
 // 0x07: Admin
 //