Pol  Revision:3cfda13
msgfiltr.cpp
Go to the documentation of this file.
1 
12 #include "msgfiltr.h"
13 
14 #include <cstring>
15 
16 #include "../globals/network.h"
17 #include "../pktbothid.h"
18 #include "../pktinid.h"
19 
20 namespace Pol
21 {
22 namespace Core
23 {
25 {
26  unsigned char normal;
27  unsigned char abnormal;
28  if ( def == NormallyDisabled )
29  normal = 0;
30  else
31  normal = 1;
32  abnormal = !normal;
33 
34  memset( msgtype_allowed, normal, sizeof msgtype_allowed );
35 
36  while ( *exceptions != -1 )
37  {
38  msgtype_allowed[*exceptions & 0xFF] = abnormal;
39  ++exceptions;
40  }
41 }
42 
44 {
45  int login_exceptions[] = {PKTIN_00_ID, PKTIN_5D_ID, PKTBI_73_ID, PKTIN_80_ID, PKTIN_83_ID,
47  PKTIN_E1_ID, // Used by UO:KR & SA
48  PKTIN_E4_ID, // Used by UO:KR
50  0xF1, // used by UOGateway
51  -1};
52  networkManager.login_filter = std::unique_ptr<MessageTypeFilter>(
53  new MessageTypeFilter( MessageTypeFilter::NormallyDisabled, login_exceptions ) );
54 
55  int game_exceptions[] = {PKTIN_00_ID, PKTIN_5D_ID, PKTIN_80_ID, PKTIN_83_ID,
58  networkManager.game_filter = std::unique_ptr<MessageTypeFilter>(
59  new MessageTypeFilter( MessageTypeFilter::NormallyEnabled, game_exceptions ) );
60 
61  int no_exceptions[] = {-1};
62  networkManager.disconnected_filter = std::unique_ptr<MessageTypeFilter>(
64 }
65 }
66 }
static void createMessageFilter()
Definition: msgfiltr.cpp:43
MessageTypeFilter(MessageDefault def, int *exceptions)
Definition: msgfiltr.cpp:24
std::unique_ptr< MessageTypeFilter > disconnected_filter
Definition: network.h:75
unsigned char msgtype_allowed[256]
Definition: msgfiltr.h:25
NetworkManager networkManager
Definition: network.cpp:28
std::unique_ptr< MessageTypeFilter > login_filter
Definition: network.h:73
std::unique_ptr< MessageTypeFilter > game_filter
Definition: network.h:74
Definition: berror.cpp:12