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
gajim
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
194
Issues
194
List
Boards
Labels
Service Desk
Milestones
Merge Requests
20
Merge Requests
20
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
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
gajim
gajim
Commits
ceb21257
Commit
ceb21257
authored
Aug 22, 2014
by
Yann Leboulanger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add /ping command in groupchat to ping occupants
parent
7c1e34d6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
7 deletions
+30
-7
src/chat_control.py
src/chat_control.py
+9
-5
src/command_system/implementation/standard.py
src/command_system/implementation/standard.py
+9
-0
src/common/connection.py
src/common/connection.py
+3
-2
src/groupchat_control.py
src/groupchat_control.py
+9
-0
No files found.
src/chat_control.py
View file @
ceb21257
...
...
@@ -208,11 +208,6 @@ def _nec_ping_sent(self, obj):
return
self
.
print_conversation
(
_
(
'Ping?'
),
'status'
)
def
_nec_ping_reply
(
self
,
obj
):
if
self
.
contact
!=
obj
.
contact
:
return
self
.
print_conversation
(
_
(
'Pong! (%s s.)'
)
%
obj
.
seconds
,
'status'
)
def
_nec_ping_error
(
self
,
obj
):
if
self
.
contact
!=
obj
.
contact
:
return
...
...
@@ -2850,6 +2845,15 @@ def _nec_caps_received(self, obj):
return
self
.
update_ui
()
def
_nec_ping_reply
(
self
,
obj
):
if
obj
.
control
:
if
obj
.
control
!=
self
:
return
else
:
if
self
.
contact
!=
obj
.
contact
:
return
self
.
print_conversation
(
_
(
'Pong! (%s s.)'
)
%
obj
.
seconds
,
'status'
)
def
set_control_active
(
self
,
state
):
ChatControlBase
.
set_control_active
(
self
,
state
)
# send chatstate inactive to the one we're leaving
...
...
src/command_system/implementation/standard.py
View file @
ceb21257
...
...
@@ -410,3 +410,12 @@ def block(self, who):
@
doc
(
_
(
"Allow an occupant to send you public or private messages"
))
def
unblock
(
self
,
who
):
self
.
on_unblock
(
None
,
who
)
@
command
@
doc
(
_
(
"Send a ping to the contact"
))
def
ping
(
self
,
nick
):
if
self
.
account
==
gajim
.
ZEROCONF_ACC_NAME
:
raise
CommandError
(
_
(
'Command is not supported for zeroconf accounts'
))
gc_c
=
gajim
.
contacts
.
get_gc_contact
(
self
.
account
,
self
.
room_jid
,
nick
)
gajim
.
connections
[
self
.
account
].
sendPing
(
gc_c
,
self
)
src/common/connection.py
View file @
ceb21257
...
...
@@ -1551,10 +1551,11 @@ def _on_xmpp_ping_answer(self, iq_obj):
assert
id_
==
self
.
awaiting_xmpp_ping_id
self
.
awaiting_xmpp_ping_id
=
None
def
sendPing
(
self
,
pingTo
=
None
):
def
sendPing
(
self
,
pingTo
=
None
,
control
=
None
):
"""
Send XMPP Ping (XEP-0199) request. If pingTo is not set, ping is sent to
server to detect connection failure at application level
If control is set, display result there
"""
if
not
gajim
.
account_is_connected
(
self
.
name
):
return
...
...
@@ -1577,7 +1578,7 @@ def _on_response(resp):
return
timeDiff
=
round
(
timePong
-
timePing
,
2
)
gajim
.
nec
.
push_incoming_event
(
PingReplyEvent
(
None
,
conn
=
self
,
contact
=
pingTo
,
seconds
=
timeDiff
))
contact
=
pingTo
,
seconds
=
timeDiff
,
control
=
control
))
if
pingTo
:
timePing
=
time_time
()
self
.
connection
.
SendAndCallForResponse
(
iq
,
_on_response
)
...
...
src/groupchat_control.py
View file @
ceb21257
...
...
@@ -1375,6 +1375,15 @@ def _nec_decrypted_message_received(self, obj):
obj
.
xhtml
,
self
.
session
,
msg_id
=
obj
.
msg_id
,
encrypted
=
obj
.
encrypted
,
displaymarking
=
obj
.
displaymarking
)
def
_nec_ping_reply
(
self
,
obj
):
if
obj
.
control
:
if
obj
.
control
!=
self
:
return
else
:
if
self
.
contact
!=
obj
.
contact
:
return
self
.
print_conversation
(
_
(
'Pong! (%s s.)'
)
%
obj
.
seconds
)
def
got_connected
(
self
):
# Make autorejoin stop.
if
self
.
autorejoin
:
...
...
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