diff --git a/core/backend.py b/core/backend.py
index f1993db..d43426c 100644
--- a/core/backend.py
+++ b/core/backend.py
@@ -1169,7 +1169,7 @@ class BackendSession(Session):
ctc = self._add_to_list(user, ctc_head, lst, name, group_id, nickname = nickname)
if lst & ContactList.FL:
# FL needs a matching RL on the contact
- ctc_me = self._add_to_list(ctc_head, user, ContactList.RL, user.email, None) # type: Optional[Contact]
+ ctc_me = self._add_to_list(ctc_head, user, ContactList.RL, backend.util_get_display_email(user), None) # type: Optional[Contact]
# `ctc_head` was added to `user`'s RL
for sess_added in backend._sc.get_sessions_by_user(ctc_head):
#if sess_added is self: continue
@@ -1267,9 +1267,15 @@ class BackendSession(Session):
contacts = detail.contacts
updated = False
+ display_email = self.backend.util_get_display_email(ctc_head)
+ if name is not None and isinstance(name, str) and (
+ name.lower() in (ctc_head.email.lower(), display_email.lower())
+ or (name.lower().endswith('@crosstalk.im') and self.backend.util_get_uuid_from_email(name) == ctc_head.uuid)
+ ):
+ name = display_email
if ctc_head.uuid not in contacts:
- contacts[ctc_head.uuid] = Contact(ctc_head, set(), ContactList.Empty, UserStatus(name or ctc_head.email), ContactDetail(_gen_contact_id(detail)))
+ contacts[ctc_head.uuid] = Contact(ctc_head, set(), ContactList.Empty, UserStatus(name or display_email), ContactDetail(_gen_contact_id(detail)))
updated = True
ctc = contacts[ctc_head.uuid]
@@ -1435,8 +1441,8 @@ They've attached this message, as well:
membership.role = CircleRole.StatePendingOutbound
membership.state = CircleState.WaitingResponse
membership.inviter_uuid = inviter.uuid
- membership.inviter_email = inviter.email
- membership.inviter_name = inviter.status.name or inviter.email
+ membership.inviter_email = backend.util_get_display_email(inviter)
+ membership.inviter_name = inviter.status.name or backend.util_get_display_email(inviter)
membership.invite_message = invite_message
self.backend._mark_circle_modified(circle)
diff --git a/dev/tmpl/index.html b/dev/tmpl/index.html
deleted file mode 100644
index acee05a..0000000
--- a/dev/tmpl/index.html
+++ /dev/null
@@ -1,125 +0,0 @@
-
-
-
-
- Webconsole
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/dev/webconsole.py b/dev/webconsole.py
deleted file mode 100644
index 41cc402..0000000
--- a/dev/webconsole.py
+++ /dev/null
@@ -1,121 +0,0 @@
-from typing import Dict, Set, Tuple, Any, List, Optional
-import asyncio, sys, io, cProfile, pstats, traceback, util.misc
-
-from aiohttp import web
-from aiohttp.web import WSMsgType
-
-from core.backend import Backend
-from core.http import render
-
-def register(loop: asyncio.AbstractEventLoop, backend: Backend, http_app: web.Application) -> None:
- util.misc.add_to_jinja_env(http_app, 'dev', 'dev/tmpl')
-
- http_app['webconsole'] = Webconsole(loop, backend)
-
- http_app.router.add_get('/dev', handle_index)
- http_app.router.add_get('/dev/ws', handle_websocket)
-
-async def handle_index(req: web.Request) -> web.Response:
- return render(req, 'dev:index.html', { 'wsurl': 'ws://localhost/dev/ws' })
-
-async def handle_websocket(req: web.Request) -> web.StreamResponse:
- webconsole: Webconsole = req.app['webconsole']
-
- ws = web.WebSocketResponse()
- await ws.prepare(req)
-
- webconsole.websocks.add(ws)
- await ws.send_str("Webconsole on.")
-
- async for msg in ws:
- type = msg.type
- data = msg.data
- if type == WSMsgType.ERROR:
- print("ws error with exception {}".format(ws.exception()))
- continue
- if type == WSMsgType.TEXT:
- data = data.strip()
- if data:
- ret = webconsole.run(data)
- if ret:
- await ws.send_str(ret)
- continue
- print("ws unknown", type, data[:30])
-
- webconsole.websocks.remove(ws)
-
- return ws
-
-class Webconsole:
- __slots__ = ('loop', 'locals', 'objs', 'websocks', 'i')
-
- loop: asyncio.AbstractEventLoop
- locals: Dict[str, object]
- objs: Dict[object, str]
- websocks: Set[web.WebSocketResponse]
- i: int
-
- def __init__(self, loop: asyncio.AbstractEventLoop, backend: Backend) -> None:
- self.loop = loop
- self.locals = {
- '_': None,
- 'be': backend,
- 'dir': useful_dir,
- 'dirfull': dir,
- 'prof': profile,
- }
- self.objs = {}
- self.websocks = set()
- self.i = 0
-
- backend._dev = self
-
- def run(self, cmd: str) -> str:
- tmp = io.StringIO()
- sys.stdout = tmp
- try:
- self.locals['_'] = exec(compile(cmd + '\n', '', 'single'), None, self.locals) # type: ignore
- except:
- (exctype, excvalue, tb) = sys.exc_info() # type: Tuple[Any, Any, Any]
- ret = '\n'.join(traceback.format_exception(exctype, excvalue, tb))
- else:
- ret = tmp.getvalue()
- finally:
- sys.stdout = sys.__stdout__
- return ret
-
- def connect(self, obj: object) -> None:
- varname = 'k{}'.format(self.i)
- self.i += 1
- self.objs[obj] = varname
- self.locals[varname] = obj
- msg = "# Connect: `{}`".format(varname)
- for ws in self.websocks:
- self.loop.create_task(ws.send_str(msg))
-
- def disconnect(self, obj: object) -> None:
- varname = self.objs.pop(obj)
- msg = "# Disconnect: `{}`".format(varname)
- self.locals.pop(varname, None)
- for ws in self.websocks:
- self.loop.create_task(ws.send_str(msg))
-
-_PROFILE: Optional[cProfile.Profile] = None
-
-def profile(*restrictions: Any) -> None:
- global _PROFILE
- if _PROFILE is None:
- _PROFILE = cProfile.Profile()
- _PROFILE.enable()
- print("Profiling ON")
- return
- _PROFILE.disable()
- ps = pstats.Stats(_PROFILE).sort_stats('cumulative')
- ps.print_stats(*restrictions)
- _PROFILE = None
-
-def useful_dir(*args: Any) -> List[str]:
- return [
- x for x in dir(*args)
- if not x.endswith('__')
- ]
diff --git a/front/admin/entry.py b/front/admin/entry.py
index bf1acc8..7a119d8 100644
--- a/front/admin/entry.py
+++ b/front/admin/entry.py
@@ -63,7 +63,6 @@ def register(loop: asyncio.AbstractEventLoop, backend: Backend, registry: Option
backend.add_runner(AIOHTTPRunner(settings.ADMIN_HOST, settings.ADMIN_PORT, app, service = 'Admin'))
if not AdminAuth.configured():
print('[Admin] ADMIN_KEY is not set, so nobody can sign into the admin panel yet (see settings.py)')
- print(f'[Admin] Admin panel on http://{settings.ADMIN_HOST}:{settings.ADMIN_PORT}/')
return app
def create_app(backend: Backend, registry: Optional[ClientRegistry]) -> web.Application:
diff --git a/front/icq/ctrl.py b/front/icq/ctrl.py
index 249e03b..34c5b93 100644
--- a/front/icq/ctrl.py
+++ b/front/icq/ctrl.py
@@ -248,7 +248,7 @@ class LegacyCtrl:
handler = self._handler(command)
if handler is None:
# anything else is acknowledged and dropped, so the client stops resending it
- self.logger.info('[Client] Unhandled command', hex(command), 'from V{}'.format(self.version))
+ self.logger.debug('[Client] Unhandled command', hex(command), 'from V{}'.format(self.version))
self.ack(header)
return
handler(header, data)
@@ -483,7 +483,7 @@ class LegacyCtrl:
self._store_offline(target, plain)
return
except Exception as ex:
- self.logger.info('[Client] Could not open a chat:', str(ex))
+ self.logger.debug('[Client] Could not open a chat:', str(ex))
return
evt.send_when_joined(target.uuid, md)
diff --git a/front/icq/entry.py b/front/icq/entry.py
index a67e5f1..c7a09b2 100644
--- a/front/icq/entry.py
+++ b/front/icq/entry.py
@@ -65,7 +65,7 @@ class ListenerICQ(asyncio.DatagramProtocol):
def error_received(self, exc: Exception) -> None:
# an ICMP port unreachable from a client that went away; its session times out by itself
- self.logger.info('UDP error:', str(exc))
+ self.logger.debug('UDP error:', str(exc))
def send(self, packet: bytes, addr: Address) -> None:
if self.transport is not None:
@@ -77,7 +77,7 @@ class ListenerICQ(asyncio.DatagramProtocol):
try:
parsed = wire.parse(packet)
if parsed is None:
- self.logger.info('Dropped a datagram that is no ICQ packet from', addr[0])
+ self.logger.debug('Dropped a datagram that is no ICQ packet from', addr[0])
return
header, data = parsed
self.logger.debug('[Client]', header, 'from', addr)
@@ -132,7 +132,7 @@ class ListenerICQ(asyncio.DatagramProtocol):
now = time.monotonic()
for ctrl in list(self.by_uin.values()):
if now - ctrl.last_activity > SESSION_TIMEOUT:
- ctrl.logger.info('Timed out')
+ ctrl.logger.debug('Timed out')
ctrl.close()
for addr, noted in list(self.preauth.items()):
if now - noted > PREAUTH_LIFETIME:
diff --git a/front/icq/icq.py b/front/icq/icq.py
index c67d41f..3617581 100644
--- a/front/icq/icq.py
+++ b/front/icq/icq.py
@@ -246,7 +246,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
@@ -258,32 +258,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
diff --git a/front/icq/meta.py b/front/icq/meta.py
index 61756ae..0a8d8e5 100644
--- a/front/icq/meta.py
+++ b/front/icq/meta.py
@@ -23,14 +23,14 @@ def handle(ctrl: 'LegacyCtrl', header: 'Header', data: bytes) -> None:
subtype = reader.u16()
handler = HANDLERS.get(subtype)
if handler is None:
- ctrl.logger.info('[Client] Unhandled META_USER request', hex(subtype))
+ ctrl.logger.debug('[Client] Unhandled META_USER request', hex(subtype))
reply(ctrl, header, subtype, MetaResult.Ok)
return
- ctrl.logger.info('[Client] META_USER', hex(subtype))
+ ctrl.logger.debug('[Client] META_USER', hex(subtype))
try:
handler(ctrl, header, reader)
except ValueError:
- ctrl.logger.info('[Client] Malformed META_USER request', hex(subtype))
+ ctrl.logger.debug('[Client] Malformed META_USER request', hex(subtype))
def reply(ctrl: 'LegacyCtrl', header: 'Header', subtype: int, result: int, body: bytes = b'') -> None:
ctrl.send(Server.MetaUser, LE().u16(subtype).u8(result).raw(body if result == MetaResult.Ok else b'').bytes(), seq2 = header.seq2)
diff --git a/front/msim/ctrl.py b/front/msim/ctrl.py
index ef866b8..ef8c7f4 100644
--- a/front/msim/ctrl.py
+++ b/front/msim/ctrl.py
@@ -81,39 +81,39 @@ class MSIMCtrl:
nc1, nc2 = self.nonce[:32], self.nonce[32:]
# log what we got
- self.logger.info('Packet email:', email)
- self.logger.info('Packet response:', response)
- self.logger.info('Packet clientver:', clientver)
+ self.logger.debug('Packet email:', email)
+ self.logger.debug('Packet response:', response)
+ self.logger.debug('Packet clientver:', clientver)
if (uuid := self.backend.util_get_uuid_from_email(email)) is None:
- self.logger.info('E-mail not found!')
+ self.logger.debug('E-mail not found!')
else:
# get our hashed password
hashed_pwd = self.backend.user_service.msim_get_sha1_password(email)
if hashed_pwd is None:
- self.logger.info('MySpaceIM frontend-specific password not found!')
+ self.logger.debug('MySpaceIM frontend-specific password not found!')
else:
final_hash = hashlib.sha1(b''.join([hashed_pwd, nc2])).digest()
rc4_key = final_hash[:16] # we only need the first 128 bits of the result
- self.logger.info('Hashed password:', hashed_pwd.hex(' '))
- self.logger.info('Full hash:', final_hash.hex(' '))
- self.logger.info('RC4 key:', rc4_key.hex(' '))
+ self.logger.debug('Hashed password:', hashed_pwd.hex(' '))
+ self.logger.debug('Full hash:', final_hash.hex(' '))
+ self.logger.debug('RC4 key:', rc4_key.hex(' '))
arc4 = ARC4(rc4_key)
blob = arc4.decrypt(response)
- self.logger.info('RC4 blob data:', blob)
+ self.logger.debug('RC4 blob data:', blob)
seperator = blob.find(bytes(4))
if seperator != -1:
blob_nc1 = blob[:32]
blob_email = blob[32:seperator]
- self.logger.info('nc1 (context):', nc1)
- self.logger.info('nc1 (request):', blob_nc1)
- self.logger.info('E-mail (blob):', blob_email)
+ self.logger.debug('nc1 (context):', nc1)
+ self.logger.debug('nc1 (request):', blob_nc1)
+ self.logger.debug('E-mail (blob):', blob_email)
if nc1 == blob_nc1 and email == blob_email.decode():
valid = True
@@ -127,7 +127,7 @@ class MSIMCtrl:
self.bs = self.backend.login(uuid, self.client, BackendEventHandler(self), option=LoginOption.BootOthers)
# log that they successfully signed in and send reply giving sesskey / user id / username / etc
- self.logger.info(email, "successfully signed-in!")
+ self.logger.debug(email, "successfully signed-in!")
self.send_reply({
'lc': 2,
'sesskey': self.sesskey,
@@ -167,13 +167,13 @@ class MSIMCtrl:
def get_user_by_id(id: int) -> Optional[User]:
if (uuid := self.backend.util_get_uuid_from_user_id(id)) is None:
- self.logger.info('User ID', id, 'not found!')
+ self.logger.debug('User ID', id, 'not found!')
self.send_persist_error(cmd, dsn, lid, rid, f'User ID {id} not found')
return None
found_user = self.backend._load_user_record(uuid)
if found_user is None:
- self.logger.info('Unable to find uuid')
+ self.logger.debug('Unable to find uuid')
self.send_persist_error(cmd, dsn, lid, rid, 'Unable to find uuid')
return None
@@ -310,7 +310,7 @@ class MSIMCtrl:
body_dict = unmarshal_msim_dict(body)
target = body_dict['Target']
- self.logger.info('Target:', target)
+ self.logger.debug('Target:', target)
self.send_persist_reply(cmd, dsn, lid, rid, {
'WebTicket': TARGET_HOST
@@ -318,7 +318,7 @@ class MSIMCtrl:
# 514;0;9 (2^512;0;9) - update contact info
case (514, 0, 9):
- self.logger.info('Update contact info')
+ self.logger.debug('Update contact info')
# 2;1;16 - undocumented
#
@@ -328,7 +328,7 @@ class MSIMCtrl:
self.send_persist_reply(cmd, dsn, lid, rid, '')
case _:
- self.logger.info(f'Unknown persist command: {cmd};{dsn};{lid}')
+ self.logger.debug(f'Unknown persist command: {cmd};{dsn};{lid}')
def on_connect(self) -> None:
self.send_reply({
@@ -352,7 +352,7 @@ class MSIMCtrl:
f = getattr(self, f'_m_{command}')
f(m)
except AttributeError:
- self.logger.info('Invalid command:', command)
+ self.logger.debug('Invalid command:', command)
def send_reply(self, data_pairs: Dict[str, int | str | bytes | bool]) -> None:
self.writer.write(data_pairs)
@@ -414,11 +414,11 @@ class BackendEventHandler(event.BackendEventHandler):
self.ctrl = ctrl
def on_maintenance_message(self, *args: Any, **kwargs: Any) -> None:
- self.ctrl.logger.info('on_maintenance message')
+ self.ctrl.logger.debug('on_maintenance message')
pass
def on_maintenance_boot(self) -> None:
- self.ctrl.logger.info('on_maintenance_boot')
+ self.ctrl.logger.debug('on_maintenance_boot')
pass
def on_presence_notification(
@@ -427,69 +427,69 @@ class BackendEventHandler(event.BackendEventHandler):
send_status_on_bl: bool = False, sess_id: Optional[int] = None,
updated_phone_info: Optional[Dict[str, Any]] = None,
) -> None:
- self.ctrl.logger.info('on_presence_notification')
+ self.ctrl.logger.debug('on_presence_notification')
pass
def on_presence_self_notification(self, old_substatus: Substatus, *, update_status: bool = True,
update_info: bool = True) -> None:
- self.ctrl.logger.info('on_presence_self_notification')
+ self.ctrl.logger.debug('on_presence_self_notification')
pass
def on_chat_invite(
self, chat: Chat, inviter: User, *, circle: bool = False, inviter_id: Optional[str] = None,
invite_msg: str = '',
) -> None:
- self.ctrl.logger.info('on_chat_invite')
+ self.ctrl.logger.debug('on_chat_invite')
pass
def on_declined_chat_invite(self, chat: Chat, circle: bool = False) -> None:
- self.ctrl.logger.info('on_declined_chat_invite')
+ self.ctrl.logger.debug('on_declined_chat_invite')
pass
def on_added_me(self, user: User, *, adder_id: Optional[str] = None,
message: Optional[TextWithData] = None) -> None:
- self.ctrl.logger.info('on_added_me')
+ self.ctrl.logger.debug('on_added_me')
pass
def on_removed_me(self, user: User) -> None:
- self.ctrl.logger.info('on_removed_me')
+ self.ctrl.logger.debug('on_removed_me')
pass
def on_contact_request_denied(self, user_added: User, message: Optional[str], *,
contact_id: Optional[str] = None) -> None:
- self.ctrl.logger.info('on_contact_request_denied')
+ self.ctrl.logger.debug('on_contact_request_denied')
pass
def on_oim_sent(self, oim: OIM) -> None:
- self.ctrl.logger.info('on_oim_sent')
+ self.ctrl.logger.debug('on_oim_sent')
pass
def on_login_elsewhere(self, option: LoginOption) -> None:
- self.ctrl.logger.info('on_login_elsewhere')
+ self.ctrl.logger.debug('on_login_elsewhere')
pass
def on_circle_invite_revoked(self, chat_id: str) -> None:
- self.ctrl.logger.info('on_circle_invite_revoked')
+ self.ctrl.logger.debug('on_circle_invite_revoked')
pass
def on_accepted_circle_invite(self, circle: Circle) -> None:
- self.ctrl.logger.info('on_accepted_circle_invite')
+ self.ctrl.logger.debug('on_accepted_circle_invite')
pass
def on_circle_updated(self, circle: Circle) -> None:
- self.ctrl.logger.info('on_circle_updated')
+ self.ctrl.logger.debug('on_circle_updated')
pass
def on_left_circle(self, circle: Circle) -> None:
- self.ctrl.logger.info('on_left_circle')
+ self.ctrl.logger.debug('on_left_circle')
pass
def on_circle_role_updated(self, chat_id: str, role: CircleRole) -> None:
- self.ctrl.logger.info('on_circle_role_updated')
+ self.ctrl.logger.debug('on_circle_role_updated')
pass
def on_circle_created(self, circle: Circle) -> None:
- self.ctrl.logger.info('on_circle_created')
+ self.ctrl.logger.debug('on_circle_created')
pass
def on_close(self) -> None:
diff --git a/front/msn/http/abservice.py b/front/msn/http/abservice.py
index 7ec70dd..0d6e1f6 100644
--- a/front/msn/http/abservice.py
+++ b/front/msn/http/abservice.py
@@ -1093,7 +1093,7 @@ def ab_ManageWLConnection(req: web.Request, header: Any, action: Any, bs: Backen
bs.me_accept_circle_invite(circle, send_events=False)
backend.loop.create_task(_dispatch_circle_invite_status(backend, user, circle, False))
except error.MemberNotInCircle:
- error_msg = 'User `{email}` does not have membership in `Circle`'.format(email=head.email)
+ error_msg = 'User `{email}` does not have membership in `Circle`'.format(email=backend.util_get_display_email(head))
return render(req, 'msn:abservice/ManageWLConnectionResponse.xml', {
'cachekey': cachekey,
'host': settings.ADDRESSBOOK_HOST,
@@ -1101,7 +1101,7 @@ def ab_ManageWLConnection(req: web.Request, header: Any, action: Any, bs: Backen
'error': error_msg,
}, status=500)
except error.MemberAlreadyInCircle:
- error_msg = 'User `{email}` already accepted in `Circle`'.format(email=head.email)
+ error_msg = 'User `{email}` already accepted in `Circle`'.format(email=backend.util_get_display_email(head))
return render(req, 'msn:abservice/ManageWLConnectionResponse.xml', {
'cachekey': cachekey,
'host': settings.ADDRESSBOOK_HOST,
@@ -1136,7 +1136,7 @@ def ab_ManageWLConnection(req: web.Request, header: Any, action: Any, bs: Backen
try:
bs.me_invite_user_to_circle(circle, head, invite_message=invite_message)
except error.MemberNotInCircle:
- error_msg = 'User `{email}` does not have membership in `Circle`'.format(email=head.email)
+ error_msg = 'User `{email}` does not have membership in `Circle`'.format(email=backend.util_get_display_email(head))
return render(req, 'msn:abservice/ManageWLConnectionResponse.xml', {
'cachekey': cachekey,
'host': settings.ADDRESSBOOK_HOST,
@@ -1144,7 +1144,7 @@ def ab_ManageWLConnection(req: web.Request, header: Any, action: Any, bs: Backen
'error': error_msg,
}, status=500)
except error.MemberAlreadyInvitedToCircle:
- error_msg = 'User `{email}` already invited to `Circle`'.format(email=head.email)
+ error_msg = 'User `{email}` already invited to `Circle`'.format(email=backend.util_get_display_email(head))
return render(req, 'msn:abservice/ManageWLConnectionResponse.xml', {
'cachekey': cachekey,
'host': settings.ADDRESSBOOK_HOST,
@@ -1174,7 +1174,7 @@ def ab_ManageWLConnection(req: web.Request, header: Any, action: Any, bs: Backen
bs.me_decline_circle_invite(circle, send_events=False)
backend.loop.create_task(_dispatch_circle_invite_status(backend, user, circle, False))
except error.MemberNotInCircle:
- error_msg = 'User `{email}` does not have membership in `Circle`'.format(email=head.email)
+ error_msg = 'User `{email}` does not have membership in `Circle`'.format(email=backend.util_get_display_email(head))
return render(req, 'msn:abservice/ManageWLConnectionResponse.xml', {
'cachekey': cachekey,
'host': settings.ADDRESSBOOK_HOST,
@@ -1182,7 +1182,7 @@ def ab_ManageWLConnection(req: web.Request, header: Any, action: Any, bs: Backen
'error': error_msg,
}, status=500)
except error.MemberAlreadyInCircle:
- error_msg = 'User `{email}` already accepted in `Circle`'.format(email=head.email)
+ error_msg = 'User `{email}` already accepted in `Circle`'.format(email=backend.util_get_display_email(head))
return render(req, 'msn:abservice/ManageWLConnectionResponse.xml', {
'cachekey': cachekey,
'host': settings.ADDRESSBOOK_HOST,
@@ -1210,7 +1210,7 @@ def ab_ManageWLConnection(req: web.Request, header: Any, action: Any, bs: Backen
add_ctc = True
if add_ctc:
try:
- bs.me_contact_add(contact_uuid, models.ContactList.FL, name=head.email)
+ bs.me_contact_add(contact_uuid, models.ContactList.FL, name=backend.util_get_display_email(head))
except error.ContactListIsFull:
return schema_fault(req, 'http://www.msn.com/webservices/AddressBook/ManageWLConnection', 'Contact list is full')
except:
@@ -1237,7 +1237,7 @@ def ab_ManageWLConnection(req: web.Request, header: Any, action: Any, bs: Backen
'now': now_str,
'user': user,
})
-
+
def ab_BreakConnection(req: web.Request, header: Any, action: Any, bs: BackendSession) -> web.Response:
backend: Backend = req.app['backend']
cachekey = secrets.token_urlsafe(172)
diff --git a/front/msn/http/tmpl/_funcs.xml b/front/msn/http/tmpl/_funcs.xml
index 9885d0b..1a98bd2 100644
--- a/front/msn/http/tmpl/_funcs.xml
+++ b/front/msn/http/tmpl/_funcs.xml
@@ -91,7 +91,7 @@
{% if ctc.detail.last_name %}
{{ ctc.detail.last_name }}
{% endif %}
- {{ ctc.head.email }}
+ {{ display_email(ctc.head) }}
false
{{ ctc.status.name }}
{{ puid_format(ctc.head.uuid) }}
@@ -198,7 +198,7 @@
Me
{{ user.status.name }}
- {{ user.email }}
+ {{ display_email(user) }}
false
{{ user.status.name }}
{{ puid_format(user.uuid) }}
diff --git a/front/msn/http/tmpl/abservice/ABFindAllResponse.xml b/front/msn/http/tmpl/abservice/ABFindAllResponse.xml
index b16cc08..2123828 100644
--- a/front/msn/http/tmpl/abservice/ABFindAllResponse.xml
+++ b/front/msn/http/tmpl/abservice/ABFindAllResponse.xml
@@ -33,7 +33,7 @@
0
{{ cid_format(user.uuid, decimal = True) }}
- {{ user.email }}
+ {{ display_email(user) }}
true
false
false
diff --git a/front/msn/http/tmpl/abservice/ABFindContactsPagedResponse.xml b/front/msn/http/tmpl/abservice/ABFindContactsPagedResponse.xml
index f0a5b30..ee3fbe7 100644
--- a/front/msn/http/tmpl/abservice/ABFindContactsPagedResponse.xml
+++ b/front/msn/http/tmpl/abservice/ABFindContactsPagedResponse.xml
@@ -247,7 +247,7 @@
0
{% if ab_id.startswith('00000000-0000-0000-0009-') %}{{ cid_format(ab_id, decimal = True) }}{% else %}{{ cid_format(user.uuid, decimal = True) }}{% endif %}
- {% if ab_id.startswith('00000000-0000-0000-0009-') %}{{ ab_id }}@live.com{% else %}{{ user.email }}{% endif %}
+ {% if ab_id.startswith('00000000-0000-0000-0009-') %}{{ ab_id }}@live.com{% else %}{{ display_email(user) }}{% endif %}
true
false
false
diff --git a/front/msn/http/tmpl/abservice/CreateContactResponse.xml b/front/msn/http/tmpl/abservice/CreateContactResponse.xml
index 01a708d..eb9f363 100644
--- a/front/msn/http/tmpl/abservice/CreateContactResponse.xml
+++ b/front/msn/http/tmpl/abservice/CreateContactResponse.xml
@@ -15,10 +15,10 @@
{{ head.uuid }}
LivePending
- {{ head.email }}
- {{ head.email }}
+ {{ display_email(head) }}
+ {{ display_email(head) }}
false
- {{ head.email }}
+ {{ display_email(head) }}
{{ puid_format(user.uuid) }}
{{ cid_format(head.uuid, decimal = True) }}
false
diff --git a/front/msn/http/tmpl/abservice/ManageWLConnectionResponse.xml b/front/msn/http/tmpl/abservice/ManageWLConnectionResponse.xml
index af87994..ff61a7e 100644
--- a/front/msn/http/tmpl/abservice/ManageWLConnectionResponse.xml
+++ b/front/msn/http/tmpl/abservice/ManageWLConnectionResponse.xml
@@ -22,10 +22,10 @@
{% if circle is not none and ab_id == '00000000-0000-0000-0000-000000000000' %}00000000-0000-0000-0009-{{ circle.chat_id }}{% else %}{{ head.uuid }}{% endif %}
{% if circle is not none and ab_id == '00000000-0000-0000-0000-000000000000' %}Circle{% elif circle is not none %}{% if circle.memberships[head.uuid].state == CircleState.WaitingResponse or circle.memberships[head.uuid].state == CircleState.Rejected or (circle.memberships[head.uuid].role == CircleRole.Empty or circle.memberships[head.uuid].state == CircleState.Empty) %}LivePending{% else %}Live{% endif %}{% else %}Live{% endif %}
- {% if circle is not none and ab_id == '00000000-0000-0000-0000-000000000000' %}circle{% else %}{{ head.email }}{% endif %}
- {% if circle is not none and ab_id == '00000000-0000-0000-0000-000000000000' %}00000000-0000-0000-0009-{{ circle.chat_id.upper() }}@hotmail.com{% else %}{{ head.email }}{% endif %}
+ {% if circle is not none and ab_id == '00000000-0000-0000-0000-000000000000' %}circle{% else %}{{ display_email(head) }}{% endif %}
+ {% if circle is not none and ab_id == '00000000-0000-0000-0000-000000000000' %}00000000-0000-0000-0009-{{ circle.chat_id.upper() }}@hotmail.com{% else %}{{ display_email(head) }}{% endif %}
false
- {% if circle is not none and ab_id == '00000000-0000-0000-0000-000000000000' %}{{ circle.name }}{% else %}{{ head.email }}{% endif %}
+ {% if circle is not none and ab_id == '00000000-0000-0000-0000-000000000000' %}{{ circle.name }}{% else %}{{ display_email(head) }}{% endif %}
{{ puid_format(user.uuid) }}
{% if circle is not none %}{{ cid_format('00000000-0000-0000-0009-' + circle.chat_id, decimal = True) }}{% else %}{{ cid_format(head.uuid, decimal = True) }}{% endif %}
false
diff --git a/front/msn/http/tmpl/sharing/FindMembershipResponse.xml b/front/msn/http/tmpl/sharing/FindMembershipResponse.xml
index b830a0e..927d20f 100644
--- a/front/msn/http/tmpl/sharing/FindMembershipResponse.xml
+++ b/front/msn/http/tmpl/sharing/FindMembershipResponse.xml
@@ -30,7 +30,7 @@
{{ date_format(contact.head.date_created) }}
0001-01-01T00:00:00
- {{ contact.head.email }}
+ {{ display_email(contact.head) }}
false
0
{{ cid_format(contact.head.uuid, decimal = True) }}
@@ -74,7 +74,7 @@
{{ date_format(contact.head.date_created) }}
0001-01-01T00:00:00
- {{ contact.head.email }}
+ {{ display_email(contact.head) }}
false
0
{{ cid_format(contact.head.uuid, decimal = True) }}
@@ -111,7 +111,7 @@
0
{{ cid_format(user.uuid, decimal = True) }}
- {{ user.email }}
+ {{ display_email(user) }}
false
WindowsLive
diff --git a/front/msn/http/util.py b/front/msn/http/util.py
index 5403305..b433032 100644
--- a/front/msn/http/util.py
+++ b/front/msn/http/util.py
@@ -11,7 +11,11 @@ def render(req: web.Request, tmpl_name: str, ctxt: Optional[Dict[str, Any]] = No
else:
content_type = 'text/html'
tmpl = req.app['jinja_env'].get_template(tmpl_name)
- content = tmpl.render(**(ctxt or {}))
+ template_context = dict(ctxt or {})
+ backend = req.app.get('backend')
+ if backend is not None:
+ template_context['display_email'] = display_email
+ content = tmpl.render(**template_context)
return web.Response(status = status, content_type = content_type, text = content)
async def preprocess_soap(req: web.Request) -> Tuple[Any, Any, Optional[BackendSession], str]:
@@ -151,6 +155,17 @@ def parse_cookies(cookie_string: Optional[str]) -> Dict[str, Any]:
return cookie_dict
+def display_email(user: Any, fallback: Optional[str] = None) -> str:
+ if isinstance(user, str):
+ user = backend.user_service.get(user)
+ if user is None and fallback:
+ uuid = backend.user_service.get_uuid(fallback)
+ if uuid is not None:
+ user = backend.user_service.get(uuid)
+ if user is None:
+ return fallback or ''
+ return backend.util_get_display_email(user)
+
async def dispatch_abch(req: web.Request, module: Any, prefix: str) -> web.Response:
header, action, bs, _ = await preprocess_soap(req)
if bs is None:
diff --git a/front/msn/msnp_ns.py b/front/msn/msnp_ns.py
index 85c7111..6689a35 100644
--- a/front/msn/msnp_ns.py
+++ b/front/msn/msnp_ns.py
@@ -282,7 +282,6 @@ class MSNPCtrlNS(MSNPCtrl):
if uuid is not None:
self.bs = backend.login(uuid, self.client, BackendEventHandler(self.backend.loop, self), option = LoginOption.BootOthers)
token, _ = backend.login_auth_service.create_token('ns/login', [uuid, None], lifetime = 86400)
- print(f"usr_email during MD5 stage S: {usr_email}")
self._auth_final_step(trid, usr_email, token or '', None)
return
@@ -460,7 +459,6 @@ class MSNPCtrlNS(MSNPCtrl):
bs = self.bs
dialect = self.dialect
- print(f"bs: {bs}")
if bs is None:
self.send_reply(Err.AuthFail, trid)
self.close()
@@ -471,9 +469,6 @@ class MSNPCtrlNS(MSNPCtrl):
usr_email_lower = (self.usr_email or '').lower()
alias_email = '{}@crosstalk.im'.format(user.username).lower()
- print(f"email: {email}")
- print(f"attempted email: {attempted_email}")
- print(f"self.usr_email: {self.usr_email}")
if usr_email_lower not in (user.email.lower(), alias_email, email.lower()):
self.send_reply(Err.AuthFail, trid)
self.close()
@@ -530,7 +525,6 @@ class MSNPCtrlNS(MSNPCtrl):
# self.close()
# return
else:
- print(f"args: {args}")
self.send_reply('USR', trid, 'OK', email, *args)
(high, low) = uuid_to_high_low(user.uuid)
diff --git a/front/oscar/ctrl.py b/front/oscar/ctrl.py
index e42dbb6..f750268 100644
--- a/front/oscar/ctrl.py
+++ b/front/oscar/ctrl.py
@@ -159,7 +159,7 @@ class OSCARCtrl:
entry = take_cookie(cookie_tlv.data)
if entry is not None and (entry.bs is None or not entry.bs.closed):
- self.logger.info('found BOS cookie')
+ self.logger.debug('found BOS cookie')
self.multi_conn = entry.multi_conn
if entry.bs is not None:
@@ -191,7 +191,7 @@ class OSCARCtrl:
if found:
# NINA also sends OSERVICE__WELL_KNOWN_URLS right after (should we?)
- self.logger.info('[Server] OSERVICE__HOST_ONLINE')
+ self.logger.debug('[Server] OSERVICE__HOST_ONLINE')
msg = SNACMessage(0x0001, 0x0003)
@@ -210,11 +210,11 @@ class OSCARCtrl:
self.bs.front_data['oscar0_icq'] = entry.icq
self.bs.front_data['oscar0_client_id'] = entry.client_id
else:
- self.logger.info('invalid BOS cookie given')
+ self.logger.debug('invalid BOS cookie given')
self.close()
elif find_tlv(tlvs, 0x0001) is not None:
- self.logger.info('Using FLAP-level authentication')
+ self.logger.debug('Using FLAP-level authentication')
screen_name_tlv = find_tlv(tlvs, 0x0001)
roasted_pw_tlv = find_tlv(tlvs, 0x0002)
@@ -222,8 +222,8 @@ class OSCARCtrl:
screen_name = screen_name_tlv.data.decode('latin-1')
roasted_pw = roasted_pw_tlv.data if roasted_pw_tlv is not None else b''
- self.logger.info('Screen Name (client-given):', screen_name)
- self.logger.info('Password (roasted):', roasted_pw.hex())
+ self.logger.debug('Screen Name (client-given):', screen_name)
+ self.logger.debug('Password (roasted):', roasted_pw.hex())
context = self.context
version = client_version(tlvs)
@@ -233,9 +233,9 @@ class OSCARCtrl:
context.backend, screen_name, lambda uuid: context.backend.user_service.login_with_uuid(uuid, password) is not None,
)
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')
self.client = Client('icq' if icq else 'aim', version, self.client.via)
context.client = self.client
@@ -266,17 +266,17 @@ class OSCARCtrl:
self.logger.error(ex)
if not found:
- self.logger.info(f'[Client] Unknown SNAC({hex(message.foodgroup)},{hex(message.subgroup)})')
- self.logger.info('[Client]', message.data.hex())
+ self.logger.debug(f'[Client] Unknown SNAC({hex(message.foodgroup)},{hex(message.subgroup)})')
+ self.logger.debug('[Client]', message.data.hex())
# an unanswered request leaves the client waiting on it, so it gets told the SNAC isn't one we know
if message.subgroup != 0x0001:
self.send_snac_error(message.foodgroup, message.request_id, 0x0001)
def on_error_frame(self, data: bytes) -> None:
- self.logger.info('[Client] Recieved error frame with:', data.hex())
+ self.logger.debug('[Client] Recieved error frame with:', data.hex())
def on_signoff_frame(self, data: bytes) -> None:
- self.logger.info('[Client] Recieved signoff frame')
+ self.logger.debug('[Client] Recieved signoff frame')
self.close()
def close(self) -> None:
diff --git a/front/oscar/entry.py b/front/oscar/entry.py
index 5b737ef..bff0ea5 100644
--- a/front/oscar/entry.py
+++ b/front/oscar/entry.py
@@ -70,7 +70,7 @@ class ListenerOSCAR(asyncio.Protocol):
if self.buffer[0] != 0x2A:
# without the marker there's no telling where the next frame starts, so the stream can't be recovered
- self.logger.info('Recieved data without a FLAP start marker, closing connection')
+ self.logger.debug('Recieved data without a FLAP start marker, closing connection')
self.buffer = b''
self.controller.close()
break
@@ -103,7 +103,7 @@ class ListenerOSCAR(asyncio.Protocol):
# DATA (always contains a SNAC)
case 0x02:
if len(data) < 10:
- self.logger.info('Recieved a DATA frame too short to hold a SNAC:', data.hex())
+ self.logger.debug('Recieved a DATA frame too short to hold a SNAC:', data.hex())
return
msg = SNACMessage()
@@ -123,7 +123,7 @@ class ListenerOSCAR(asyncio.Protocol):
pass
case _:
- self.logger.info('Recieved unknown frame:', str(frame), 'with data:', data.hex())
+ self.logger.debug('Recieved unknown frame:', str(frame), 'with data:', data.hex())
def _on_close(self) -> None:
if self.transport is not None:
diff --git a/front/oscar/foodgroups/admin.py b/front/oscar/foodgroups/admin.py
index 9d17e3a..4007142 100644
--- a/front/oscar/foodgroups/admin.py
+++ b/front/oscar/foodgroups/admin.py
@@ -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
diff --git a/front/oscar/foodgroups/bart.py b/front/oscar/foodgroups/bart.py
index b3528c4..6097756 100644
--- a/front/oscar/foodgroups/bart.py
+++ b/front/oscar/foodgroups/bart.py
@@ -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)
diff --git a/front/oscar/foodgroups/bos.py b/front/oscar/foodgroups/bos.py
index b98b941..830fce9 100644
--- a/front/oscar/foodgroups/bos.py
+++ b/front/oscar/foodgroups/bos.py
@@ -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)
\ No newline at end of file
diff --git a/front/oscar/foodgroups/bucp.py b/front/oscar/foodgroups/bucp.py
index 06aad38..c9db531 100644
--- a/front/oscar/foodgroups/bucp.py
+++ b/front/oscar/foodgroups/bucp.py
@@ -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
diff --git a/front/oscar/foodgroups/buddy.py b/front/oscar/foodgroups/buddy.py
index 040fc10..948e3b1 100644
--- a/front/oscar/foodgroups/buddy.py
+++ b/front/oscar/foodgroups/buddy.py
@@ -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)
\ No newline at end of file
diff --git a/front/oscar/foodgroups/chat.py b/front/oscar/foodgroups/chat.py
index 4410095..cd617ed 100644
--- a/front/oscar/foodgroups/chat.py
+++ b/front/oscar/foodgroups/chat.py
@@ -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
diff --git a/front/oscar/foodgroups/chatnav.py b/front/oscar/foodgroups/chatnav.py
index 6606690..cef905a 100644
--- a/front/oscar/foodgroups/chatnav.py
+++ b/front/oscar/foodgroups/chatnav.py
@@ -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()
diff --git a/front/oscar/foodgroups/directory.py b/front/oscar/foodgroups/directory.py
index 6ddc0cc..4e9b935 100644
--- a/front/oscar/foodgroups/directory.py
+++ b/front/oscar/foodgroups/directory.py
@@ -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)
diff --git a/front/oscar/foodgroups/email.py b/front/oscar/foodgroups/email.py
index bffdf4a..0baac34 100644
--- a/front/oscar/foodgroups/email.py
+++ b/front/oscar/foodgroups/email.py
@@ -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)')
diff --git a/front/oscar/foodgroups/feedbag.py b/front/oscar/foodgroups/feedbag.py
index dd3e4b6..8dc3058 100644
--- a/front/oscar/foodgroups/feedbag.py
+++ b/front/oscar/foodgroups/feedbag.py
@@ -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:
diff --git a/front/oscar/foodgroups/icbm.py b/front/oscar/foodgroups/icbm.py
index 9ba68ff..4857c25 100644
--- a/front/oscar/foodgroups/icbm.py
+++ b/front/oscar/foodgroups/icbm.py
@@ -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
diff --git a/front/oscar/foodgroups/icq.py b/front/oscar/foodgroups/icq.py
index ca3894d..21a1f6b 100644
--- a/front/oscar/foodgroups/icq.py
+++ b/front/oscar/foodgroups/icq.py
@@ -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
diff --git a/front/oscar/foodgroups/invite.py b/front/oscar/foodgroups/invite.py
index 4e1ef32..0fbbdff 100644
--- a/front/oscar/foodgroups/invite.py
+++ b/front/oscar/foodgroups/invite.py
@@ -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)')
diff --git a/front/oscar/foodgroups/locate.py b/front/oscar/foodgroups/locate.py
index ac18b4d..d77b6e6 100644
--- a/front/oscar/foodgroups/locate.py
+++ b/front/oscar/foodgroups/locate.py
@@ -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)
diff --git a/front/oscar/foodgroups/oservice.py b/front/oscar/foodgroups/oservice.py
index 42a8e82..e72c0fe 100644
--- a/front/oscar/foodgroups/oservice.py
+++ b/front/oscar/foodgroups/oservice.py
@@ -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
diff --git a/front/oscar/foodgroups/pd.py b/front/oscar/foodgroups/pd.py
index 8e2ca51..3e4a003 100644
--- a/front/oscar/foodgroups/pd.py
+++ b/front/oscar/foodgroups/pd.py
@@ -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):
diff --git a/front/oscar/foodgroups/popup.py b/front/oscar/foodgroups/popup.py
index 8a3b548..67b3111 100644
--- a/front/oscar/foodgroups/popup.py
+++ b/front/oscar/foodgroups/popup.py
@@ -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
diff --git a/front/oscar/foodgroups/stats.py b/front/oscar/foodgroups/stats.py
index d7424b2..3453ff9 100644
--- a/front/oscar/foodgroups/stats.py
+++ b/front/oscar/foodgroups/stats.py
@@ -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))
diff --git a/front/oscar/foodgroups/user_lookup.py b/front/oscar/foodgroups/user_lookup.py
index cbfedc8..57ce78d 100644
--- a/front/oscar/foodgroups/user_lookup.py
+++ b/front/oscar/foodgroups/user_lookup.py
@@ -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)
diff --git a/front/oscar/proto/backend.py b/front/oscar/proto/backend.py
index 37d2977..50be0f9 100644
--- a/front/oscar/proto/backend.py
+++ b/front/oscar/proto/backend.py
@@ -113,7 +113,7 @@ class BackendEventHandler(event.BackendEventHandler):
self.ctrl = ctrl
def on_maintenance_message(self, *args: Any, **kwargs: Any) -> None:
- self.ctrl.logger.info("on_maintenance message dispatched")
+ self.ctrl.logger.debug("on_maintenance message dispatched")
message = "CrossTalk will be down for maintenance soon. Now is a good time to wrap up any conversations."
if args[1] is not None and args[1] > 0:
message = """CrossTalk will be down for maintenance in around {} minute(s). \
@@ -121,7 +121,7 @@ Now is a good time to wrap up any conversations.""".format(args[1])
self.ctrl.send_snac(popup_display(self, "https://crosstalk.im/maintenance", message))
def on_client_alert(self, alert: Alert) -> bool:
- self.ctrl.logger.info("on_client_alert dispatched")
+ self.ctrl.logger.debug("on_client_alert dispatched")
self.ctrl.send_snac(popup_display(self, alert.url or '', alert.plain()))
return True
@@ -147,10 +147,10 @@ Now is a good time to wrap up any conversations.""".format(args[1])
send_status_on_bl: bool = False, sess_id: Optional[int] = None,
updated_phone_info: Optional[Dict[str, Any]] = None,
) -> None:
- self.ctrl.logger.info('on_presence_notification dispatched')
- self.ctrl.logger.info('update_status:', update_status)
- self.ctrl.logger.info('update_info_other:', update_info_other)
- self.ctrl.logger.info('status:', ctc.status.substatus.name)
+ self.ctrl.logger.debug('on_presence_notification dispatched')
+ self.ctrl.logger.debug('update_status:', update_status)
+ self.ctrl.logger.debug('update_info_other:', update_info_other)
+ self.ctrl.logger.debug('status:', ctc.status.substatus.name)
# don't want updates from users with invalid usernames
if not names.representable(ctc.head):
@@ -158,7 +158,7 @@ Now is a good time to wrap up any conversations.""".format(args[1])
# don't want any non-status updates
if not update_status:
- self.ctrl.logger.info('fell into update_status check')
+ self.ctrl.logger.debug('fell into update_status check')
return
# presence only starts flowing once the client says it's ready for it (OSERVICE__CLIENT_READY), and only for
@@ -169,21 +169,21 @@ Now is a good time to wrap up any conversations.""".format(args[1])
try:
ctc.compute_visible_status(self.bs.user)
- self.ctrl.logger.info('sending presence notif')
+ self.ctrl.logger.debug('sending presence notif')
self.ctrl.send_snac(build_presence_notif(ctc, self.ctrl.backend, self.bs))
except Exception as ex:
self.ctrl.logger.error(ex)
def on_presence_self_notification(self, old_substatus: Substatus, *, update_status: bool = True,
update_info: bool = True) -> None:
- self.ctrl.logger.info('on_presence_self_notification')
+ self.ctrl.logger.debug('on_presence_self_notification')
pass
def on_chat_invite(
self, chat: Chat, inviter: User, *, circle: bool = False, inviter_id: Optional[str] = None,
invite_msg: str = '',
) -> None:
- self.ctrl.logger.info('on_chat_invite')
+ self.ctrl.logger.debug('on_chat_invite')
if chat is None:
chat = self.ctrl.backend.chat_create()
chat.add_id('oscar0', chat.ids['main'])
@@ -199,12 +199,12 @@ Now is a good time to wrap up any conversations.""".format(args[1])
return
def on_declined_chat_invite(self, chat: Chat, circle: bool = False) -> None:
- self.ctrl.logger.info('on_declined_chat_invite')
+ self.ctrl.logger.debug('on_declined_chat_invite')
pass
def on_added_me(self, user: User, *, adder_id: Optional[str] = None,
message: Optional[TextWithData] = None) -> None:
- self.ctrl.logger.info('on_added_me')
+ self.ctrl.logger.debug('on_added_me')
if not names.representable(user):
return
@@ -222,23 +222,23 @@ Now is a good time to wrap up any conversations.""".format(args[1])
send_icq_system_message(self.ctrl, user, ICQMessageType.Added, '')
def on_removed_me(self, user: User) -> None:
- self.ctrl.logger.info('on_removed_me')
+ self.ctrl.logger.debug('on_removed_me')
pass
def on_contact_request_denied(self, user_added: User, message: Optional[str], *,
contact_id: Optional[str] = None) -> None:
- self.ctrl.logger.info('on_contact_request_denied')
+ self.ctrl.logger.debug('on_contact_request_denied')
pass
def on_oim_sent(self, oim: OIM) -> None:
- self.ctrl.logger.info('on_oim_sent')
+ self.ctrl.logger.debug('on_oim_sent')
# an offline message only gets stored while its recipient can't be reached, so a session that hears about one
# (signed on invisible, say) gets it straight away, like the YMSG frontend does
from ..foodgroups.icbm import deliver_offline_messages
deliver_offline_messages(self.ctrl, [oim])
def on_login_elsewhere(self, option: LoginOption) -> None:
- self.ctrl.logger.info('on_login_elsewhere')
+ self.ctrl.logger.debug('on_login_elsewhere')
self.ctrl.signoff(DISCONNECT_NEW_LOGIN)
self.ctrl.close()
return
@@ -304,16 +304,16 @@ def login(logger: Logger,
if error_code is None and user.suspended:
error_code = LoginError.Suspended
- logger.info(screen_name, 'tried to sign on but is suspended!')
+ logger.debug(screen_name, 'tried to sign on but is suspended!')
# and check if the user has verified their e-mail address
#if error_code is None and not user.verified_to_login:
# error_code = LoginError.EmailNotVerified
#
- # logger.info(screen_name, 'tried to sign on but has not verified their e-mail address!')
+ # logger.debug(screen_name, 'tried to sign on but has not verified their e-mail address!')
if error_code is None:
- logger.info(screen_name, 'signed on successfully!')
+ logger.debug(screen_name, 'signed on successfully!')
# generate BOS cookie and add it to array
client_id_tlv = find_tlv(tlvs, 0x0003)
diff --git a/front/oscar/proto/chat.py b/front/oscar/proto/chat.py
index f6468df..285dcc4 100644
--- a/front/oscar/proto/chat.py
+++ b/front/oscar/proto/chat.py
@@ -26,7 +26,7 @@ class ChatEventHandler(event.ChatEventHandler):
self._pending = []
def on_participant_joined(self, cs_other: 'ChatSession', first_pop: bool, initial_join: bool) -> None:
- self.ctrl.logger.info('on_participant_joined')
+ self.ctrl.logger.debug('on_participant_joined')
still_pending = []
for (target_uuid, data) in self._pending:
if cs_other.user.uuid == target_uuid:
@@ -36,7 +36,7 @@ class ChatEventHandler(event.ChatEventHandler):
self._pending = still_pending
def on_participant_left(self, cs_other: 'ChatSession', last_pop: bool) -> None:
- self.ctrl.logger.info('on_participant_left')
+ self.ctrl.logger.debug('on_participant_left')
# once the other side is gone this chat can't reach them again (they'd be invited to a new one), so it's let go
if any(cs is not self.cs for cs in self.cs.chat.get_roster()):
return
@@ -49,17 +49,17 @@ class ChatEventHandler(event.ChatEventHandler):
def on_chat_invite_declined(self, chat: 'Chat', invitee: User, *, invitee_id: Optional[str] = None,
message: Optional[str] = None, circle: bool = False) -> None:
- self.ctrl.logger.info('on_chat_invite_declined')
+ self.ctrl.logger.debug('on_chat_invite_declined')
def on_chat_updated(self) -> None:
- self.ctrl.logger.info('on_chat_updated')
+ self.ctrl.logger.debug('on_chat_updated')
def on_chat_roster_updated(self) -> None:
- self.ctrl.logger.info('on_chat_roster_updated')
+ self.ctrl.logger.debug('on_chat_roster_updated')
def on_participant_status_updated(self, cs_other: 'ChatSession', first_pop: bool, initial: bool,
old_substatus: Substatus) -> None:
- self.ctrl.logger.info('on_participant_status_updated')
+ self.ctrl.logger.debug('on_participant_status_updated')
def on_message(self, data: MessageData) -> None:
if data.sender is self.bs.user:
@@ -72,8 +72,8 @@ class ChatEventHandler(event.ChatEventHandler):
self.ctrl.send_snac(messagedata_to_icbm_event(data, self.bs))
return
elif data.type is MessageType.Chat:
- self.ctrl.logger.info('Got a message from', data.sender.username, 'saying:')
- self.ctrl.logger.info((data.text or '').encode())
+ self.ctrl.logger.debug('Got a message from', data.sender.username, 'saying:')
+ self.ctrl.logger.debug((data.text or '').encode())
# an OSCAR sender's own message cookie travels with the message, so acks and replies line up on both ends; anything
# else gets a fresh one, since clients take a repeated cookie for a repeated message
self.ctrl.send_snac(messagedata_to_icbm(data.front_cache.get('icbm_cookie') or gen_cookie(), data, self.bs))
diff --git a/front/toc/commands.py b/front/toc/commands.py
index 67bb5e4..71b36c3 100644
--- a/front/toc/commands.py
+++ b/front/toc/commands.py
@@ -211,7 +211,7 @@ def _toc_chat_invite(ctrl, args: list[str]) -> None:
@command('toc_get_info')
def _toc_get_info(ctrl, args: list[str]) -> None:
if args:
- ctrl.logger.info('[Client] toc_get_info for', args[0], '(no profile service configured)')
+ ctrl.logger.debug('[Client] toc_get_info for', args[0], '(no profile service configured)')
@command('toc_set_info')
def _toc_set_info(ctrl, args: list[str]) -> None:
diff --git a/front/toc/ctrl.py b/front/toc/ctrl.py
index d6276c2..d679759 100644
--- a/front/toc/ctrl.py
+++ b/front/toc/ctrl.py
@@ -65,7 +65,7 @@ class TOCCtrl:
handler = COMMANDS.get(parts[0])
if handler is None:
- self.logger.info('[Client] Unknown TOC command:', parts[0])
+ self.logger.debug('[Client] Unknown TOC command:', parts[0])
return
handler(self, parts[1:])
diff --git a/front/toc/entry.py b/front/toc/entry.py
index ddfb309..b56222a 100644
--- a/front/toc/entry.py
+++ b/front/toc/entry.py
@@ -69,7 +69,7 @@ class ListenerTOC(asyncio.Protocol):
case 0x05:
pass
case _:
- self.logger.info('Recieved unknown FLAP channel:', str(channel))
+ self.logger.debug('Recieved unknown FLAP channel:', str(channel))
self.buffer = self.buffer[length + 6:]
diff --git a/front/ymsg/pager.py b/front/ymsg/pager.py
index dadecf5..92b87fe 100644
--- a/front/ymsg/pager.py
+++ b/front/ymsg/pager.py
@@ -235,7 +235,7 @@ class YMSGCtrlPager(YMSGCtrlBase):
token = qs['d'][0]
if not token:
- self.logger.info('Could not extract token from T cookie')
+ self.logger.debug('Could not extract token from T cookie')
authresp_error = int(YMSGStatus.Bad)
else:
tpl = self.backend.login_auth_service.get_token('ymsg/cookie', token)
diff --git a/settings.py b/settings.py
index 968a7f8..bce8c05 100644
--- a/settings.py
+++ b/settings.py
@@ -73,12 +73,13 @@ ENABLE_FRONT_MSIM = False
CF_REALTIME_API_KEY = ''
FORCE_HOSTS_UPDATE = False
STRESS_TEST_ACTIVE = False
-ENABLE_NAT_RELAY = True
+ENABLE_NAT_RELAY = False
# Frontend-specific settings
YAHOOHELPER_MSG = "CHANGE ME"
YMSG_TOKEN_LIFETIME = 86400
OSCAR_MOTD_ENABLED = False
+OSCAR_MOTD_TEXT = "CHANGE ME"
ICQ_LEGACY_PORT = 4000
# hand V5 clients each other's IP address and port for direct connections (file transfers, chat); off, it stays private
ICQ_DIRECT_CONNECTIONS = False