Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Peter Shkenev
gajim
Commits
a09c2bed
Commit
a09c2bed
authored
19 years ago
by
nkour
Browse files
Options
Downloads
Patches
Plain Diff
if shift check if sth was written in textview before sending composing
parent
39049529
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/tabbed_chat_window.py
+25
-10
25 additions, 10 deletions
src/tabbed_chat_window.py
with
25 additions
and
10 deletions
src/tabbed_chat_window.py
+
25
−
10
View file @
a09c2bed
...
...
@@ -372,7 +372,7 @@ def handle_incoming_chatstate(self, account, jid, chatstate):
def
check_for_possible_paused_chatstate
(
self
,
contact
):
'''
did we move mouse of that window or kbd activity in that window
in the last 5 seconds?
if yes we go active
if yes we go active
for mouse, composing for kbd
if no we go paused if we were previously composing
'''
current_state
=
self
.
chatstates
[
contact
.
jid
]
if
current_state
==
False
:
# jid doesn't support chatstates
...
...
@@ -399,8 +399,8 @@ def check_for_possible_paused_chatstate(self, contact):
def
check_for_possible_inactive_chatstate
(
self
,
contact
):
'''
did we move mouse over that window or kbd activity in that window
in the last 30 seconds?
if yes we go active
if not already
if no we go inactive
if not already
'''
if yes we go active
if no we go inactive
'''
current_state
=
self
.
chatstates
[
contact
.
jid
]
if
current_state
==
False
:
# jid doesn't support chatstates
return
False
# stop looping
...
...
@@ -424,8 +424,8 @@ def on_message_textview_key_press_event(self, widget, event):
and printed in the conversation
"""
jid
=
self
.
get_active_jid
()
conversation_textview
=
self
.
xmls
[
jid
].
get_widget
(
'
conversation_textview
'
)
message_buffer
=
widget
.
get_buffer
()
conversation_textview
=
widget
message_buffer
=
conversation_textview
.
get_buffer
()
start_iter
,
end_iter
=
message_buffer
.
get_bounds
()
message
=
message_buffer
.
get_text
(
start_iter
,
end_iter
,
False
)
...
...
@@ -461,8 +461,8 @@ def on_message_textview_key_press_event(self, widget, event):
elif
(
event
.
state
&
gtk
.
gdk
.
SHIFT_MASK
):
return
False
if
gajim
.
connections
[
self
.
account
].
connected
<
2
:
#we are not connected
dialogs
.
ErrorDialog
(
_
(
"
A connection is not available
"
),
_
(
"
Your message can
'
t be sent until you are connected.
"
)).
get_response
()
dialogs
.
ErrorDialog
(
_
(
'
A connection is not available
'
),
_
(
'
Your message can
no
t be sent until you are connected.
'
)).
get_response
()
return
True
# send the message
...
...
@@ -476,9 +476,24 @@ def on_message_textview_key_press_event(self, widget, event):
# if really composing (eg. no Ctrl, or alt modifier, send chatstate
if
not
(
event
.
state
&
gtk
.
gdk
.
CONTROL_MASK
)
and
not
\
(
event
.
state
&
gtk
.
gdk
.
MOD1_MASK
):
self
.
kbd_activity_in_last_5_secs
=
True
self
.
kbd_activity_in_last_30_secs
=
True
self
.
send_chatstate
(
'
composing
'
)
# but what about Shift+ sth ?
# Shift + 'a' = A so we're composing
# Shift + Escape is not composing, so we let the gtk+ decide
# in an workaround way (we could also get somehow the listed shortcuts
# but I don't know if it's possible)
chars_no
=
len
(
message
)
gobject
.
timeout_add
(
1000
,
self
.
on_timeout_for_check_composing
,
message_buffer
,
jid
,
chars_no
)
def
on_timeout_for_check_composing
(
self
,
message_buffer
,
jid
,
chars_no
):
start_iter
,
end_iter
=
message_buffer
.
get_bounds
()
message
=
message_buffer
.
get_text
(
start_iter
,
end_iter
,
False
)
chars_no_after_one_sec
=
len
(
message
)
if
chars_no
!=
chars_no_after_one_sec
:
# so GTK+ decided key_press was for writing..
self
.
kbd_activity_in_last_5_secs
=
True
self
.
kbd_activity_in_last_30_secs
=
True
self
.
send_chatstate
(
'
composing
'
)
def
send_chatstate
(
self
,
state
,
jid
=
None
):
'''
sends our chatstate as STANDLONE chat state message (eg. no body)
...
...
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