Fix "show" for threads in boobmsg
This commit is contained in:
parent
eea0eaa2d5
commit
768be7fcc6
1 changed files with 19 additions and 7 deletions
|
|
@ -27,6 +27,7 @@ from tempfile import NamedTemporaryFile
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
from weboob.core import CallErrors
|
from weboob.core import CallErrors
|
||||||
|
from weboob.capabilities.base import empty
|
||||||
from weboob.capabilities.messages import CapMessages, Message, Thread
|
from weboob.capabilities.messages import CapMessages, Message, Thread
|
||||||
from weboob.capabilities.account import CapAccount
|
from weboob.capabilities.account import CapAccount
|
||||||
from weboob.capabilities.contact import CapContact
|
from weboob.capabilities.contact import CapContact
|
||||||
|
|
@ -281,8 +282,8 @@ class Boobmsg(ReplApplication):
|
||||||
|
|
||||||
results = {}
|
results = {}
|
||||||
for field in self.do('get_account_status',
|
for field in self.do('get_account_status',
|
||||||
backends=backend_name,
|
backends=backend_name,
|
||||||
caps=CapAccount):
|
caps=CapAccount):
|
||||||
if field.backend in results:
|
if field.backend in results:
|
||||||
results[field.backend].append(field)
|
results[field.backend].append(field)
|
||||||
else:
|
else:
|
||||||
|
|
@ -419,7 +420,7 @@ class Boobmsg(ReplApplication):
|
||||||
cmd = self.do('get_thread', _id, backends=backend_name)
|
cmd = self.do('get_thread', _id, backends=backend_name)
|
||||||
self.start_format()
|
self.start_format()
|
||||||
for thread in cmd:
|
for thread in cmd:
|
||||||
if thread is not None :
|
if thread is not None:
|
||||||
for msg in thread.iter_all_messages():
|
for msg in thread.iter_all_messages():
|
||||||
self.format(msg)
|
self.format(msg)
|
||||||
|
|
||||||
|
|
@ -437,11 +438,22 @@ class Boobmsg(ReplApplication):
|
||||||
try:
|
try:
|
||||||
message = self.messages[int(arg) - 1]
|
message = self.messages[int(arg) - 1]
|
||||||
except (IndexError, ValueError):
|
except (IndexError, ValueError):
|
||||||
id, backend_name = self.parse_id(arg)
|
# The message is not is the cache, we have now two cases:
|
||||||
cmd = self.do('get_thread', id, backends=backend_name)
|
# 1) the user uses a number to get a thread in the cache
|
||||||
for thread in cmd:
|
# 2) the user gives a thread id
|
||||||
if thread is not None:
|
try:
|
||||||
|
thread = self.threads[int(arg) - 1]
|
||||||
|
if not empty(thread.root):
|
||||||
message = thread.root
|
message = thread.root
|
||||||
|
else:
|
||||||
|
for thread in self.do('get_thread', thread.id, backends=thread.backend):
|
||||||
|
if thread is not None:
|
||||||
|
message = thread.root
|
||||||
|
except (IndexError, ValueError):
|
||||||
|
_id, backend_name = self.parse_id(arg)
|
||||||
|
for thread in self.do('get_thread', _id, backends=backend_name):
|
||||||
|
if thread is not None:
|
||||||
|
message = thread.root
|
||||||
if message is not None:
|
if message is not None:
|
||||||
self.start_format()
|
self.start_format()
|
||||||
self.format(message)
|
self.format(message)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue