Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
briar_repl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fphemeral
briar_repl
Commits
0ff56e74
Commit
0ff56e74
authored
4 years ago
by
fphemeral
Browse files
Options
Downloads
Patches
Plain Diff
add show contacts detailed
parent
b4754a65
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
briar_repl/contacts.py
+14
-3
14 additions, 3 deletions
briar_repl/contacts.py
with
14 additions
and
3 deletions
briar_repl/contacts.py
+
14
−
3
View file @
0ff56e74
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
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment