patch 34113fbedae0bddb28721fc1d5a879ef9df9ca89
Author: E. Bosch <presidev@AT@gmail.com>
Date: Fri Feb 4 18:21:49 CET 2022
* irc: Handle messages to inexistent users and to users in other IRC
connections (these messages won't be sent by design)
diff -rN -u old-irgramd/irc.py new-irgramd/irc.py
--- old-irgramd/irc.py 2024-11-22 16:13:07.581593000 +0100
+++ new-irgramd/irc.py 2024-11-22 16:13:07.581593000 +0100
@@ -363,11 +363,11 @@
else:
tgt = tgl
- if tgt not in self.iid_to_tid:
- print('TODO: handle error')
-
- telegram_id = self.iid_to_tid[tgt]
- await self.tg.telegram_client.send_message(telegram_id, message)
+ if tgt in self.iid_to_tid:
+ telegram_id = self.iid_to_tid[tgt]
+ await self.tg.telegram_client.send_message(telegram_id, message)
+ else:
+ await self.reply_code(user, 'ERR_NOSUCHNICK', (target,))
async def handle_irc_quit(self, user, reason):
self.logger.debug('Handling TOPIC: %s', reason)
diff -rN -u old-irgramd/irc_replies.py new-irgramd/irc_replies.py
--- old-irgramd/irc_replies.py 2024-11-22 16:13:07.581593000 +0100
+++ new-irgramd/irc_replies.py 2024-11-22 16:13:07.581593000 +0100
@@ -31,7 +31,7 @@
'RPL_MOTDSTART': ('375', ':- {} Message of the day - '),
'RPL_MOTD': ('372', ':- {}'),
'RPL_ENDOFMOTD': ('376', 'End of MOTD command'),
- 'ERR_NOSUCHNICK': ('401', '{} :Nick not found'),
+ 'ERR_NOSUCHNICK': ('401', '{} :Nick not found or available'),
'ERR_NOSUCHSERVER': ('402', '{} :Target not found'),
'ERR_NOSUCHCHANNEL': ('403', '{} :Channel not found'),
'ERR_CANNOTSENDTOCHAN': ('404', 'Cannot send to channel'),