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
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
TSRh
gajim
Commits
d6f20965
Commit
d6f20965
authored
16 years ago
by
Yann Leboulanger
Browse files
Options
Downloads
Patches
Plain Diff
update correctly self contact when we get PEP info. fixes #4145
parent
e13c472e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/common/pep.py
+10
-13
10 additions, 13 deletions
src/common/pep.py
src/gajim.py
+49
-89
49 additions, 89 deletions
src/gajim.py
with
59 additions
and
102 deletions
src/common/pep.py
+
10
−
13
View file @
d6f20965
...
...
@@ -163,11 +163,10 @@ def user_mood(items, name, jid):
if
jid
==
gajim
.
get_jid_from_account
(
name
):
gajim
.
interface
.
roster
.
draw_account
(
name
)
else
:
gajim
.
interface
.
roster
.
draw_mood
(
user
,
name
)
ctrl
=
gajim
.
interface
.
msg_win_mgr
.
get_control
(
user
,
name
)
if
ctrl
:
ctrl
.
update_mood
()
gajim
.
interface
.
roster
.
draw_mood
(
user
,
name
)
ctrl
=
gajim
.
interface
.
msg_win_mgr
.
get_control
(
user
,
name
)
if
ctrl
:
ctrl
.
update_mood
()
def
user_tune
(
items
,
name
,
jid
):
has_child
=
False
...
...
@@ -268,11 +267,10 @@ def user_tune(items, name, jid):
if
jid
==
gajim
.
get_jid_from_account
(
name
):
gajim
.
interface
.
roster
.
draw_account
(
name
)
else
:
gajim
.
interface
.
roster
.
draw_tune
(
user
,
name
)
ctrl
=
gajim
.
interface
.
msg_win_mgr
.
get_control
(
user
,
name
)
if
ctrl
:
ctrl
.
update_tune
()
gajim
.
interface
.
roster
.
draw_tune
(
user
,
name
)
ctrl
=
gajim
.
interface
.
msg_win_mgr
.
get_control
(
user
,
name
)
if
ctrl
:
ctrl
.
update_tune
()
def
user_geoloc
(
items
,
name
,
jid
):
pass
...
...
@@ -346,8 +344,7 @@ def user_activity(items, name, jid):
if
jid
==
gajim
.
get_jid_from_account
(
name
):
gajim
.
interface
.
roster
.
draw_account
(
name
)
else
:
gajim
.
interface
.
roster
.
draw_activity
(
user
,
name
)
gajim
.
interface
.
roster
.
draw_activity
(
user
,
name
)
ctrl
=
gajim
.
interface
.
msg_win_mgr
.
get_control
(
user
,
name
)
if
ctrl
:
ctrl
.
update_activity
()
...
...
@@ -468,4 +465,4 @@ def user_retract_tune(account):
def
user_retract_nickname
(
account
):
gajim
.
connections
[
account
].
send_pb_retract
(
''
,
xmpp
.
NS_NICK
,
'
0
'
)
# vim: se ts=3:
\ No newline at end of file
# vim: se ts=3:
This diff is collapsed.
Click to expand it.
src/gajim.py
+
49
−
89
View file @
d6f20965
...
...
@@ -655,8 +655,8 @@ def handle_event_notify(self, account, array):
# FIXME: Drop and rewrite...
statuss
=
[
'
offline
'
,
'
error
'
,
'
online
'
,
'
chat
'
,
'
away
'
,
'
xa
'
,
'
dnd
'
,
'
invisible
'
]
statuss
=
[
'
offline
'
,
'
error
'
,
'
online
'
,
'
chat
'
,
'
away
'
,
'
xa
'
,
'
dnd
'
,
'
invisible
'
]
# Ignore invalid show
if
array
[
1
]
not
in
statuss
:
return
...
...
@@ -668,8 +668,7 @@ def handle_event_notify(self, account, array):
contact_nickname
=
array
[
7
]
# Get the proper keyID
keyID
=
helpers
.
prepare_and_validate_gpg_keyID
(
account
,
jid
,
keyID
)
keyID
=
helpers
.
prepare_and_validate_gpg_keyID
(
account
,
jid
,
keyID
)
resource
=
array
[
3
]
if
not
resource
:
...
...
@@ -685,6 +684,8 @@ def handle_event_notify(self, account, array):
get_contact_with_highest_priority
(
account
,
jid
)
was_highest
=
(
highest
and
highest
.
resource
==
resource
)
conn
=
gajim
.
connections
[
account
]
# Update contact
jid_list
=
gajim
.
contacts
.
get_jid_list
(
account
)
if
ji
in
jid_list
or
jid
==
gajim
.
get_jid_from_account
(
account
):
...
...
@@ -706,42 +707,32 @@ def handle_event_notify(self, account, array):
contact1
.
contact_name
=
contact_nickname
self
.
roster
.
draw_contact
(
jid
,
account
)
if
old_show
==
new_show
and
\
contact1
.
status
==
status_message
and
\
if
old_show
==
new_show
and
contact1
.
status
==
status_message
and
\
contact1
.
priority
==
priority
:
# no change
return
else
:
contact1
=
gajim
.
contacts
.
\
get_first_contact_from_jid
(
account
,
ji
)
contact1
=
gajim
.
contacts
.
get_first_contact_from_jid
(
account
,
ji
)
if
not
contact1
:
# Presence of another resource of our
# jid
# Create self contact and add to roster
if
resource
==
gajim
.
connections
\
[
account
].
server_resource
:
if
resource
==
conn
.
server_resource
:
return
contact1
=
gajim
.
contacts
.
\
create_contact
(
jid
=
ji
,
name
=
gajim
.
nicks
[
account
],
groups
=
[
'
self_contact
'
],
show
=
array
[
1
],
status
=
status_message
,
sub
=
'
both
'
,
ask
=
'
none
'
,
priority
=
priority
,
keyID
=
keyID
,
resource
=
resource
)
contact1
=
gajim
.
contacts
.
create_contact
(
jid
=
ji
,
name
=
gajim
.
nicks
[
account
],
groups
=
[
'
self_contact
'
],
show
=
array
[
1
],
status
=
status_message
,
sub
=
'
both
'
,
ask
=
'
none
'
,
priority
=
priority
,
keyID
=
keyID
,
resource
=
resource
,
mood
=
conn
.
mood
,
tune
=
conn
.
tune
,
activity
=
conn
.
activity
)
old_show
=
0
gajim
.
contacts
.
add_contact
(
account
,
contact1
)
gajim
.
contacts
.
add_contact
(
account
,
contact1
)
lcontact
.
append
(
contact1
)
elif
contact1
.
show
in
statuss
:
old_show
=
statuss
.
index
(
contact1
.
show
)
# FIXME: What am I?
if
(
resources
!=
[
''
]
and
(
len
(
lcontact
)
!=
1
or
lcontact
[
0
].
show
!=
'
offline
'
))
and
\
jid
.
find
(
'
@
'
)
>
0
:
if
(
resources
!=
[
''
]
and
(
len
(
lcontact
)
!=
1
or
\
lcontact
[
0
].
show
!=
'
offline
'
))
and
jid
.
find
(
'
@
'
)
>
0
:
old_show
=
0
contact1
=
gajim
.
contacts
.
\
copy_contact
(
contact1
)
contact1
=
gajim
.
contacts
.
copy_contact
(
contact1
)
lcontact
.
append
(
contact1
)
contact1
.
resource
=
resource
...
...
@@ -750,31 +741,19 @@ def handle_event_notify(self, account, array):
if
contact1
.
jid
.
find
(
'
@
'
)
>
0
and
len
(
lcontact
)
==
1
:
# It's not an agent
if
old_show
==
0
and
new_show
>
1
:
if
not
contact1
.
jid
in
\
gajim
.
newly_added
[
account
]:
gajim
.
newly_added
[
account
].
\
append
(
contact1
.
jid
)
if
contact1
.
jid
in
\
gajim
.
to_be_removed
[
account
]:
gajim
.
to_be_removed
[
account
].
\
remove
(
contact1
.
jid
)
gobject
.
timeout_add_seconds
(
5
,
self
.
\
roster
.
remove_newly_added
,
if
not
contact1
.
jid
in
gajim
.
newly_added
[
account
]:
gajim
.
newly_added
[
account
].
append
(
contact1
.
jid
)
if
contact1
.
jid
in
gajim
.
to_be_removed
[
account
]:
gajim
.
to_be_removed
[
account
].
remove
(
contact1
.
jid
)
gobject
.
timeout_add_seconds
(
5
,
self
.
roster
.
remove_newly_added
,
contact1
.
jid
,
account
)
elif
old_show
>
1
and
new_show
==
0
and
\
gajim
.
connections
[
account
].
connected
>
1
:
if
not
contact1
.
jid
in
\
gajim
.
to_be_removed
[
account
]:
gajim
.
to_be_removed
[
account
].
\
append
(
contact1
.
jid
)
if
contact1
.
jid
in
\
gajim
.
newly_added
[
account
]:
gajim
.
newly_added
[
account
].
\
remove
(
contact1
.
jid
)
self
.
roster
.
draw_contact
(
contact1
.
jid
,
account
)
gobject
.
timeout_add_seconds
(
5
,
self
.
\
roster
.
remove_to_be_removed
,
elif
old_show
>
1
and
new_show
==
0
and
conn
.
connected
>
1
:
if
not
contact1
.
jid
in
gajim
.
to_be_removed
[
account
]:
gajim
.
to_be_removed
[
account
].
append
(
contact1
.
jid
)
if
contact1
.
jid
in
gajim
.
newly_added
[
account
]:
gajim
.
newly_added
[
account
].
remove
(
contact1
.
jid
)
self
.
roster
.
draw_contact
(
contact1
.
jid
,
account
)
gobject
.
timeout_add_seconds
(
5
,
self
.
roster
.
remove_to_be_removed
,
contact1
.
jid
,
account
)
contact1
.
show
=
array
[
1
]
contact1
.
status
=
status_message
...
...
@@ -794,33 +773,25 @@ def handle_event_notify(self, account, array):
# Update existing iter and group counting
self
.
roster
.
draw_contact
(
ji
,
account
)
self
.
roster
.
draw_group
(
_
(
'
Transports
'
),
account
)
if
new_show
>
1
and
ji
in
\
gajim
.
transport_avatar
[
account
]:
if
new_show
>
1
and
ji
in
gajim
.
transport_avatar
[
account
]:
# transport just signed in.
# request avatars
for
jid_
in
gajim
.
transport_avatar
\
[
account
][
ji
]:
gajim
.
connections
[
account
].
\
request_vcard
(
jid_
)
for
jid_
in
gajim
.
transport_avatar
[
account
][
ji
]:
conn
.
request_vcard
(
jid_
)
# transport just signed in/out, don't show
# popup notifications for 30s
account_ji
=
account
+
'
/
'
+
ji
gajim
.
block_signed_in_notifications
\
[
account_ji
]
=
True
gajim
.
block_signed_in_notifications
[
account_ji
]
=
True
gobject
.
timeout_add_seconds
(
30
,
self
.
unblock_signed_in_notifications
,
account_ji
)
self
.
unblock_signed_in_notifications
,
account_ji
)
locations
=
(
self
.
instances
,
self
.
instances
[
account
])
for
location
in
locations
:
if
location
.
has_key
(
'
add_contact
'
):
if
old_show
==
0
and
new_show
>
1
:
location
[
'
add_contact
'
].
\
transport_signed_in
(
jid
)
location
[
'
add_contact
'
].
transport_signed_in
(
jid
)
break
elif
old_show
>
1
and
new_show
==
0
:
location
[
'
add_contact
'
].
\
transport_signed_out
(
jid
)
location
[
'
add_contact
'
].
transport_signed_out
(
jid
)
break
elif
ji
in
jid_list
:
# It isn't an agent
...
...
@@ -830,8 +801,6 @@ def handle_event_notify(self, account, array):
contact1
.
our_chatstate
=
contact1
.
chatstate
=
\
contact1
.
composing_xep
=
None
conn
=
gajim
.
connections
[
account
]
# TODO: This causes problems when another
# resource signs off!
conn
.
remove_transfers_for_contact
(
contact1
)
...
...
@@ -855,44 +824,35 @@ def handle_event_notify(self, account, array):
conn
.
delete_session
(
jid
,
sess
.
thread_id
)
self
.
roster
.
chg_contact_status
(
contact1
,
array
[
1
],
status_message
,
account
)
self
.
roster
.
chg_contact_status
(
contact1
,
array
[
1
],
status_message
,
account
)
# Notifications
if
old_show
<
2
and
new_show
>
1
:
notify
.
notify
(
'
contact_connected
'
,
jid
,
account
,
status_message
)
notify
.
notify
(
'
contact_connected
'
,
jid
,
account
,
status_message
)
if
self
.
remote_ctrl
:
self
.
remote_ctrl
.
raise_signal
(
'
ContactPresence
'
,
(
account
,
array
))
self
.
remote_ctrl
.
raise_signal
(
'
ContactPresence
'
,
(
account
,
array
))
elif
old_show
>
1
and
new_show
<
2
:
notify
.
notify
(
'
contact_disconnected
'
,
jid
,
account
,
status_message
)
notify
.
notify
(
'
contact_disconnected
'
,
jid
,
account
,
status_message
)
if
self
.
remote_ctrl
:
self
.
remote_ctrl
.
raise_signal
(
'
ContactAbsence
'
,
(
account
,
array
))
self
.
remote_ctrl
.
raise_signal
(
'
ContactAbsence
'
,
(
account
,
array
))
# FIXME: stop non active file transfers
# Status change (not connected/disconnected or
# error (<1))
elif
new_show
>
1
:
notify
.
notify
(
'
status_change
'
,
jid
,
account
,
[
new_show
,
status_message
])
notify
.
notify
(
'
status_change
'
,
jid
,
account
,
[
new_show
,
status_message
])
if
self
.
remote_ctrl
:
self
.
remote_ctrl
.
raise_signal
(
'
ContactStatus
'
,
(
account
,
array
))
self
.
remote_ctrl
.
raise_signal
(
'
ContactStatus
'
,
(
account
,
array
))
else
:
# FIXME: MSN transport (CMSN1.2.1 and PyMSN) don't
# follow the XEP, still the case in 2008.
# It's maybe a GC_NOTIFY (specialy for MSN gc)
self
.
handle_event_gc_notify
(
account
,
(
jid
,
array
[
1
],
status_message
,
array
[
3
],
None
,
None
,
None
,
None
,
None
,
[],
None
,
None
))
self
.
handle_event_gc_notify
(
account
,
(
jid
,
array
[
1
],
status_message
,
array
[
3
],
None
,
None
,
None
,
None
,
None
,
[],
None
,
None
))
highest
=
gajim
.
contacts
.
get_contact_with_highest_priority
(
account
,
jid
)
highest
=
gajim
.
contacts
.
get_contact_with_highest_priority
(
account
,
jid
)
is_highest
=
(
highest
and
highest
.
resource
==
resource
)
if
was_highest
and
not
is_highest
:
...
...
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