diff --git a/packetserver/http/routers/send.py b/packetserver/http/routers/send.py index 0218861..71448f3 100644 --- a/packetserver/http/routers/send.py +++ b/packetserver/http/routers/send.py @@ -59,23 +59,19 @@ async def send_message( users_dict = root.get('users', {}) # Prepare recipients - to_list = payload.to - to_tuple = tuple(to_list) - if "ALL" in to_list: - to_tuple = ("ALL",) + to_list = [c.upper() for c in payload.to] + is_to_all = "ALL" in to_list - is_bulletin = "ALL" in to_list - - if is_bulletin: - # Bulletin: deliver to all registered users + if is_to_all: + # Deliver to all registered users valid_recipients = list(users_dict.keys()) failed_recipients = [] else: - # Private message: validate each recipient exists + # Private message validation valid_recipients = [] failed_recipients = [] for recip in to_list: - if users_dict.get(recip): + if recip in users_dict: valid_recipients.append(recip) else: failed_recipients.append(recip)