@@ -415,10 +415,8 @@ async def _async_iter_from(_iter_from):
415
415
else :
416
416
file_path = ''
417
417
418
- # We will use it as flags, the first
419
- # is for 'include', the second is for
420
- # 'exclude'. Both should be True to
421
- # match SearchFilter filters.
418
+ # We will use it as flags, the first is for 'include', the second is
419
+ # for 'exclude'. Both should be True to match SearchFilter filters.
422
420
yield_result = [True , True ]
423
421
424
422
for indx , filter in enumerate ((sf .in_filters , sf .ex_filters )):
@@ -433,6 +431,42 @@ async def _async_iter_from(_iter_from):
433
431
yield_result [indx ] = False
434
432
break
435
433
434
+ for sender in filter ['sender' ]:
435
+ # If sender is int, then it we check only against
436
+ # the 'sender_id', if str, we check against the
437
+ # 'sender', and if sender isnumeric(), we convert
438
+ # to int and also check against 'sender_id'
439
+
440
+ # sender and sender_id is presented only in RemoteBox
441
+ # files and only in Box channels with Sign Messages
442
+ # -> Show Author Profiles enabled. If file doesn't
443
+ # have sender, then always skip a file.
444
+
445
+ file_sender_id , _check = getattr (file , 'sender_id' , None ), False
446
+
447
+ if isinstance (sender , int ):
448
+ if sender == file_sender :
449
+ _check = True
450
+
451
+ if isinstance (sender , str ):
452
+ file_sender = getattr (file , 'sender' ) or ''
453
+
454
+ if in_func (sender , file_sender ):
455
+ _check = True
456
+ else :
457
+ if sender .isnumeric () and int (sender ) == file_sender_id :
458
+ _check = True
459
+
460
+ if _check :
461
+ if indx == 1 :
462
+ yield_result [indx ] = False
463
+ break
464
+ else :
465
+ if filter ['sender' ]:
466
+ if indx == 0 :
467
+ yield_result [indx ] = False
468
+ break
469
+
436
470
for minor_version in filter ['minor_version' ]:
437
471
if minor_version == file .minor_version :
438
472
if indx == 1 :
0 commit comments