[SVN] bump to version 0.2.1
[UPD] roster exchange (XEP-0144) now is not mandatory since not all clients supports it; it is optional and configurable
This commit is contained in:
@@ -10,6 +10,8 @@ CONFIG = {
|
||||
'server': 'localhost',
|
||||
'port': '8889',
|
||||
|
||||
'xmpp_use_roster_exchange': True, # use XEP-0144 to import roster from Telegram
|
||||
|
||||
'tg_api_id': '17349', # Telegram Desktop (GitHub)
|
||||
'tg_api_hash': '344583e45741c457fe1862106095a5eb',
|
||||
|
||||
|
||||
@@ -427,9 +427,7 @@ class TelegramGateClient(TelegramClient):
|
||||
|
||||
# group converted to supergroup
|
||||
elif type(message.action) in [MessageActionChatMigrateTo, MessageActionChannelMigrateFrom]:
|
||||
print('--ACHTUNG!--')
|
||||
print(message)
|
||||
#del(self.xmpp_gate.tg_dialogs[self.jid]['groups'][message.chat_id])
|
||||
pass
|
||||
|
||||
return msg
|
||||
|
||||
|
||||
@@ -433,7 +433,18 @@ class XMPPTelegram(ComponentXMPP):
|
||||
rawxml = rawxml + "</x>"
|
||||
message.appendxml(ET.fromstring(rawxml))
|
||||
|
||||
return message
|
||||
self.send(message)
|
||||
|
||||
def roster_fill(self, tojid, contacts):
|
||||
|
||||
for jid, nick in contacts.items():
|
||||
presence = sleekxmpp.Presence()
|
||||
presence['from'] = jid
|
||||
presence['to'] = tojid
|
||||
presence['type'] = 'subscribe'
|
||||
presence.appendxml(ET.fromstring("<nick xmlns='http://jabber.org/protocol/nick'>%s</nick>" % nick))
|
||||
self.send(presence)
|
||||
|
||||
|
||||
def tg_process_dialogs(self, jid):
|
||||
|
||||
@@ -549,8 +560,10 @@ class XMPPTelegram(ComponentXMPP):
|
||||
self.send_presence(pto=jid, pfrom=c_jid)
|
||||
|
||||
if len(dlgs.dialogs) == 0: # Если все диалоги получены - прерываем цикл
|
||||
rosterxchange = self.roster_exchange(jid, self.contact_list[jid])
|
||||
self.send(rosterxchange)
|
||||
if self.config['xmpp_use_roster_exchange']:
|
||||
self.roster_exchange(jid, self.contact_list[jid])
|
||||
else:
|
||||
self.roster_fill(jid, self.contact_list[jid])
|
||||
break
|
||||
else: # Иначе строим оффсеты
|
||||
last_msg_id = dlgs.dialogs[-1].top_message # Нужен последний id сообщения. Наркоманы.
|
||||
|
||||
Reference in New Issue
Block a user