Commit 7ea48f4c authored by Madhur Garg's avatar Madhur Garg

Removed /mam command as it is implemented in mam_tab (WIP:37)

parent 8b4cc912
......@@ -501,11 +501,6 @@ class ChatTab(Tab):
self.command_scrollback,
usage="end home clear status goto <+|-linecount>|<linenum>|<timestamp>",
shortdesc='Scrollback to the given line number, message, or clear the buffer.')
self.register_command(
'mam',
self.command_mam,
usage="[start_timestamp [end_timestamp]]",
shortdesc='Query an archive of messages using MAM.')
self.commands['sb'] = self.commands['scrollback']
self.register_command(
'xhtml',
......@@ -925,34 +920,6 @@ class ChatTab(Tab):
# new_date is the timestamp for which the user has queried.
self.goto_build_lines(new_date)
@command_args_parser.quoted(0, 2)
def command_mam(self, args):
"""
Query an archive of messages using MAM.
/mam [start_timestamp [end_timestamp]]
"""
remote_jid = self.jid
top = False
end = datetime.now()
end = datetime.strftime(end, '%Y-%m-%dT%H:%M:%SZ')
start = datetime.strptime(end, '%Y-%m-%dT%H:%M:%SZ')
# Default start date is 10 days past the current day.
start = start + timedelta(days=-10)
start = datetime.strftime(start, '%Y-%m-%dT%H:%M:%SZ')
# Format for start and end timestamp is [dd:mm:yyyy]
if len(args) >= 1:
try:
start = datetime.strptime(args[0], '%d:%m:%Y')
start = datetime.strftime(start, '%Y-%m-%dT%H:%M:%SZ')
if len(args) == 2:
end = datetime.strptime(args[1], '%d:%m:%Y')
end = datetime.strftime(end, '%Y-%m-%dT%H:%M:%SZ')
except ValueError:
self.core.information("Please enter a valid JID in [dd:mm:yyyy] format.", "Error")
asyncio.ensure_future(mam.query(self, remote_jid, start, end, top))
def on_line_up(self):
return self.text_win.scroll_up(1)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment