Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: skip searches by blocked users #399

Merged
merged 1 commit into from
Jan 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/aioslsk/search/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
from ..session import Session
from ..tasks import BackgroundTask, Timer
from ..transfer.interface import UploadInfoProvider
from ..user.model import BlockingFlag
from ..utils import task_counter, ticket_generator
from .model import ReceivedSearch, SearchResult, SearchRequest, SearchType

Expand Down Expand Up @@ -133,7 +134,7 @@ async def search(self, query: str) -> SearchRequest:
return request

async def search_room(self, room: Union[str, Room], query: str) -> SearchRequest:
"""Performs a search request on the specific user. The results generated
"""Performs a search request on the specific room. The results generated
by this query will stored in the returned object or can be listened to
through the :class:`.SearchResultEvent` event

Expand Down Expand Up @@ -189,6 +190,9 @@ async def _query_shares_and_reply(self, ticket: int, username: str, query: str):
logger.warning("not returning search results : no valid session was set")
return

if self._settings.users.is_blocked(username, BlockingFlag.SEARCHES):
return

visible, locked = self._shares_manager.query(
query,
username=username,
Expand Down
Loading