Skip to content

Commit

Permalink
issue #55 - stub PermitDeny subgroup handlers
Browse files Browse the repository at this point in the history
The AIM 4.0 for macOS was freezing at login because OService reported
that the PermitDeny service was available but there were no rate limit
entries for the PermitDeny subgroups.

This commit adds PermitDeny to the rate limit list and stubs out
AddPermListEntries and SetGroupPermitMask to make AIM 4.0 and ICQ 2000b
happy.
  • Loading branch information
mk6i committed Jul 25, 2024
1 parent 20fc3e5 commit 99d72d1
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 0 deletions.
14 changes: 14 additions & 0 deletions foodgroup/oservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,19 @@ func init() {
wire.AlertNotifyDisplayCapabilities,
wire.AlertUserOnline,
},
wire.PermitDeny: {
wire.PermitDenyErr,
wire.PermitDenyRightsQuery,
wire.PermitDenyRightsReply,
wire.PermitDenySetGroupPermitMask,
wire.PermitDenyAddPermListEntries,
wire.PermitDenyDelPermListEntries,
wire.PermitDenyAddDenyListEntries,
wire.PermitDenyDelDenyListEntries,
wire.PermitDenyBosErr,
wire.PermitDenyAddTempPermitListEntries,
wire.PermitDenyDelTempPermitListEntries,
},
}

for _, foodGroup := range []uint16{
Expand All @@ -339,6 +352,7 @@ func init() {
wire.Feedbag,
wire.BUCP,
wire.Alert,
wire.PermitDeny,
} {
subGroups := foodGroupToSubgroup[foodGroup]
for _, subGroup := range subGroups {
Expand Down
44 changes: 44 additions & 0 deletions foodgroup/oservice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1375,6 +1375,50 @@ func TestOServiceService_RateParamsQuery(t *testing.T) {
FoodGroup: wire.Alert,
SubGroup: wire.AlertUserOnline,
},
{
FoodGroup: wire.PermitDeny,
SubGroup: wire.PermitDenyErr,
},
{
FoodGroup: wire.PermitDeny,
SubGroup: wire.PermitDenyRightsQuery,
},
{
FoodGroup: wire.PermitDeny,
SubGroup: wire.PermitDenyRightsReply,
},
{
FoodGroup: wire.PermitDeny,
SubGroup: wire.PermitDenySetGroupPermitMask,
},
{
FoodGroup: wire.PermitDeny,
SubGroup: wire.PermitDenyAddPermListEntries,
},
{
FoodGroup: wire.PermitDeny,
SubGroup: wire.PermitDenyDelPermListEntries,
},
{
FoodGroup: wire.PermitDeny,
SubGroup: wire.PermitDenyAddDenyListEntries,
},
{
FoodGroup: wire.PermitDeny,
SubGroup: wire.PermitDenyDelDenyListEntries,
},
{
FoodGroup: wire.PermitDeny,
SubGroup: wire.PermitDenyBosErr,
},
{
FoodGroup: wire.PermitDeny,
SubGroup: wire.PermitDenyAddTempPermitListEntries,
},
{
FoodGroup: wire.PermitDeny,
SubGroup: wire.PermitDenyDelTempPermitListEntries,
},
},
},
},
Expand Down
9 changes: 9 additions & 0 deletions server/oscar/handler/permit_deny.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,12 @@ func (rt PermitDenyHandler) RightsQuery(ctx context.Context, _ *state.Session, i
rt.LogRequestAndResponse(ctx, inFrame, nil, outSNAC.Frame, outSNAC.Body)
return rw.SendSNAC(outSNAC.Frame, outSNAC.Body)
}

func (rt PermitDenyHandler) AddPermListEntries(ctx context.Context, _ *state.Session, inFrame wire.SNACFrame, _ io.Reader, rw oscar.ResponseWriter) error {
rt.Logger.Debug("got a request for AddPermListEntries, but not doing anything about it right now")
return nil
}
func (rt PermitDenyHandler) SetGroupPermitMask(ctx context.Context, _ *state.Session, inFrame wire.SNACFrame, _ io.Reader, rw oscar.ResponseWriter) error {
rt.Logger.Debug("got a request for SetGroupPermitMask, but not doing anything about it right now")
return nil
}
2 changes: 2 additions & 0 deletions server/oscar/handler/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ func NewBOSRouter(h Handlers) oscar.Router {
router.Register(wire.Locate, wire.LocateUserInfoQuery2, h.LocateHandler.UserInfoQuery2)

router.Register(wire.PermitDeny, wire.PermitDenyRightsQuery, h.PermitDenyHandler.RightsQuery)
router.Register(wire.PermitDeny, wire.PermitDenyAddPermListEntries, h.PermitDenyHandler.AddPermListEntries)
router.Register(wire.PermitDeny, wire.PermitDenySetGroupPermitMask, h.PermitDenyHandler.SetGroupPermitMask)

router.Register(wire.OService, wire.OServiceClientOnline, h.OServiceHandler.ClientOnline)
router.Register(wire.OService, wire.OServiceClientVersions, h.OServiceHandler.ClientVersions)
Expand Down

0 comments on commit 99d72d1

Please sign in to comment.