Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
poezio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Maxime Buquet
poezio
Commits
ce9d59f1
Commit
ce9d59f1
authored
May 31, 2020
by
Maxime Buquet
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'type-bookmarks' into 'master'
Type bookmarks See merge request
poezio/poezio!138
parents
ab9108e0
21c45ff7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
7 deletions
+9
-7
poezio/bookmarks.py
poezio/bookmarks.py
+5
-3
poezio/core/commands.py
poezio/core/commands.py
+3
-3
poezio/tabs/bookmarkstab.py
poezio/tabs/bookmarkstab.py
+1
-1
No files found.
poezio/bookmarks.py
View file @
ce9d59f1
...
...
@@ -30,7 +30,7 @@ Adding a remote bookmark:
import
functools
import
logging
from
typing
import
Optional
,
List
,
Union
from
typing
import
Optional
,
List
,
Literal
,
Union
from
slixmpp
import
InvalidJID
,
JID
from
slixmpp.plugins.xep_0048
import
Bookmarks
,
Conference
,
URL
...
...
@@ -39,6 +39,8 @@ from poezio.config import config
log
=
logging
.
getLogger
(
__name__
)
Method
=
Union
[
Literal
[
'local'
],
Literal
[
'remote'
]]
class
Bookmark
:
def
__init__
(
self
,
jid
:
Union
[
JID
,
str
],
...
...
@@ -46,7 +48,7 @@ class Bookmark:
autojoin
=
False
,
nick
:
Optional
[
str
]
=
None
,
password
:
Optional
[
str
]
=
None
,
method
=
'local'
)
->
None
:
method
:
Method
=
'local'
)
->
None
:
try
:
if
isinstance
(
jid
,
JID
):
self
.
_jid
=
jid
...
...
@@ -82,7 +84,7 @@ class Bookmark:
return
self
.
_method
@
method
.
setter
def
method
(
self
,
value
:
str
):
def
method
(
self
,
value
:
Method
):
if
value
not
in
(
'local'
,
'remote'
):
log
.
debug
(
'Could not set bookmark storing method: %s'
,
value
)
return
...
...
poezio/core/commands.py
View file @
ce9d59f1
...
...
@@ -18,7 +18,7 @@ from poezio import common
from
poezio
import
pep
from
poezio
import
tabs
from
poezio
import
multiuserchat
as
muc
from
poezio.bookmarks
import
Bookmark
from
poezio.bookmarks
import
Bookmark
,
Method
as
BookmarkMethod
from
poezio.common
import
safeJID
from
poezio.config
import
config
,
DEFAULT_CONFIG
,
options
as
config_opts
from
poezio.contact
import
Contact
,
Resource
...
...
@@ -444,7 +444,7 @@ class CommandCore:
self
.
_add_bookmark
(
jid
,
autojoin
,
password
,
'remote'
)
def
_add_bookmark
(
self
,
jid
,
autojoin
,
password
,
method
)
:
def
_add_bookmark
(
self
,
jid
:
str
,
autojoin
:
bool
,
password
:
str
,
method
:
BookmarkMethod
)
->
None
:
nick
=
None
if
not
jid
:
tab
=
self
.
core
.
tabs
.
current_tab
...
...
@@ -478,7 +478,7 @@ class CommandCore:
self
.
core
.
bookmarks
.
save_remote
(
self
.
core
.
xmpp
,
self
.
core
.
handler
.
on_bookmark_result
)
def
_add_wildcard_bookmarks
(
self
,
method
):
def
_add_wildcard_bookmarks
(
self
,
method
:
BookmarkMethod
):
new_bookmarks
=
[]
for
tab
in
self
.
core
.
get_tabs
(
tabs
.
MucTab
):
bookmark
=
self
.
core
.
bookmarks
[
tab
.
jid
.
bare
]
...
...
poezio/tabs/bookmarkstab.py
View file @
ce9d59f1
...
...
@@ -95,7 +95,7 @@ class BookmarksTab(Tab):
def
send_cb
(
success
):
if
success
:
self
.
core
.
information
(
'Bookmarks saved
.
'
,
'Info'
)
self
.
core
.
information
(
'Bookmarks saved'
,
'Info'
)
else
:
self
.
core
.
information
(
'Remote bookmarks not saved.'
,
'Error'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment