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:
Athena Funderburg committed 2026-11-06 00:36:13 +00:00
1 parent 4bf878556b
commit 6451bb9426
46 files changed
+307 -541

No files matched your search

+36 -36
View File
@@ -581,7 +581,7 @@ def _insert_group(logger: Logger, context: OSCARContext, item: FeedbagItem) -> F
return FeedbagStatus.BadRequest
bs.front_data.setdefault("oscar0_group_id_map", {})[item.group_id] = group.id
logger.info("[Client] Added group:", item.name)
logger.debug("[Client] Added group:", item.name)
attrs = [tlv for tlv in item.attributes if tlv.type != FeedbagAttributes.Order]
if attrs:
@@ -607,7 +607,7 @@ def _insert_buddy(logger: Logger, context: OSCARContext, item: FeedbagItem) -> F
return FeedbagStatus.BadLoginID
contact_user = names.resolve_user(context.backend, item.name)
if contact_user is None or contact_user is context.user:
logger.info("[Client] Unknown buddy:", item.name)
logger.debug("[Client] Unknown buddy:", item.name)
return FeedbagStatus.BadLoginID
contact_uuid = contact_user.uuid
key = contact_user.username.lower()
@@ -663,14 +663,14 @@ def _insert_buddy(logger: Logger, context: OSCARContext, item: FeedbagItem) -> F
# whatever this client called the buddy (a UIN, a differently spaced screen name) is what it'll hear about them as
names.remember(bs, contact_user, item.name)
names.store_alias(bs, contact_user, item.name)
logger.info("[Client] Added buddy:", item.name)
logger.debug("[Client] Added buddy:", item.name)
return FeedbagStatus.Success
def _insert_list_entry(logger: Logger, context: OSCARContext, item: FeedbagItem) -> FeedbagStatus:
is_permit = (item.class_id == FeedbagClass.Permit)
status = FeedbagStatus(int(pd_add(context, item.name, permit = is_permit)))
if status == FeedbagStatus.Success:
logger.info("[Client] Added {} entry:".format('permit' if is_permit else 'deny'), item.name)
logger.debug("[Client] Added {} entry:".format('permit' if is_permit else 'deny'), item.name)
return status
def _insert_generic(logger: Logger, context: OSCARContext, item: FeedbagItem) -> FeedbagStatus:
@@ -695,7 +695,7 @@ def _insert_generic(logger: Logger, context: OSCARContext, item: FeedbagItem) ->
if item.class_id == FeedbagClass.PdInfo:
_apply_pd_mode(context, attrs)
logger.info("[Client] Stored item of class", hex(item.class_id))
logger.debug("[Client] Stored item of class", hex(item.class_id))
return FeedbagStatus.Success
@@ -725,7 +725,7 @@ def _update_group(logger: Logger, context: OSCARContext, item: FeedbagItem) -> F
except Exception:
return FeedbagStatus.BadRequest
_rename_group_keys(store, old_key, item.name.lower())
logger.info("[Client] Renamed group to:", item.name)
logger.debug("[Client] Renamed group to:", item.name)
attrs = [tlv for tlv in item.attributes if tlv.type != FeedbagAttributes.Order]
gattrs = store.setdefault('gattrs', {})
@@ -771,7 +771,7 @@ def _update_buddy(logger: Logger, context: OSCARContext, item: FeedbagItem) -> F
battrs[key] = _attrs_to_json(list(item.attributes))
else:
battrs.pop(key, None)
logger.info("[Client] Updated buddy:", item.name)
logger.debug("[Client] Updated buddy:", item.name)
return FeedbagStatus.Success
def _update_list_entry(logger: Logger, context: OSCARContext, item: FeedbagItem) -> FeedbagStatus:
@@ -833,7 +833,7 @@ def _delete_group(logger: Logger, context: OSCARContext, item: FeedbagItem) -> F
for k in [k for k, v in mapping.items() if v == group.id]:
del mapping[k]
_drop_group_keys(store, group.name.lower())
logger.info("[Client] Removed group:", item.name)
logger.debug("[Client] Removed group:", item.name)
return FeedbagStatus.Success
def _delete_buddy(logger: Logger, context: OSCARContext, item: FeedbagItem) -> FeedbagStatus:
@@ -872,14 +872,14 @@ def _delete_buddy(logger: Logger, context: OSCARContext, item: FeedbagItem) -> F
except Exception:
return FeedbagStatus.BadRequest
logger.info("[Client] Removed buddy:", item.name)
logger.debug("[Client] Removed buddy:", item.name)
return FeedbagStatus.Success
def _delete_list_entry(logger: Logger, context: OSCARContext, item: FeedbagItem) -> FeedbagStatus:
is_permit = (item.class_id == FeedbagClass.Permit)
status = FeedbagStatus(int(pd_remove(context, item.name, permit = is_permit)))
if status == FeedbagStatus.Success:
logger.info("[Client] Removed {} entry:".format('permit' if is_permit else 'deny'), item.name)
logger.debug("[Client] Removed {} entry:".format('permit' if is_permit else 'deny'), item.name)
return status
def _delete_generic(logger: Logger, context: OSCARContext, item: FeedbagItem) -> FeedbagStatus:
@@ -897,7 +897,7 @@ class FeedbagFoodgroup:
@Subgroup(0x0002)
def rights_query(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info("[Client] FEEDBAG__RIGHTS_QUERY")
self.logger.debug("[Client] FEEDBAG__RIGHTS_QUERY")
response_msg = SNACMessage(0x0013, 0x0003)
@@ -948,28 +948,28 @@ class FeedbagFoodgroup:
TLV(0x000E, struct.pack(">H", 32)) # max smart groups
])
self.logger.info("[Server] FEEDBAG__RIGHTS_REPLY")
self.logger.debug("[Server] FEEDBAG__RIGHTS_REPLY")
client.send_snac(response_msg)
@Subgroup(0x0004)
def query(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info("[Client] FEEDBAG__QUERY")
self.logger.debug("[Client] FEEDBAG__QUERY")
try:
items = get_items(context)
last_update = _sync_modified(context, items)
except Exception as ex:
self.logger.error(ex)
self.logger.info("[Server] FEEDBAG__ERR")
self.logger.debug("[Server] FEEDBAG__ERR")
send_feedbag_error(client, message.request_id, FeedbagError.BuddyListUnavailable)
return
self.logger.info("[Server] FEEDBAG__REPLY")
self.logger.debug("[Server] FEEDBAG__REPLY")
_send_feedbag_reply(client, message.request_id, items, last_update)
@Subgroup(0x0005)
def query_if_modified(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info("[Client] FEEDBAG__QUERY_IF_MODIFIED")
self.logger.debug("[Client] FEEDBAG__QUERY_IF_MODIFIED")
# 66 51 29 47 00 0D
#
@@ -978,15 +978,15 @@ class FeedbagFoodgroup:
cached_feedbag_timestamp = message.read_u32()
cached_feedbag_num_items = message.read_u16()
self.logger.info("[Client] Cached feedbag timestamp:", cached_feedbag_timestamp)
self.logger.info("[Client] Cached feedbag items num:", cached_feedbag_num_items)
self.logger.debug("[Client] Cached feedbag timestamp:", cached_feedbag_timestamp)
self.logger.debug("[Client] Cached feedbag items num:", cached_feedbag_num_items)
try:
current_items = get_items(context)
last_update = _sync_modified(context, current_items)
except Exception as ex:
self.logger.error(ex)
self.logger.info("[Server] FEEDBAG__ERR")
self.logger.debug("[Server] FEEDBAG__ERR")
send_feedbag_error(client, message.request_id, FeedbagError.BuddyListUnavailable)
return
@@ -996,15 +996,15 @@ class FeedbagFoodgroup:
response_msg.write_u32(last_update)
response_msg.write_u16(len(current_items))
self.logger.info("[Server] FEEDBAG__REPLY_NOT_MODIFIED")
self.logger.debug("[Server] FEEDBAG__REPLY_NOT_MODIFIED")
client.send_snac(response_msg)
else:
self.logger.info("[Server] FEEDBAG__REPLY")
self.logger.debug("[Server] FEEDBAG__REPLY")
_send_feedbag_reply(client, message.request_id, current_items, last_update)
@Subgroup(0x0007)
def use(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info("[Client] FEEDBAG__USE")
self.logger.debug("[Client] FEEDBAG__USE")
bs = context.bs
# from here on the stored buddy list is the one this client runs on
@@ -1023,15 +1023,15 @@ class FeedbagFoodgroup:
# stubs because I cba to implement more of feedbag rn
@Subgroup(0x0011)
def start_cluster(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info("[Client] FEEDBAG__START_CLUSTER (not implemented)")
self.logger.debug("[Client] FEEDBAG__START_CLUSTER (not implemented)")
@Subgroup(0x0012)
def end_cluster(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info("[Client] FEEDBAG__END_CLUSTER (not implemented)")
self.logger.debug("[Client] FEEDBAG__END_CLUSTER (not implemented)")
@Subgroup(0x0008)
def insert_item(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info("[Client] FEEDBAG__INSERT_ITEM")
self.logger.debug("[Client] FEEDBAG__INSERT_ITEM")
bs = context.bs
before = bs.me_visibility_snapshot()
@@ -1061,7 +1061,7 @@ class FeedbagFoodgroup:
context.backend._mark_modified(context.user)
bs.me_visibility_changed(before)
self.logger.info("[Server] FEEDBAG__STATUS")
self.logger.debug("[Server] FEEDBAG__STATUS")
_send_feedbag_status(client, message.request_id, statuses)
# the buddy has to be in the client's list before its arrival means anything, so this goes after the STATUS
@@ -1072,7 +1072,7 @@ class FeedbagFoodgroup:
@Subgroup(0x0009)
def update_item(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info("[Client] FEEDBAG__UPDATE_ITEM")
self.logger.debug("[Client] FEEDBAG__UPDATE_ITEM")
bs = context.bs
before = bs.me_visibility_snapshot()
@@ -1099,7 +1099,7 @@ class FeedbagFoodgroup:
context.backend._mark_modified(context.user)
bs.me_visibility_changed(before)
self.logger.info("[Server] FEEDBAG__STATUS")
self.logger.debug("[Server] FEEDBAG__STATUS")
_send_feedbag_status(client, message.request_id, statuses)
for item in bart_items:
@@ -1107,7 +1107,7 @@ class FeedbagFoodgroup:
@Subgroup(0x000A)
def delete_item(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info("[Client] FEEDBAG__DELETE_ITEM")
self.logger.debug("[Client] FEEDBAG__DELETE_ITEM")
bs = context.bs
before = bs.me_visibility_snapshot()
@@ -1134,13 +1134,13 @@ class FeedbagFoodgroup:
context.backend._mark_modified(context.user)
bs.me_visibility_changed(before)
self.logger.info("[Server] FEEDBAG__STATUS")
self.logger.debug("[Server] FEEDBAG__STATUS")
_send_feedbag_status(client, message.request_id, statuses)
@Subgroup(0x0014)
def pre_authorize_buddy(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
# FEEDBAG__PRE_AUTHORIZE_BUDDY: string08 who, string16 message, u16 flags; they may add us without asking
self.logger.info("[Client] FEEDBAG__PRE_AUTHORIZE_BUDDY")
self.logger.debug("[Client] FEEDBAG__PRE_AUTHORIZE_BUDDY")
name = message.read_bytes(message.read_u8()).decode('latin-1')
text = _read_string16(message)
target = names.resolve_user(context.backend, name)
@@ -1154,7 +1154,7 @@ class FeedbagFoodgroup:
@Subgroup(0x0018)
def request_authorize_to_host(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
# FEEDBAG__REQUEST_AUTHORIZE_TO_HOST: string08 who, string16 reason, u16 unknown
self.logger.info("[Client] FEEDBAG__REQUEST_AUTHORIZE_TO_HOST")
self.logger.debug("[Client] FEEDBAG__REQUEST_AUTHORIZE_TO_HOST")
name = message.read_bytes(message.read_u8()).decode('latin-1')
reason = _read_string16(message)
target = names.resolve_user(context.backend, name)
@@ -1166,7 +1166,7 @@ class FeedbagFoodgroup:
@Subgroup(0x001A)
def respond_authorize_to_host(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
# FEEDBAG__RESPOND_AUTHORIZE_TO_HOST: string08 who, u8 accepted, string16 reason
self.logger.info("[Client] FEEDBAG__RESPOND_AUTHORIZE_TO_HOST")
self.logger.debug("[Client] FEEDBAG__RESPOND_AUTHORIZE_TO_HOST")
name = message.read_bytes(message.read_u8()).decode('latin-1')
accepted = message.read_u8() if len(message) > 0 else 0
reason = _read_string16(message)
@@ -1180,7 +1180,7 @@ class FeedbagFoodgroup:
@Subgroup(0x0016)
def remove_me(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info("[Client] FEEDBAG__REMOVE_ME")
self.logger.debug("[Client] FEEDBAG__REMOVE_ME")
# xx byte length of the uin string
# xx .. string remote client uin string
@@ -1213,9 +1213,9 @@ class FeedbagFoodgroup:
try:
context.bs._remove_from_list(owner, head, lst, None)
except Exception:
self.logger.info("[Server] FEEDBAG__REMOVE_ME could not clear", lst.name, "between", owner.username, "and", head.username)
self.logger.debug("[Server] FEEDBAG__REMOVE_ME could not clear", lst.name, "between", owner.username, "and", head.username)
self.logger.info(context.user.username, "removed themselves from", target_user.username + "'s Buddy List")
self.logger.debug(context.user.username, "removed themselves from", target_user.username + "'s Buddy List")
def _read_string16(message: SNACMessage) -> str:
if len(message) < 2: