BigBrotherBot/big-brother-bot

client auth event is different for frostbite parsers

Closed this issue · 2 comments

As far as I understood, frostbite parsers use EVT_PUNKBUSTER_NEW_CONNECTION instead of EVT_CLIENT_AUTH but they actually match the very same event: in EVT_CLIENT_CONNECT the client is not authed, but in EVT_PUNKBUSTER_NEW_CONNECTION or EVT_CLIENT_AUTH the client is authed. Wouldn't it be better to use just 1 event? Otherwise in plugins we would need to handle this situation (we are already doing it).

frostbite parsers use EVT_PUNKBUSTER_NEW_CONNECTION

Frostbite parsers fire the EVT_PUNKBUSTER_NEW_CONNECTION whenever they receive the matching event from the Frostbite game engine. This event bring valuable data such as the player's IP address. We cannot guess what useful use a plugin developer could come up with based on that event, so I do not question the usefulness of raising it. Just let it be raised ;)

instead of EVT_CLIENT_AUTH

Not really. The EVT_CLIENT_AUTH is fired by the Client class when authentication happens. Parsers don't raise this event.

in EVT_CLIENT_CONNECT the client is not authed, but in EVT_PUNKBUSTER_NEW_CONNECTION or EVT_CLIENT_AUTH the client is authed.

  • in EVT_CLIENT_AUTH: this is expected
  • in EVT_CLIENT_CONNECT: also expected for most parsers I believe
  • in EVT_PUNKBUSTER_NEW_CONNECTION: That might be the case but there is no warranty it would be. Plugins should not assume a client is authed when receiving this event.

Wouldn't it be better to use just 1 event?

I don't think so. Events are supposed to be used in different situations and hold different data that would be used in different ways.

Alright. I didn't dig in the code so I assumed that EVT_PUNKBUSTER_NEW_CONNECTION was a drop in replacement for EVT_CLIENT_AUTH in frostbite parsers when using punkbuster. I thought so because I saw in some plugins make this distinction and I did the same. i guess I'll correct some of my code and send u a pull request later in the evening