patch 3976770a9424b2085ba1260328b3adb5ce6b1ebe
Author: E. Bosch <presidev@AT@gmail.com>
Date: Sat Dec 2 20:41:44 CET 2023
* telegram: Add target nick in private messages sent from the self user
from another Telegram client
hunk ./service.py 80
- if id in self.tg.tid_to_iid.keys():
- name_in_irc = self.tg.tid_to_iid[id]
- else:
- name_in_irc = '<Unknown>'
+ name_in_irc = self.tg.get_irc_name_from_telegram_id(id)
+
hunk ./telegram.py 209
+ def get_irc_name_from_telegram_id(self, tid):
+ if tid in self.tid_to_iid.keys():
+ name_in_irc = self.tid_to_iid[tid]
+ else:
+ name_in_irc = '<Unknown>'
+ return name_in_irc
+
hunk ./telegram.py 588
- final_text = '[{}] {}{}'.format(mid, refwd_text, text)
+ target_mine = self.handle_target_mine(message.peer_id, user)
+
+ final_text = '[{}] {}{}{}'.format(mid, target_mine, refwd_text, text)
hunk ./telegram.py 835
+ def handle_target_mine(self, target, user):
+ # Add the target of messages sent by self user (me)
+ # received in other clients
+ target_id, target_type = self.get_peer_id_and_type(target)
+ if user is None and target_type == 'user' and target_id != self.id:
+ # self user^
+ # as sender
+ irc_id = self.get_irc_name_from_telegram_id(target_id)
+ target_mine = '[T: {}] '.format(irc_id)
+ else:
+ target_mine = ''
+ return target_mine
+