Skip to content
Snippets Groups Projects
Commit 0ff56e74 authored by fphemeral's avatar fphemeral
Browse files

add show contacts detailed

parent b4754a65
No related branches found
No related tags found
No related merge requests found
import datetime
from pprint import pprint from pprint import pprint
import colorful as col import colorful as col
from .start_up import URLS from .start_up import URLS
...@@ -40,7 +41,7 @@ async def init_contacts(): ...@@ -40,7 +41,7 @@ async def init_contacts():
all_contacts_by_alias[alias_or_name] = contact all_contacts_by_alias[alias_or_name] = contact
async def show_contacts(): async def show_contacts(detailed=None):
""" """
lists your contacts lists your contacts
""" """
...@@ -53,8 +54,18 @@ async def show_contacts(): ...@@ -53,8 +54,18 @@ async def show_contacts():
for contact in contacts_by_last_act: for contact in contacts_by_last_act:
online = col.bold_chartreuse("online") if contact.is_online else "" online = col.bold_chartreuse("online") if contact.is_online else ""
unread_count = contact.unread_msgs if contact.unread_msgs else '' unread_count = contact.unread_msgs if contact.unread_msgs else ''
print(f"{contact.cid:4}: {contact.alias} {online} {col.bold_orange(unread_count)}") last_act = datetime.datetime.fromtimestamp(contact.last_activity / 1000).strftime('%Y-%m-%d %H:%M')
return if detailed:
print(f"{contact.cid:4} {last_act}: {contact.alias} {online} {col.bold_orange(unread_count)}")
else:
print(f" {contact.alias} {online} {col.bold_orange(unread_count)}")
async def show_contacts_detailed():
"""
lists your contacts with details
"""
await show_contacts(detailed=True)
async def show_contact_info(contact_str): async def show_contact_info(contact_str):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment