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

+3 -3
View File
@@ -49,7 +49,7 @@ class AdminFoodgroup:
@Subgroup(0x0002)
def info_query(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] ADMIN__INFO_QUERY')
self.logger.debug('[Client] ADMIN__INFO_QUERY')
user = context.user
tlvs = unmarshal_tlvs(message.data)
@@ -65,7 +65,7 @@ class AdminFoodgroup:
@Subgroup(0x0004)
def info_change_request(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] ADMIN__INFO_CHANGE_REQUEST')
self.logger.debug('[Client] ADMIN__INFO_CHANGE_REQUEST')
user = context.user
tlvs = unmarshal_tlvs(message.data)
@@ -99,7 +99,7 @@ class AdminFoodgroup:
@Subgroup(0x0006)
def account_confirm_request(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] ADMIN__ACCT_CONFIRM_REQUEST')
self.logger.debug('[Client] ADMIN__ACCT_CONFIRM_REQUEST')
# ADMIN__ACCT_CONFIRM_REPLY: u16 status, then a TLV (empty here); confirmation mails come from the website
status = CONFIRM_ALREADY_CONFIRMED if getattr(context.user, 'account_verified', False) else CONFIRM_SERVER_ERROR
+3 -3
View File
@@ -33,7 +33,7 @@ class BARTFoodgroup:
@Subgroup(0x0002)
def upload_query(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
# BART__UPLOAD_QUERY: u16 type, u16 length, the item
self.logger.info('[Client] BART__UPLOAD_QUERY')
self.logger.debug('[Client] BART__UPLOAD_QUERY')
bart_type = message.read_u16()
data = message.read_bytes(message.read_u16())
client.ctrl.backend.loop.create_task(_upload(client, context, message.request_id, bart_type, data))
@@ -41,7 +41,7 @@ class BARTFoodgroup:
@Subgroup(0x0004)
def download_query(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
# BART__DOWNLOAD_QUERY: string08 whose, u8 command, then the BART ID
self.logger.info('[Client] BART__DOWNLOAD_QUERY')
self.logger.debug('[Client] BART__DOWNLOAD_QUERY')
name = message.read_bytes(message.read_u8()).decode('latin-1')
message.read_u8()
ids = _read_bart_ids(message.data, 1)
@@ -52,7 +52,7 @@ class BARTFoodgroup:
@Subgroup(0x0006)
def download2_query(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
# BART__DOWNLOAD2_QUERY: string08 whose, u8 count, then that many BART IDs
self.logger.info('[Client] BART__DOWNLOAD2_QUERY')
self.logger.debug('[Client] BART__DOWNLOAD2_QUERY')
name = message.read_bytes(message.read_u8()).decode('latin-1')
count = message.read_u8()
ids = _read_bart_ids(message.data, count)
+2 -2
View File
@@ -15,7 +15,7 @@ class BOSFoodgroup(PDHandlers):
@Subgroup(0x0002)
def rights_query(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] BOS__RIGHTS_QUERY')
self.logger.debug('[Client] BOS__RIGHTS_QUERY')
response_msg = SNACMessage(0x0009, 0x0003, 0x0000, message.request_id)
response_msg.write_tlvs([
@@ -24,5 +24,5 @@ class BOSFoodgroup(PDHandlers):
TLV(0x0003, struct.pack('>H', 1000)) # max temp permits user is allowed
])
self.logger.info('[Server] BOS__RIGHTS_REPLY')
self.logger.debug('[Server] BOS__RIGHTS_REPLY')
client.send_snac(response_msg)
+9 -9
View File
@@ -17,7 +17,7 @@ class BUCPFoodgroup:
@Subgroup(0x0006)
def challenge_request(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] BUCP__CHALLENGE_REQUEST')
self.logger.debug('[Client] BUCP__CHALLENGE_REQUEST')
tlvs = unmarshal_tlvs(message.data)
screen_name_tlv = find_tlv(tlvs, 0x0001)
@@ -38,12 +38,12 @@ class BUCPFoodgroup:
response_msg.write_u16(len(salt))
response_msg.write_string(salt)
self.logger.info('[Server] BUCP__CHALLENGE_RESPONSE (salt:', salt + ')')
self.logger.debug('[Server] BUCP__CHALLENGE_RESPONSE (salt:', salt + ')')
client.send_snac(response_msg)
@Subgroup(0x0002)
def login_request(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] BUCP__LOGIN_REQUEST')
self.logger.debug('[Client] BUCP__LOGIN_REQUEST')
from ..ctrl import authenticate, client_version, multi_conn_flag
@@ -57,9 +57,9 @@ class BUCPFoodgroup:
version_str = client_version(tlvs)
self.logger.info('Screen Name (client-given):', screen_name)
self.logger.info('Client version:', version_str)
self.logger.info('Password (hashed):', client_hash)
self.logger.debug('Screen Name (client-given):', screen_name)
self.logger.debug('Client version:', version_str)
self.logger.debug('Password (hashed):', client_hash)
response_msg = SNACMessage(0x0017, 0x0003, 0x0000, message.request_id)
@@ -79,11 +79,11 @@ class BUCPFoodgroup:
uuid, icq, error_code = authenticate(context.backend, screen_name, check)
if error_code in (LoginError.UnregisteredScreenname, LoginError.ICQUserError):
self.logger.info('Unregistered screenname')
self.logger.debug('Unregistered screenname')
elif error_code == LoginError.IncorrectPassword:
self.logger.info('Incorrect password')
self.logger.debug('Incorrect password')
else:
self.logger.info('Authenticated via', matched.get(uuid))
self.logger.debug('Authenticated via', matched.get(uuid))
context.client = Client('icq' if icq else 'aim', version_str, context.client.via)
client.ctrl.client = context.client
+6 -6
View File
@@ -205,7 +205,7 @@ class BuddyFoodgroup:
@Subgroup(0x0002)
def rights_query(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] BUDDY_RIGHTS_QUERY')
self.logger.debug('[Client] BUDDY_RIGHTS_QUERY')
response_msg = SNACMessage(0x0003, 0x0003, 0x0000, message.request_id)
response_msg.write_tlvs([
@@ -215,26 +215,26 @@ class BuddyFoodgroup:
TLV(0x0004, struct.pack('>H', 160)) # max temp buddies
])
self.logger.info('[Server] BUDDY_RIGHTS_REPLY')
self.logger.debug('[Server] BUDDY_RIGHTS_REPLY')
client.send_snac(response_msg)
@Subgroup(0x0004)
def add_buddies(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] BUDDY__ADD_BUDDIES')
self.logger.debug('[Client] BUDDY__ADD_BUDDIES')
add_buddies(client, context, message)
@Subgroup(0x0005)
def del_buddies(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] BUDDY__DEL_BUDDIES')
self.logger.debug('[Client] BUDDY__DEL_BUDDIES')
del_buddies(client, context, message)
@Subgroup(0x000F)
def add_temp_buddies(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
# temp buddies only ever last the session, which is all a client-side buddy is here anyway
self.logger.info('[Client] BUDDY__ADD_TEMP_BUDDIES')
self.logger.debug('[Client] BUDDY__ADD_TEMP_BUDDIES')
add_buddies(client, context, message)
@Subgroup(0x0010)
def del_temp_buddies(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] BUDDY__DEL_TEMP_BUDDIES')
self.logger.debug('[Client] BUDDY__DEL_TEMP_BUDDIES')
del_buddies(client, context, message)
+1 -1
View File
@@ -160,7 +160,7 @@ class ChatFoodgroup:
@Subgroup(0x0005)
def channel_msg_tohost(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] CHAT__CHANNEL_MSG_TOHOST')
self.logger.debug('[Client] CHAT__CHANNEL_MSG_TOHOST')
ctrl = client.ctrl
info = ctrl.room
+4 -4
View File
@@ -49,7 +49,7 @@ class ChatNavFoodgroup:
@Subgroup(0x0002)
def request_chat_rights(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] CHAT_NAV__REQUEST_CHAT_RIGHTS')
self.logger.debug('[Client] CHAT_NAV__REQUEST_CHAT_RIGHTS')
client.send_snac(nav_info(message.request_id, [
TLV(NAV_TLV_MAX_CONCURRENT_ROOMS, struct.pack('>B', MAX_CONCURRENT_ROOMS)),
TLV(NAV_TLV_EXCHANGE_INFO, exchange_info(EXCHANGE_PRIVATE)),
@@ -58,7 +58,7 @@ class ChatNavFoodgroup:
@Subgroup(0x0003)
def request_exchange_info(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] CHAT_NAV__REQUEST_EXCHANGE_INFO')
self.logger.debug('[Client] CHAT_NAV__REQUEST_EXCHANGE_INFO')
exchange = message.read_u16()
if exchange not in (EXCHANGE_PRIVATE, EXCHANGE_PUBLIC):
client.ctrl.send_snac_error(0x000D, message.request_id, NAV_ERROR_NOT_SUPPORTED)
@@ -71,7 +71,7 @@ class ChatNavFoodgroup:
@Subgroup(0x0004)
def request_room_info(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
# u16 exchange, string08 cookie, u16 instance, u8 detail level
self.logger.info('[Client] CHAT_NAV__REQUEST_ROOM_INFO')
self.logger.debug('[Client] CHAT_NAV__REQUEST_ROOM_INFO')
info = parse_room_info(message.data)
room = find_room(info['cookie']) if info is not None else None
if room is None or room.exchange != info['exchange']:
@@ -82,7 +82,7 @@ class ChatNavFoodgroup:
@Subgroup(0x0008)
def create_room(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
# a CHAT__ROOM_INFO_UPDATE layout: u16 exchange, string08 cookie ("create"), u16 instance, u8 detail, TLV block
self.logger.info('[Client] CHAT_NAV__CREATE_ROOM')
self.logger.debug('[Client] CHAT_NAV__CREATE_ROOM')
buf = Buffer(message.data)
try:
exchange = buf.read_u16()
+5 -5
View File
@@ -27,7 +27,7 @@ class DirectoryFoodgroup:
@Subgroup(0x0002)
def info_query(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] DIRECTORY__INFO_QUERY')
self.logger.debug('[Client] DIRECTORY__INFO_QUERY')
# the search kind follows from the TLVs:
# an e-mail address, an interest keyword, or a first or last name
@@ -52,7 +52,7 @@ class DirectoryFoodgroup:
# ODIR__INFO_REPLY: u16 status, u16 unknown, and with this status nothing else
reply.write_u16(SEARCH_NAME_MISSING)
reply.write_u16(0)
self.logger.info('[Server] DIRECTORY__INFO_REPLY')
self.logger.debug('[Server] DIRECTORY__INFO_REPLY')
client.send_snac(reply)
return
@@ -78,17 +78,17 @@ class DirectoryFoodgroup:
reply.write_u16(len(results))
for result in results:
reply.write_tlv_block(result)
self.logger.info('[Server] DIRECTORY__INFO_REPLY')
self.logger.debug('[Server] DIRECTORY__INFO_REPLY')
client.send_snac(reply)
@Subgroup(0x0004)
def interests_query(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] DIRECTORY__INTERESTS_QUERY')
self.logger.debug('[Client] DIRECTORY__INTERESTS_QUERY')
# we don't yet have an interests directory, so the count stays zero.
response_msg = SNACMessage(0x000F, 0x0005, 0x0000, message.request_id)
response_msg.write_u16(1)
response_msg.write_u16(0)
self.logger.info('[Server] DIRECTORY__INTERESTS_LIST')
self.logger.debug('[Server] DIRECTORY__INTERESTS_LIST')
client.send_snac(response_msg)
+3 -3
View File
@@ -8,12 +8,12 @@ class EmailFoodgroup:
@Subgroup(0x0006)
def status_request(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] EMAIL__STATUS_REQUEST')
self.logger.debug('[Client] EMAIL__STATUS_REQUEST')
# unread count. no mail yet, so it stays zero
# 0x06 is ALERT__NOTIFY_CAPABILITIES, which takes no reply; answering it with an
# ALERT__NOTIFY nobody asked for is what used to go back here
self.logger.info('[Client] Alert capabilities:', message.data.hex())
self.logger.debug('[Client] Alert capabilities:', message.data.hex())
@Subgroup(0x0016)
def activate(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] EMAIL__ACTIVATE (no reply expected)')
self.logger.debug('[Client] EMAIL__ACTIVATE (no reply expected)')
+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:
+26 -26
View File
@@ -84,12 +84,12 @@ class ICBMFoodgroup:
@Subgroup(0x0002)
def add_paramenters(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] ICBM__ADD_PARAMENTERS (not implemented)')
self.logger.info('[Client]', message.data.hex())
self.logger.debug('[Client] ICBM__ADD_PARAMENTERS (not implemented)')
self.logger.debug('[Client]', message.data.hex())
@Subgroup(0x0004)
def parameter_query(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] ICBM__PARAMENTER_QUERY')
self.logger.debug('[Client] ICBM__PARAMENTER_QUERY')
response_msg = SNACMessage(0x0004, 0x0005, 0x0000, message.request_id)
@@ -109,7 +109,7 @@ class ICBMFoodgroup:
response_msg.write_u16(999) # maxDestinationEvil
response_msg.write_u32(0) # minInterICBMInterval
self.logger.info('[Server] ICBM__PARAMENTER_REPLY')
self.logger.debug('[Server] ICBM__PARAMENTER_REPLY')
client.send_snac(response_msg)
@Subgroup(0x0006)
@@ -119,19 +119,19 @@ class ICBMFoodgroup:
receiver = message.read_bytes(message.read_u8()).decode('latin-1')
tlvs = unmarshal_tlvs(message.data)
self.logger.info('[Client] ICBM__CHANNEL_MSG_TOHOST')
self.logger.info('[Client] Cookie:', cookie)
self.logger.info('[Client] Channel:', hex(channel))
self.logger.info('[Client] Message receiver:', receiver)
self.logger.debug('[Client] ICBM__CHANNEL_MSG_TOHOST')
self.logger.debug('[Client] Cookie:', cookie)
self.logger.debug('[Client] Channel:', hex(channel))
self.logger.debug('[Client] Message receiver:', receiver)
for tlv in tlvs:
self.logger.info('[Client] TLV', hex(tlv.type), '-', tlv.data)
self.logger.debug('[Client] TLV', hex(tlv.type), '-', tlv.data)
send = _Send(client, context, message, cookie, channel, receiver, tlvs)
target = names.resolve_user(context.backend, receiver)
if target is None or not names.representable(target):
self.logger.info('[Client] Unknown receiver:', receiver)
self.logger.debug('[Client] Unknown receiver:', receiver)
send.error(ICBMError.NotLoggedOn)
return
names.remember(context.bs, target, receiver)
@@ -148,13 +148,13 @@ class ICBMFoodgroup:
if channel == ICBMChannel.AOLIM:
im_data_tlv = find_tlv(tlvs, ICBMTag.ImData)
if im_data_tlv is None:
self.logger.info('[Client] Missing IM data TLV')
self.logger.debug('[Client] Missing IM data TLV')
return
text = parse_im_text(im_data_tlv.data)
if text is None:
self.logger.info('[Client] Missing IM text TLV inside IM data')
self.logger.debug('[Client] Missing IM text TLV inside IM data')
return
self.logger.info('[Client] Message text:', text)
self.logger.debug('[Client] Message text:', text)
if names.is_icq_session(context.bs) and not looks_like_html(text):
# ICQ sends plain text, where AIM sends HTML
send.text(text, plain_to_html(text))
@@ -166,16 +166,16 @@ class ICBMFoodgroup:
data_tlv = find_tlv(tlvs, ICBMTag.Data)
parsed = parse_icq_message(data_tlv.data) if data_tlv is not None else None
if parsed is None:
self.logger.info('[Client] Malformed channel 4 message')
self.logger.debug('[Client] Malformed channel 4 message')
return
send.icq(*parsed)
else:
self.logger.info('[Client] Unsupported channel:', hex(channel))
self.logger.debug('[Client] Unsupported channel:', hex(channel))
send.error(ICBMError.NotSupportedByHost)
@Subgroup(0x0008)
def evil_request(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] ICBM__EVIL_REQUEST')
self.logger.debug('[Client] ICBM__EVIL_REQUEST')
# u16 send as (0: as yourself, 1: anonymously), string08 who
send_as = message.read_u16()
@@ -211,7 +211,7 @@ class ICBMFoodgroup:
reply = SNACMessage(0x0004, 0x0009, 0x0000, message.request_id)
reply.write_u16(delta)
reply.write_u16(new_level)
self.logger.info('[Server] ICBM__EVIL_REPLY')
self.logger.debug('[Server] ICBM__EVIL_REPLY')
client.send_snac(reply)
@Subgroup(0x000B)
@@ -222,7 +222,7 @@ class ICBMFoodgroup:
channel = message.read_u16()
name = message.read_bytes(message.read_u8()).decode('latin-1')
rest = message.data
self.logger.info('[Client] ICBM__CLIENT_ERR to', name)
self.logger.debug('[Client] ICBM__CLIENT_ERR to', name)
target = names.resolve_user(context.backend, name)
if target is None or _blocks(context.backend, target, context.user):
@@ -239,7 +239,7 @@ class ICBMFoodgroup:
@Subgroup(0x0010)
def offline_retrieve(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] ICBM__OFFLINE_RETRIEVE')
self.logger.debug('[Client] ICBM__OFFLINE_RETRIEVE')
# ICBM__OFFLINE_RETRIEVE_REPLY ends the batch; it has no body
deliver_stored_messages(client.ctrl, then = lambda: client.send_snac(SNACMessage(0x0004, 0x0017, 0x0000, message.request_id)))
@@ -250,16 +250,16 @@ class ICBMFoodgroup:
receiver = message.read_bytes(message.read_u8()).decode('latin-1')
event = message.read_u16()
self.logger.info('[Client] ICBM__CLIENT_EVENT')
self.logger.info('[Client] Receiver:', receiver, '| Event:', hex(event))
self.logger.debug('[Client] ICBM__CLIENT_EVENT')
self.logger.debug('[Client] Receiver:', receiver, '| Event:', hex(event))
if channel != ICBMChannel.AOLIM:
self.logger.info('[Client] Unsupported channel:', hex(channel))
self.logger.debug('[Client] Unsupported channel:', hex(channel))
return
receiver_user = names.resolve_user(context.backend, receiver)
if receiver_user is None:
self.logger.info('[Client] Unknown receiver:', receiver)
self.logger.debug('[Client] Unknown receiver:', receiver)
return
receiver_uuid = receiver_user.uuid
@@ -269,7 +269,7 @@ class ICBMFoodgroup:
elif event in (ICBMEvent.Finished, ICBMEvent.Typed, ICBMEvent.Closed):
msg_type = MessageType.TypingDone
else:
self.logger.info('[Client] Unknown event type:', hex(event))
self.logger.debug('[Client] Unknown event type:', hex(event))
return
# a typing notification only goes to a conversation that's already there
@@ -317,7 +317,7 @@ class _Send:
receiver = self.receiver.encode('latin-1', errors = 'replace')
ack.write_u8(len(receiver))
ack.write_bytes(receiver)
self.client.ctrl.logger.info('[Server] ICBM__HOST_ACK')
self.client.ctrl.logger.debug('[Server] ICBM__HOST_ACK')
self.client.send_snac(ack)
def text(self, plain: str, html: str, *, icq: Optional[Tuple[int, int, str]] = None) -> None:
@@ -347,7 +347,7 @@ class _Send:
self.error(ICBMError.NotLoggedOn)
return
except Exception as ex:
ctrl.logger.info('[Client] Could not create private chat:', str(ex))
ctrl.logger.debug('[Client] Could not create private chat:', str(ex))
self.error(ICBMError.NotLoggedOn)
return
+8 -8
View File
@@ -243,7 +243,7 @@ class ICQFoodgroup:
tlvs = unmarshal_tlvs(message.data)
envelope_tlv = find_tlv(tlvs, 0x0001)
if envelope_tlv is None or len(envelope_tlv.data) < 2:
self.logger.info('[Client] ICQ__DB_QUERY without its envelope')
self.logger.debug('[Client] ICQ__DB_QUERY without its envelope')
return
# TLV 0x01: u16 (LE) length, u32 UIN, u16 request type, u16 sequence, [u16 meta subtype], request data
@@ -255,32 +255,32 @@ class ICQFoodgroup:
request_type = reader.u16()
seq = reader.u16()
except ValueError:
self.logger.info('[Client] Truncated ICQ__DB_QUERY')
self.logger.debug('[Client] Truncated ICQ__DB_QUERY')
return
query = ICQContext(client, context, message.request_id, seq)
if request_type == ICQRequest.OfflineMessages:
self.logger.info('[Client] ICQ__DB_QUERY offline messages')
self.logger.debug('[Client] ICQ__DB_QUERY offline messages')
offline_messages(query)
elif request_type == ICQRequest.DeleteOfflineMessages:
self.logger.info('[Client] ICQ__DB_QUERY delete offline messages')
self.logger.debug('[Client] ICQ__DB_QUERY delete offline messages')
delete_offline_messages(query)
elif request_type == ICQRequest.Meta:
try:
subtype = reader.u16()
except ValueError:
return
self.logger.info('[Client] ICQ__DB_QUERY meta', hex(subtype))
self.logger.debug('[Client] ICQ__DB_QUERY meta', hex(subtype))
handler = META_HANDLERS.get(subtype)
if handler is None:
self.logger.info('[Client] Unsupported ICQ meta request', hex(subtype))
self.logger.debug('[Client] Unsupported ICQ meta request', hex(subtype))
return
try:
handler(query, reader)
except ValueError:
self.logger.info('[Client] Malformed ICQ meta request', hex(subtype))
self.logger.debug('[Client] Malformed ICQ meta request', hex(subtype))
else:
self.logger.info('[Client] Unknown ICQ__DB_QUERY request type', hex(request_type))
self.logger.debug('[Client] Unknown ICQ__DB_QUERY request type', hex(request_type))
# offline messages
+1 -1
View File
@@ -10,4 +10,4 @@ class InviteFoodgroup:
@Subgroup(0x0002)
def request_query(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
# "invite a friend to AIM" (an e-mail address and a message); nothing is sent out
self.logger.info('[Client] INVITE__REQUEST_QUERY (not sent)')
self.logger.debug('[Client] INVITE__REQUEST_QUERY (not sent)')
+12 -12
View File
@@ -118,7 +118,7 @@ class LocateFoodgroup:
@Subgroup(0x0002)
def client_versions(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] LOCATE__RIGHTS_QUERY')
self.logger.debug('[Client] LOCATE__RIGHTS_QUERY')
response_msg = SNACMessage(0x0002, 0x0003, 0x0000, message.request_id)
@@ -145,12 +145,12 @@ class LocateFoodgroup:
TLV(0x0005, struct.pack('>H', 0x0080)) # unknown
])
self.logger.info('[Server] LOCATE__RIGHTS_REPLY')
self.logger.debug('[Server] LOCATE__RIGHTS_REPLY')
client.send_snac(response_msg)
@Subgroup(0x0004)
def set_info(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] LOCATE__SET_INFO')
self.logger.debug('[Client] LOCATE__SET_INFO')
bs = context.bs
tlvs = unmarshal_tlvs(message.data)
@@ -200,7 +200,7 @@ class LocateFoodgroup:
# u16 type (LOCATE_TYPE_*), string08 who
query_type = message.read_u16()
name = message.read_bytes(message.read_u8()).decode('latin-1')
self.logger.info('[Client] LOCATE__USER_INFO_QUERY for', name, '(type', hex(query_type) + ')')
self.logger.debug('[Client] LOCATE__USER_INFO_QUERY for', name, '(type', hex(query_type) + ')')
user_info_reply(client, context, message, query_type, name)
@Subgroup(0x0015)
@@ -208,12 +208,12 @@ class LocateFoodgroup:
# the same query with a u32 type
query_type = message.read_u32()
name = message.read_bytes(message.read_u8()).decode('latin-1')
self.logger.info('[Client] LOCATE__USER_INFO_QUERY2 for', name, '(type', hex(query_type) + ')')
self.logger.debug('[Client] LOCATE__USER_INFO_QUERY2 for', name, '(type', hex(query_type) + ')')
user_info_reply(client, context, message, query_type & 0xFFFF, name)
@Subgroup(0x0009)
def set_dir_info(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] LOCATE__SET_DIR_INFO')
self.logger.debug('[Client] LOCATE__SET_DIR_INFO')
# a TLV per ODIR field; whatever is sent replaces what was there
store = dir_info(context.user)
@@ -225,15 +225,15 @@ class LocateFoodgroup:
# LOCATE__SET_DIR_REPLY: u16 result, 1 for success
reply = SNACMessage(0x0002, 0x000A, 0x0000, message.request_id)
reply.write_u16(0x0001)
self.logger.info('[Server] LOCATE__SET_DIR_REPLY')
self.logger.debug('[Server] LOCATE__SET_DIR_REPLY')
client.send_snac(reply)
@Subgroup(0x000B)
def get_dir_info(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] LOCATE__GET_DIR_INFO')
self.logger.debug('[Client] LOCATE__GET_DIR_INFO')
screen_name = message.read_bytes(message.read_u8()).decode('latin-1')
self.logger.info('[Client] Getting info for:', screen_name)
self.logger.debug('[Client] Getting info for:', screen_name)
# Response from NINA's servers:
# ==
@@ -253,12 +253,12 @@ class LocateFoodgroup:
tlvs = dir_tlvs(target) + tlvs
response_msg.write_tlv_block(tlvs)
self.logger.info('[Server] LOCATE__GET_DIR_REPLY')
self.logger.debug('[Server] LOCATE__GET_DIR_REPLY')
client.send_snac(response_msg)
@Subgroup(0x000F)
def set_keyword_info(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] LOCATE__SET_KEYWORD_INFO')
self.logger.debug('[Client] LOCATE__SET_KEYWORD_INFO')
# up to five interests, TLV 0x0B each
interests = [tlv.data.decode('latin-1') for tlv in unmarshal_tlvs(message.data) if tlv.type == DIR_INTEREST]
@@ -268,5 +268,5 @@ class LocateFoodgroup:
# LOCATE__SET_KEYWORD_REPLY: u16, 1
reply = SNACMessage(0x0002, 0x0010, 0x0000, message.request_id)
reply.write_u16(0x0001)
self.logger.info('[Server] LOCATE__SET_KEYWORD_REPLY')
self.logger.debug('[Server] LOCATE__SET_KEYWORD_REPLY')
client.send_snac(reply)
+28 -28
View File
@@ -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
+8 -8
View File
@@ -185,11 +185,11 @@ class PDHandlers:
@Subgroup(0x0004)
def set_group_permit_mask(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] PD__SET_GROUP_PERMIT_MASK')
self.logger.debug('[Client] PD__SET_GROUP_PERMIT_MASK')
# xx xx xx xx dword group permission mask
mask = message.read_u32()
self.logger.info('[Client] Mask:', hex(mask))
self.logger.debug('[Client] Mask:', hex(mask))
before = context.bs.me_visibility_snapshot()
set_pd_mask(context, mask)
@@ -198,27 +198,27 @@ class PDHandlers:
@Subgroup(0x0005)
def add_perm_list_entries(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] PD__ADD_PERM_LIST_ENTRIES')
self.logger.debug('[Client] PD__ADD_PERM_LIST_ENTRIES')
_apply_entries(context, message, permit = True, add = True)
@Subgroup(0x0006)
def del_perm_list_entries(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] PD__DEL_PERM_LIST_ENTRIES')
self.logger.debug('[Client] PD__DEL_PERM_LIST_ENTRIES')
_apply_entries(context, message, permit = True, add = False)
@Subgroup(0x0007)
def add_deny_list_entries(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] PD__ADD_DENY_LIST_ENTRIES')
self.logger.debug('[Client] PD__ADD_DENY_LIST_ENTRIES')
_apply_entries(context, message, permit = False, add = True)
@Subgroup(0x0008)
def del_deny_list_entries(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] PD__DEL_DENY_LIST_ENTRIES')
self.logger.debug('[Client] PD__DEL_DENY_LIST_ENTRIES')
_apply_entries(context, message, permit = False, add = False)
@Subgroup(0x000A)
def add_temp_permit_list_entries(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] PD__ADD_TEMP_PERMIT_LIST_ENTRIES')
self.logger.debug('[Client] PD__ADD_TEMP_PERMIT_LIST_ENTRIES')
# temp permits only live as long as the session, so they stay out of the persisted lists
temp_permits = context.bs.front_data.setdefault('oscar0_temp_permits', set())
@@ -229,7 +229,7 @@ class PDHandlers:
@Subgroup(0x000B)
def del_temp_permit_list_entries(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] PD__DEL_TEMP_PERMIT_LIST_ENTRIES')
self.logger.debug('[Client] PD__DEL_TEMP_PERMIT_LIST_ENTRIES')
temp_permits = context.bs.front_data.setdefault('oscar0_temp_permits', set())
for name in _read_entries(message):
-3
View File
@@ -11,7 +11,4 @@ def popup_display(self, alert_url: Optional[str], alert_txt: str):
response_msg = SNACMessage(0x0008, 0x0002, 0x0000, 0x00000000)
response_msg.write_bytes(system_message(alert_url, alert_txt))
# TODO: pipe to ctrl.send_snac()
print('TLVs:', unmarshal_tlvs(response_msg.data))
#client.send_snac(response_msg)
return response_msg
+2 -2
View File
@@ -9,9 +9,9 @@ class StatsFoodgroup:
@Subgroup(0x0003)
def report_events(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] STATS__REPORT_EVENTS')
self.logger.debug('[Client] STATS__REPORT_EVENTS')
# we don't really care for the info in the SNAC message's body for now, so just send
# a STATS__REPORT_ACK
self.logger.info('[Server] STATS__REPORT_ACK')
self.logger.debug('[Server] STATS__REPORT_ACK')
client.send_snac(SNACMessage(0x000B, 0x0004))
+3 -3
View File
@@ -16,7 +16,7 @@ class UserLookupFoodgroup:
@Subgroup(0x0002)
def find_by_email(self, client: OSCARClient, context: OSCARContext, message: SNACMessage) -> None:
self.logger.info('[Client] USER_LOOKUP__FIND_BY_EMAIL')
self.logger.debug('[Client] USER_LOOKUP__FIND_BY_EMAIL')
# the SNAC body is the address itself; only people listed in the member directory can be found by it
email = message.data.decode('latin-1').strip('\x00').strip()
@@ -29,11 +29,11 @@ class UserLookupFoodgroup:
if not users:
msg = SNACMessage(0x000A, 0x0001, 0x0000, message.request_id)
msg.write_u16(LOOKUP_ERROR_NO_MATCH)
self.logger.info('[Server] USER_LOOKUP__ERR')
self.logger.debug('[Server] USER_LOOKUP__ERR')
client.send_snac(msg)
return
reply = SNACMessage(0x000A, 0x0003, 0x0000, message.request_id)
reply.write_tlvs([TLV(LOOKUP_TLV_SCREEN_NAME, names.name_for(context.bs, user)) for user in users])
self.logger.info('[Server] USER_LOOKUP__FIND_REPLY')
self.logger.debug('[Server] USER_LOOKUP__FIND_REPLY')
client.send_snac(reply)