Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
poezio
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
185
Issues
185
List
Board
Labels
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
poezio
poezio
Commits
f034f7d0
Commit
f034f7d0
authored
Dec 16, 2018
by
mathieui
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into 'master'
self-ping: do not /cycle on timeout, log only See merge request
!16
parents
8a23706b
d619e0c5
Pipeline
#1842
passed with stages
in 2 minutes and 43 seconds
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
8 deletions
+35
-8
embed.py
plugins/embed.py
+1
-1
upload.py
plugins/upload.py
+1
-1
handlers.py
poezio/core/handlers.py
+8
-4
muctab.py
poezio/tabs/muctab.py
+25
-2
No files found.
plugins/embed.py
View file @
f034f7d0
...
...
@@ -20,7 +20,7 @@ from poezio.theming import get_theme
class
Plugin
(
BasePlugin
):
def
init
(
self
):
for
tab_t
in
[
tabs
.
MucTab
,
tabs
.
ConversationTab
,
tabs
.
PrivateTab
]:
for
tab_t
in
[
tabs
.
MucTab
,
tabs
.
StaticConversationTab
,
tabs
.
Dynamic
ConversationTab
,
tabs
.
PrivateTab
]:
self
.
api
.
add_tab_command
(
tab_t
,
'embed'
,
...
...
plugins/upload.py
View file @
f034f7d0
...
...
@@ -33,7 +33,7 @@ class Plugin(BasePlugin):
def
init
(
self
):
if
not
self
.
core
.
xmpp
[
'xep_0363'
]:
raise
Exception
(
'slixmpp XEP-0363 plugin failed to load'
)
for
_class
in
(
tabs
.
PrivateTab
,
tabs
.
ConversationTab
,
tabs
.
MucTab
):
for
_class
in
(
tabs
.
PrivateTab
,
tabs
.
StaticConversationTab
,
tabs
.
Dynamic
ConversationTab
,
tabs
.
MucTab
):
self
.
api
.
add_tab_command
(
_class
,
'upload'
,
...
...
poezio/core/handlers.py
View file @
f034f7d0
...
...
@@ -1068,7 +1068,8 @@ class HandlerCore:
'{http://jabber.org/protocol/muc#user}x'
)
is
not
None
:
return
jid
=
presence
[
'from'
]
if
not
logger
.
log_roster_change
(
jid
.
bare
,
'got offline'
):
status
=
presence
[
'status'
]
if
not
logger
.
log_roster_change
(
jid
.
bare
,
'got offline{}'
.
format
(
' ({})'
.
format
(
status
)
if
status
else
''
)):
self
.
core
.
information
(
'Unable to write in the log file'
,
'Error'
)
# If a resource got offline, display the message in the conversation with this
# precise resource.
...
...
@@ -1078,12 +1079,15 @@ class HandlerCore:
roster
.
connected
-=
1
if
contact
.
name
:
name
=
contact
.
name
offline_msg
=
'
%
s is
\x19
1}offline'
%
name
if
status
:
offline_msg
+=
' (
\x19
o
%
s
\x19
1})'
%
status
if
jid
.
resource
:
self
.
core
.
add_information_message_to_conversation_tab
(
jid
.
full
,
'
\x19
5}
%
s is
\x19
1}offline'
%
name
)
jid
.
full
,
'
\x19
5}
'
+
offline_msg
)
self
.
core
.
add_information_message_to_conversation_tab
(
jid
.
bare
,
'
\x19
5}
%
s is
\x19
1}offline'
%
name
)
self
.
core
.
information
(
'
\x19
3}
%
s
\x19
5}is
\x19
1}offline'
%
name
,
jid
.
bare
,
'
\x19
5}
'
+
offline_msg
)
self
.
core
.
information
(
'
\x19
3}
'
+
offline_msg
,
'Roster'
)
roster
.
modified
()
if
isinstance
(
self
.
core
.
tabs
.
current_tab
,
tabs
.
RosterInfoTab
):
...
...
poezio/tabs/muctab.py
View file @
f034f7d0
...
...
@@ -53,6 +53,7 @@ class MucTab(ChatTab):
plugin_commands
=
{}
# type: Dict[str, Command]
plugin_keys
=
{}
# type: Dict[str, Callable]
additional_information
=
{}
# type: Dict[str, Callable[[str], str]]
lagged
=
False
def
__init__
(
self
,
core
,
jid
,
nick
,
password
=
None
):
ChatTab
.
__init__
(
self
,
core
,
jid
)
...
...
@@ -411,6 +412,8 @@ class MucTab(ChatTab):
if
self
.
joined
:
if
self
.
input
.
text
:
self
.
state
=
'nonempty'
elif
self
.
lagged
:
self
.
state
=
'disconnected'
else
:
self
.
state
=
'normal'
else
:
...
...
@@ -436,6 +439,7 @@ class MucTab(ChatTab):
"""
Handle MUC presence
"""
self
.
reset_lag
()
status_codes
=
set
()
for
status_code
in
presence
.
xml
.
findall
(
STATUS_XPATH
):
status_codes
.
add
(
status_code
.
attrib
[
'code'
])
...
...
@@ -1143,6 +1147,7 @@ class MucTab(ChatTab):
self
.
command_cycle
(
iq
[
"error"
][
"text"
]
or
"not in this room"
)
self
.
core
.
refresh_window
()
else
:
# Re-send a self-ping in a few seconds
self
.
reset_lag
()
self
.
enable_self_ping_event
()
def
search_for_color
(
self
,
nick
):
...
...
@@ -1162,8 +1167,26 @@ class MucTab(ChatTab):
return
color
def
on_self_ping_failed
(
self
,
iq
):
self
.
command_cycle
(
"the MUC server is not responding"
)
self
.
core
.
refresh_window
()
if
not
self
.
lagged
:
self
.
lagged
=
True
info_text
=
dump_tuple
(
get_theme
()
.
COLOR_INFORMATION_TEXT
)
self
.
_text_buffer
.
add_message
(
"
\x19
%
s}MUC service not responding."
%
info_text
)
self
.
_state
=
'disconnected'
self
.
core
.
refresh_window
()
self
.
enable_self_ping_event
()
def
reset_lag
(
self
):
if
self
.
lagged
:
self
.
lagged
=
False
info_text
=
dump_tuple
(
get_theme
()
.
COLOR_INFORMATION_TEXT
)
self
.
_text_buffer
.
add_message
(
"
\x19
%
s}MUC service is responding again."
%
info_text
)
if
self
!=
self
.
core
.
tabs
.
current_tab
:
self
.
_state
=
'joined'
else
:
self
.
_state
=
'normal'
self
.
core
.
refresh_window
()
########################## UI ONLY #####################################
...
...
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