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
178
Issues
178
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
poezio
poezio
Commits
c13ae1b9
Commit
c13ae1b9
authored
Sep 29, 2018
by
Link Mauve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Print the error given by the server when /bookmark fails.
parent
2428084c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
20 deletions
+22
-20
poezio/core/commands.py
poezio/core/commands.py
+4
-16
poezio/core/handlers.py
poezio/core/handlers.py
+18
-4
No files found.
poezio/core/commands.py
View file @
c13ae1b9
...
...
@@ -449,14 +449,9 @@ class CommandCore:
if
password
:
bookmark
.
password
=
password
def
callback
(
iq
):
if
iq
[
"type"
]
!=
"error"
:
self
.
core
.
information
(
'Bookmark added.'
,
'Info'
)
else
:
self
.
core
.
information
(
"Could not add the bookmarks."
,
"Info"
)
self
.
core
.
bookmarks
.
save_local
()
self
.
core
.
bookmarks
.
save_remote
(
self
.
core
.
xmpp
,
callback
)
self
.
core
.
bookmarks
.
save_remote
(
self
.
core
.
xmpp
,
self
.
core
.
handler
.
on_bookmark_result
)
def
_add_wildcard_bookmarks
(
self
,
method
):
new_bookmarks
=
[]
...
...
@@ -471,16 +466,9 @@ class CommandCore:
self
.
core
.
bookmarks
.
remove
(
bookmark
)
new_bookmarks
.
extend
(
self
.
core
.
bookmarks
.
bookmarks
)
self
.
core
.
bookmarks
.
set
(
new_bookmarks
)
def
_cb
(
iq
):
if
iq
[
"type"
]
!=
"error"
:
self
.
core
.
information
(
"Bookmarks saved."
,
"Info"
)
else
:
self
.
core
.
information
(
"Could not save the remote bookmarks."
,
"Info"
)
self
.
core
.
bookmarks
.
save_local
()
self
.
core
.
bookmarks
.
save_remote
(
self
.
core
.
xmpp
,
_cb
)
self
.
core
.
bookmarks
.
save_remote
(
self
.
core
.
xmpp
,
self
.
core
.
handler
.
on_bookmark_result
)
@
command_args_parser
.
ignored
def
bookmarks
(
self
):
...
...
poezio/core/handlers.py
View file @
c13ae1b9
...
...
@@ -891,16 +891,20 @@ class HandlerCore:
_composing_tab_state
(
tab
,
state
)
self
.
core
.
refresh_tab_win
()
@
staticmethod
def
_format_error
(
error
):
error_condition
=
error
[
'condition'
]
error_text
=
error
[
'text'
]
return
'%s: %s'
%
(
error_condition
,
error_text
)
if
error_text
else
error_condition
def
on_version_result
(
self
,
iq
):
"""
Handle the result of a /version command.
"""
jid
=
iq
[
'from'
]
if
iq
[
'type'
]
==
'error'
:
error_condition
=
iq
[
'error'
][
'condition'
]
error_text
=
iq
[
'error'
][
'text'
]
reply
=
'%s: %s'
%
(
error_condition
,
error_text
)
if
error_text
else
error_condition
reply
=
self
.
_format_error
(
iq
[
'error'
])
return
self
.
core
.
information
(
'Could not get the software '
'version from %s: %s'
%
(
jid
,
reply
),
'Warning'
)
...
...
@@ -911,6 +915,16 @@ class HandlerCore:
'an unknown platform'
))
self
.
core
.
information
(
version
,
'Info'
)
def
on_bookmark_result
(
self
,
iq
):
"""
Handle the result of a /bookmark commands.
"""
if
iq
[
'type'
]
==
'error'
:
reply
=
self
.
_format_error
(
iq
[
'error'
])
return
self
.
core
.
information
(
'Could not set the remote bookmarks: %s'
%
reply
,
'Warning'
)
self
.
core
.
information
(
'Bookmarks saved'
,
'Info'
)
### subscription-related handlers ###
def
on_roster_update
(
self
,
iq
):
...
...
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