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
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Weblate
gajim
Commits
1da15f17
Commit
1da15f17
authored
19 years ago
by
nkour
Browse files
Options
Downloads
Patches
Plain Diff
handle_event_msg method has a better sequence of checks. fixes #1764
parent
c0fcdeb1
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/gajim.py
+29
-20
29 additions, 20 deletions
src/gajim.py
with
29 additions
and
20 deletions
src/gajim.py
+
29
−
20
View file @
1da15f17
...
...
@@ -458,12 +458,16 @@ class Interface:
# FIXME: Msn transport (CMSN1.2.1 and PyMSN0.10) doesn't follow the JEP
# remove in 2007
# It's maybe a GC_NOTIFY (specialy for MSN gc)
self
.
handle_event_gc_notify
(
account
,
(
jid
,
array
[
1
],
array
[
2
],
array
[
3
],
None
,
None
,
None
,
None
,
None
,
None
,
None
))
self
.
handle_event_gc_notify
(
account
,
(
jid
,
array
[
1
],
array
[
2
],
array
[
3
],
None
,
None
,
None
,
None
,
None
,
None
,
None
))
def
handle_event_msg
(
self
,
account
,
array
):
# ('MSG', account, (jid, msg, time, encrypted, msg_type, subject,
# chatstate))
if
not
array
[
1
]:
# empty message text
return
jid
=
gajim
.
get_jid_without_resource
(
array
[
0
])
resource
=
gajim
.
get_resource_from_jid
(
array
[
0
])
fjid
=
jid
+
'
/
'
+
resource
...
...
@@ -473,6 +477,22 @@ class Interface:
composing_jep
=
array
[
8
]
if
jid
.
find
(
'
@
'
)
<=
0
:
jid
=
jid
.
replace
(
'
@
'
,
''
)
chat_control
=
self
.
msg_win_mgr
.
get_control
(
jid
,
account
)
first
=
False
if
not
chat_control
and
not
gajim
.
awaiting_events
[
account
].
has_key
(
jid
):
first
=
True
# array: (contact, msg, time, encrypted, msg_type, subject)
self
.
roster
.
on_message
(
jid
,
array
[
1
],
array
[
2
],
account
,
array
[
3
],
msg_type
,
array
[
5
],
resource
)
if
gajim
.
config
.
get_per
(
'
soundevents
'
,
'
first_message_received
'
,
'
enabled
'
)
and
first
:
helpers
.
play_sound
(
'
first_message_received
'
)
if
gajim
.
config
.
get_per
(
'
soundevents
'
,
'
next_message_received
'
,
'
enabled
'
)
and
not
first
:
helpers
.
play_sound
(
'
next_message_received
'
)
show_notification
=
False
if
gajim
.
config
.
get
(
'
notify_on_new_message
'
):
...
...
@@ -482,7 +502,6 @@ class Interface:
elif
gajim
.
connections
[
account
].
connected
in
(
2
,
3
):
# we're online or chat
show_notification
=
True
chat_control
=
self
.
msg_win_mgr
.
get_control
(
jid
,
account
)
jid_of_control
=
jid
if
chat_control
and
chat_control
.
type_id
==
message_control
.
TYPE_GC
:
# it's a Private Message
...
...
@@ -497,11 +516,13 @@ class Interface:
img
=
os
.
path
.
join
(
gajim
.
DATA_DIR
,
'
pixmaps
'
,
'
events
'
,
'
priv_msg_recv.png
'
)
path
=
gtkgui_helpers
.
get_path_to_generic_or_avatar
(
img
)
notify
.
notify
(
_
(
'
New Private Message
'
),
fjid
,
account
,
'
pm
'
,
path_to_image
=
path
,
text
=
txt
)
notify
.
notify
(
_
(
'
New Private Message
'
),
fjid
,
account
,
'
pm
'
,
path_to_image
=
path
,
text
=
txt
)
chat_control
.
on_private_message
(
nick
,
array
[
1
],
array
[
2
])
return
# THIS HAS TO BE AFTER PM handling so we can get PMs
if
gajim
.
config
.
get
(
'
ignore_unknown_contacts
'
)
and
\
not
gajim
.
contacts
.
get_contact
(
account
,
jid
):
return
...
...
@@ -520,16 +541,17 @@ class Interface:
elif
resource
!=
highest_contact
.
resource
:
chat_control
=
None
jid_of_control
=
fjid
# Handle chat states
contact
=
gajim
.
contacts
.
get_first_contact_from_jid
(
account
,
jid
)
if
contact
:
contact
.
composing_jep
=
composing_jep
if
chat_control
and
chat_control
.
type_id
==
message_control
.
TYPE_CHAT
:
if
chatstate
is
not
None
:
# he or she sent us reply, so he supports jep85 or jep22
if
chatstate
is
not
None
:
# other peer sent us reply, so he supports jep85 or jep22
contact
.
chatstate
=
chatstate
if
contact
.
our_chatstate
==
'
ask
'
:
# we were jep85 disco?
contact
.
our_chatstate
=
'
active
'
# no more
chat_control
.
handle_incoming_chatstate
()
elif
contact
.
chatstate
!=
'
active
'
:
# got no valid jep85 answer, peer does not support it
...
...
@@ -541,18 +563,14 @@ class Interface:
if
msg_id
:
# Do not overwrite an existing msg_id with None
contact
.
msg_id
=
msg_id
if
not
array
[
1
]:
#empty message text
return
first
=
False
if
not
chat_control
and
not
gajim
.
awaiting_events
[
account
].
has_key
(
jid
):
first
=
True
if
gajim
.
config
.
get
(
'
notify_on_new_message
'
):
show_notification
=
False
# check OUR status and if we allow notifications for that status
if
gajim
.
config
.
get
(
'
autopopupaway
'
):
# always show notification
show_notification
=
True
elif
gajim
.
connections
[
account
].
connected
in
(
2
,
3
):
# we're online or chat
elif
gajim
.
connections
[
account
].
connected
in
(
2
,
3
):
# we're online or chat
show_notification
=
True
if
show_notification
:
txt
=
_
(
'
%s has sent you a new message.
'
)
%
gajim
.
get_name_from_jid
(
account
,
jid
)
...
...
@@ -569,15 +587,6 @@ class Interface:
notify
.
notify
(
_
(
'
New Message
'
),
jid_of_control
,
account
,
msg_type
,
path_to_image
=
path
,
text
=
txt
)
# array : (contact, msg, time, encrypted, msg_type, subject)
self
.
roster
.
on_message
(
jid
,
array
[
1
],
array
[
2
],
account
,
array
[
3
],
msg_type
,
array
[
5
],
resource
)
if
gajim
.
config
.
get_per
(
'
soundevents
'
,
'
first_message_received
'
,
'
enabled
'
)
and
first
:
helpers
.
play_sound
(
'
first_message_received
'
)
if
gajim
.
config
.
get_per
(
'
soundevents
'
,
'
next_message_received
'
,
'
enabled
'
)
and
not
first
:
helpers
.
play_sound
(
'
next_message_received
'
)
if
self
.
remote_ctrl
:
self
.
remote_ctrl
.
raise_signal
(
'
NewMessage
'
,
(
account
,
array
))
...
...
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