mirror of
https://git.ugnet.gay/CrossTalk/azul.git
synced 2026-11-25 08:30:04 +00:00
bug fixes and improvements
- aliases are now handled properly in ABCH - removed final escargot leftovers (dev webconsole) - OSCAR etc. logging was not at log level debug - removed leftover debug code
This commit is contained in:
1 parent
4bf878556b
commit
6451bb9426
46 files changed
+307
-541
No files matched your search
@@ -108,7 +108,7 @@ class OSERVICEFoodgroup:
|
||||
|
||||
@Subgroup(0x0017)
|
||||
def client_versions(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
|
||||
self.logger.info('[Client] OSERVICE__CLIENT_VERSIONS')
|
||||
self.logger.debug('[Client] OSERVICE__CLIENT_VERSIONS')
|
||||
|
||||
versions = {}
|
||||
while len(message) >= 4:
|
||||
@@ -122,7 +122,7 @@ class OSERVICEFoodgroup:
|
||||
response_msg.write_u16(foodgroup)
|
||||
response_msg.write_u16(version)
|
||||
|
||||
self.logger.info('[Server] OSERVICE__HOST_VERSIONS')
|
||||
self.logger.debug('[Server] OSERVICE__HOST_VERSIONS')
|
||||
client.send_snac(response_msg)
|
||||
|
||||
if getattr(settings, 'OSCAR_MOTD_ENABLED', False):
|
||||
@@ -130,12 +130,12 @@ class OSERVICEFoodgroup:
|
||||
motd = SNACMessage(0x0001, 0x0013)
|
||||
motd.write_u16(0x0004)
|
||||
motd.write_tlv(TLV(0x000B, getattr(settings, 'OSCAR_MOTD_TEXT', 'Welcome to CrossTalk!')))
|
||||
self.logger.info('[Server] OSERVICE__MOTD')
|
||||
self.logger.debug('[Server] OSERVICE__MOTD')
|
||||
client.send_snac(motd)
|
||||
|
||||
@Subgroup(0x0002)
|
||||
def client_ready(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
|
||||
self.logger.info('[Client] OSERVICE__CLIENT_READY')
|
||||
self.logger.debug('[Client] OSERVICE__CLIENT_READY')
|
||||
|
||||
ctrl = client.ctrl
|
||||
if ctrl.is_service:
|
||||
@@ -169,7 +169,7 @@ class OSERVICEFoodgroup:
|
||||
msg = SNACMessage(0x000B, 0x0002)
|
||||
msg.write_u16(MIN_STATS_REPORT_INTERVAL)
|
||||
|
||||
self.logger.info('[Server] STATS__SET_MIN_REPORT_INTERVAL')
|
||||
self.logger.debug('[Server] STATS__SET_MIN_REPORT_INTERVAL')
|
||||
client.send_snac(msg)
|
||||
|
||||
# authorization requests and answers that came in while this account wasn't on ICQ
|
||||
@@ -184,23 +184,23 @@ class OSERVICEFoodgroup:
|
||||
|
||||
@Subgroup(0x0006)
|
||||
def rate_params_query(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
|
||||
self.logger.info('[Client] OSERVICE__RATE_PARAMS_QUERY')
|
||||
self.logger.debug('[Client] OSERVICE__RATE_PARAMS_QUERY')
|
||||
|
||||
oservice_version = getattr(client.ctrl, 'versions', {}).get(0x0001, 1)
|
||||
response_msg = SNACMessage(0x0001, 0x0007, 0x0000, message.request_id, build_rate_params(oservice_version))
|
||||
|
||||
self.logger.info('[Server] OSERVICE__RATE_PARAMS_REPLY')
|
||||
self.logger.debug('[Server] OSERVICE__RATE_PARAMS_REPLY')
|
||||
client.send_snac(response_msg)
|
||||
|
||||
@Subgroup(0x0008)
|
||||
def rate_params_sub_add(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
|
||||
self.logger.info('[Client] OSERVICE__RATE_PARAMS_SUB_ADD (not implemented)')
|
||||
self.logger.debug('[Client] OSERVICE__RATE_PARAMS_SUB_ADD (not implemented)')
|
||||
|
||||
# since i don't have rate limits properly implemented *yet*, i won't do anything here
|
||||
|
||||
@Subgroup(0x000E)
|
||||
def user_info_query(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
|
||||
self.logger.info('[Client] OSERVICE__USER_INFO_QUERY')
|
||||
self.logger.debug('[Client] OSERVICE__USER_INFO_QUERY')
|
||||
|
||||
date_created = context.bs.user.date_created
|
||||
date_login = context.bs.user.date_login
|
||||
@@ -210,25 +210,25 @@ class OSERVICEFoodgroup:
|
||||
date_login_unix = int(calendar.timegm(date_login.timetuple())) if date_login else 0
|
||||
session_len = int(now.timestamp()) - date_login_unix if date_login else 0
|
||||
|
||||
self.logger.info('Date created:', date_created)
|
||||
self.logger.info('Date created (UNIX time):', date_created_unix)
|
||||
self.logger.info('Date logged in:', date_login or 'Never')
|
||||
self.logger.debug('Date created:', date_created)
|
||||
self.logger.debug('Date created (UNIX time):', date_created_unix)
|
||||
self.logger.debug('Date logged in:', date_login or 'Never')
|
||||
|
||||
self.logger.info('Date logged in (UNIX time):', date_login_unix)
|
||||
self.logger.info('Current time:', int(now.timestamp()))
|
||||
self.logger.info('Session length:', session_len)
|
||||
self.logger.debug('Date logged in (UNIX time):', date_login_unix)
|
||||
self.logger.debug('Current time:', int(now.timestamp()))
|
||||
self.logger.debug('Session length:', session_len)
|
||||
|
||||
self.logger.info('Client IP:', client.get_ip())
|
||||
self.logger.debug('Client IP:', client.get_ip())
|
||||
|
||||
# OSERVICE__USERINFO: displayId, warning level, then the OSERVICE__USER_INFO_TAGS block
|
||||
response_msg = build_self_info(context.bs)
|
||||
response_msg.request_id = message.request_id
|
||||
|
||||
self.logger.info('[Server] OSERVICE__USER_INFO_UPDATE')
|
||||
self.logger.debug('[Server] OSERVICE__USER_INFO_UPDATE')
|
||||
client.send_snac(response_msg)
|
||||
|
||||
#if settings.OSCAR_MOTD_ENABLED:
|
||||
# self.logger.info('[Server] OSERVICE__MOTD')
|
||||
# self.logger.debug('[Server] OSERVICE__MOTD')
|
||||
# motd = SNACMessage(0x0001, 0x0013, 0x0000, 0x0000)
|
||||
# motd.write_u8(4)
|
||||
# motd.write_u8(0) # filler
|
||||
@@ -237,14 +237,14 @@ class OSERVICEFoodgroup:
|
||||
|
||||
@Subgroup(0x0011)
|
||||
def idle_notification(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
|
||||
self.logger.info('[Client] OSERVICE__IDLE_NOTIFICATION')
|
||||
self.logger.debug('[Client] OSERVICE__IDLE_NOTIFICATION')
|
||||
|
||||
idle_time = message.read_u32()
|
||||
if idle_time == 0:
|
||||
self.logger.info(context.bs.user.username, 'is no longer idle')
|
||||
self.logger.debug(context.bs.user.username, 'is no longer idle')
|
||||
context.bs.front_data.pop('oscar0_idle_since', None)
|
||||
else:
|
||||
self.logger.info(context.bs.user.username, 'has been idle for', str(idle_time), 'seconds')
|
||||
self.logger.debug(context.bs.user.username, 'has been idle for', str(idle_time), 'seconds')
|
||||
context.bs.front_data['oscar0_idle_since'] = time.time() - idle_time
|
||||
|
||||
# contacts need a fresh arrival so the idle time in the userinfo gets refreshed on their end
|
||||
@@ -257,16 +257,16 @@ class OSERVICEFoodgroup:
|
||||
def set_privacy_flags(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
|
||||
# u32 flags: 0x01 lets others see idle time, 0x02 the member since date; nothing here hides either yet
|
||||
flags = message.read_u32() if len(message) >= 4 else 0
|
||||
self.logger.info('[Client] OSERVICE__SET_PRIVACY_FLAGS', hex(flags))
|
||||
self.logger.debug('[Client] OSERVICE__SET_PRIVACY_FLAGS', hex(flags))
|
||||
|
||||
@Subgroup(0x0016)
|
||||
def noop(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
|
||||
# a keep-alive; there is no reply
|
||||
self.logger.info('[Client] OSERVICE__NOOP')
|
||||
self.logger.debug('[Client] OSERVICE__NOOP')
|
||||
|
||||
@Subgroup(0x001E)
|
||||
def set_user_info_fields(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
|
||||
self.logger.info('[Client] OSERVICE__SET_USERINFO_FIELDS')
|
||||
self.logger.debug('[Client] OSERVICE__SET_USERINFO_FIELDS')
|
||||
|
||||
bs = context.bs
|
||||
tlvs = unmarshal_tlvs(message.data)
|
||||
@@ -279,7 +279,7 @@ class OSERVICEFoodgroup:
|
||||
if (status_tlv := find_tlv(tlvs, 0x0006)) is not None and len(status_tlv.data) >= 4:
|
||||
status = struct.unpack('>L', status_tlv.data[:4])[0]
|
||||
bs.front_data['oscar0_icq_status'] = status
|
||||
self.logger.info('[Client] Status:', hex(status))
|
||||
self.logger.debug('[Client] Status:', hex(status))
|
||||
# before OSERVICE__CLIENT_READY this is only what the client wants to come online as
|
||||
if bs.front_data.get('oscar0_ready'):
|
||||
substatus = substatus_from_icq_status(status)
|
||||
@@ -293,16 +293,16 @@ class OSERVICEFoodgroup:
|
||||
@Subgroup(0x001F)
|
||||
def probe_request(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
|
||||
# some ICQ clients probe a connection before using it; OSERVICE__PROBE_ACK has no body
|
||||
self.logger.info('[Client] OSERVICE__PROBE_REQ')
|
||||
self.logger.debug('[Client] OSERVICE__PROBE_REQ')
|
||||
client.send_snac(SNACMessage(0x0001, 0x0020, 0x0000, message.request_id))
|
||||
|
||||
@Subgroup(0x0004)
|
||||
def service_request(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
|
||||
self.logger.info('[Client] OSERVICE__SERVICE_REQUEST')
|
||||
self.logger.debug('[Client] OSERVICE__SERVICE_REQUEST')
|
||||
|
||||
foodgroup = message.read_u16()
|
||||
tlvs = unmarshal_tlvs(message.data)
|
||||
self.logger.info('[Client] Foodgroup:', hex(foodgroup))
|
||||
self.logger.debug('[Client] Foodgroup:', hex(foodgroup))
|
||||
|
||||
if foodgroup not in REQUESTABLE_SERVICES:
|
||||
# OSERVICE__ERR, service unavailable
|
||||
|
||||
Reference in new issue
Block a user