Fix mapping Telegram<->IRC for self user
patch 6161cf3d257e2a0b1497f9dd283b0b8d13903835
Author: E. Bosch <presidev@AT@gmail.com>
Date: Tue Feb 2 23:52:41 CET 2021
* Fix mapping Telegram<->IRC for self user
hunk ./irc.py 162
- if nick not in self.iid_to_tid:
+ target = self.tg.tg_username if nick == user.irc_nick else nick
+ tgt = target.lower()
+
+ if tgt not in self.iid_to_tid:
hunk ./irc.py 168
- telegram_id = self.iid_to_tid[nick]
+ telegram_id = self.iid_to_tid[tgt]
hunk ./telegram.py 29
+ self.id = None
+ self.tg_username = None
hunk ./telegram.py 69
+ tg_user = await self.telegram_client.get_me()
+ self.id = tg_user.id
+ self.tg_username = self.get_telegram_nick(tg_user)
hunk ./telegram.py 75
- if not chat.is_self:
- self.set_ircuser_from_telegram(chat)
+ self.set_ircuser_from_telegram(chat)
hunk ./telegram.py 82
- irc_user = IRCUser(None, ('Telegram',), tg_nick, user.id, self.get_telegram_display_name(user))
- self.irc.users[tg_nick.lower()] = irc_user
+ tg_ni = tg_nick.lower()
+ if not user.is_self:
+ irc_user = IRCUser(None, ('Telegram',), tg_nick, user.id, self.get_telegram_display_name(user))
+ self.irc.users[tg_ni] = irc_user
hunk ./telegram.py 87
- self.irc.iid_to_tid[tg_nick.lower()] = user.id
+ self.irc.iid_to_tid[tg_ni] = user.id
hunk ./telegram.py 128
+ if nick == self.tg_username: return None
hunk ./telegram.py 174
+ usr = user if user else irc_user
hunk ./telegram.py 176
- user.get_irc_mask(), irc_user.irc_nick, message
+ usr.get_irc_mask(), irc_user.irc_nick, message
hunk ./telegram.py 205
+ usr = user if user else irc_user
hunk ./telegram.py 207
- user.get_irc_mask(), channel, message
+ usr.get_irc_mask(), channel, message