Fixes #2327 (used "seconds" instead)
This commit is contained in:
parent
73c8206cc7
commit
63805e59f6
3 changed files with 23 additions and 3 deletions
|
@ -1755,8 +1755,9 @@ class Core(object):
|
|||
room = room[1:]
|
||||
current_status = self.get_status()
|
||||
if tab and not tab.joined:
|
||||
seconds = (int(time.time()) - tab.last_connection) if tab.last_connection != 0 else 0
|
||||
muc.join_groupchat(self.xmpp, room, nick, password,
|
||||
histo_length, current_status.message, current_status.show)
|
||||
histo_length, current_status.message, current_status.show, seconds=seconds)
|
||||
if not tab:
|
||||
self.open_new_room(room, nick)
|
||||
muc.join_groupchat(self.xmpp, room, nick, password,
|
||||
|
|
|
@ -56,8 +56,24 @@ def change_nick(xmpp, jid, nick, status=None, show=None):
|
|||
"""
|
||||
xmpp.make_presence(pshow=show, pstatus=status, pto='%s/%s' % (jid, nick)).send()
|
||||
|
||||
def join_groupchat(xmpp, jid, nick, passwd='', maxhistory=None, status=None, show=None):
|
||||
xmpp.plugin['xep_0045'].joinMUC(jid, nick, maxhistory=maxhistory, password=passwd, pstatus=status, pshow=show)
|
||||
def join_groupchat(xmpp, jid, nick, passwd='', maxhistory=None, status=None, show=None, seconds=0):
|
||||
if not seconds:
|
||||
xmpp.plugin['xep_0045'].joinMUC(jid, nick, maxhistory=maxhistory, password=passwd, pstatus=status, pshow=show)
|
||||
else:
|
||||
# hackish but modifying the plugin is not worth it (since it is bound to be rewritten)
|
||||
stanza = xmpp.makePresence(pto="%s/%s" % (jid, nick), pstatus=status, pshow=show)
|
||||
x = ET.Element('{http://jabber.org/protocol/muc}x')
|
||||
if passwd:
|
||||
passelement = ET.Element('password')
|
||||
passelement.text = passwd
|
||||
x.append(passelement)
|
||||
history = ET.Element('history')
|
||||
history.attrib['seconds'] = str(seconds)
|
||||
x.append(history)
|
||||
stanza.append(x)
|
||||
stanza.send()
|
||||
xmpp.plugin['xep_0045'].rooms[jid] = {}
|
||||
xmpp.plugin['xep_0045'].our_nicks[jid] = nick
|
||||
|
||||
def leave_groupchat(xmpp, jid, own_nick, msg):
|
||||
"""
|
||||
|
|
|
@ -33,6 +33,7 @@ import xhtml
|
|||
import weakref
|
||||
import timed_events
|
||||
import os
|
||||
import time
|
||||
|
||||
import multiuserchat as muc
|
||||
|
||||
|
@ -584,6 +585,7 @@ class MucTab(ChatTab):
|
|||
self.info_header = windows.MucInfoWin()
|
||||
self.input = windows.MessageInput()
|
||||
self.ignores = [] # set of Users
|
||||
self.last_connection = 0
|
||||
# keys
|
||||
self.key_func['^I'] = self.completion
|
||||
self.key_func['M-u'] = self.scroll_user_list_down
|
||||
|
@ -1354,6 +1356,7 @@ class MucTab(ChatTab):
|
|||
Set the state of the room as not joined, so
|
||||
we can know if we can join it, send messages to it, etc
|
||||
"""
|
||||
self.last_connection = int(time.time())
|
||||
self.users = []
|
||||
if self is not self.core.current_tab():
|
||||
self.state = 'disconnected'
|
||||
|
|
Loading…
Reference in a new issue