messenger.py (1227B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\clientevents\client\messenger.py 2 import logging 3 import socket 4 import struct 5 from eveProto.generated.eve_public.app.eveonline.network.api.events_pb2 import ConnectionLost 6 from ipaddress.proto import to_eve_public 7 logger = logging.getLogger('clientevents.messenger') 8 9 class ClientEventsMessenger(object): 10 public_gateway = None 11 12 def __init__(self, public_gateway): 13 self.public_gateway = public_gateway 14 15 def connection_lost(self, user_id, reason_str, country_code, asn, ip_address): 16 event = ConnectionLost() 17 if user_id: 18 event.user.sequential = user_id 19 if reason_str: 20 event.reason = reason_str 21 if country_code: 22 event.country_code = country_code 23 if asn: 24 event.asn = asn 25 if ip_address: 26 event.ip_address.CopyFrom(to_eve_public(ip_address)) 27 self.public_gateway.publish_event_payload(event) 28 logger.info('Client Events: ConnectionLost event emitted for user %s with reason %s. country_code = %s, asn = %s, ipv4 = %s' % (user_id, 29 reason_str, 30 country_code, 31 asn, 32 ip_address))