feat: show relay NOTICE

This commit is contained in:
Vlad Stan 2023-06-30 11:46:47 +03:00
parent f244f60c56
commit 1601f71b03
6 changed files with 44 additions and 10 deletions

View file

@ -6,7 +6,7 @@ import time
from loguru import logger
from .filter import Filters
from .message_pool import MessagePool
from .message_pool import MessagePool, NoticeMessage
from .relay import Relay, RelayPolicy
from .subscription import Subscription
@ -80,6 +80,11 @@ class RelayManager:
if relay.policy.should_write:
relay.publish(message)
def handle_notice(self, notice: NoticeMessage):
relay = next((r for r in self.relays.values() if r.url == notice.url))
if relay:
relay.add_notice(notice.content)
def _open_connection(self, relay: Relay, ssl_options: dict = None, proxy: dict = None):
self.threads[relay.url] = threading.Thread(
target=relay.connect,