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
poezio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
204
Issues
204
List
Boards
Labels
Service Desk
Milestones
Merge Requests
9
Merge Requests
9
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
poezio
poezio
Commits
98c32b05
Commit
98c32b05
authored
Jan 05, 2011
by
louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
same thing, but nicer code
parent
1f2959d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
src/core.py
src/core.py
+15
-6
No files found.
src/core.py
View file @
98c32b05
...
...
@@ -201,16 +201,12 @@ class Core(object):
self
.
information
(
'%s is offline'
%
(
resource
.
get_jid
()),
"Roster"
)
# If a resource got offline, display the message in the conversation with this
# precise resource.
tab
=
self
.
get_tab_by_name
(
jid
.
full
)
if
tab
and
isinstance
(
tab
,
tabs
.
ConversationTab
):
self
.
add_message_to_text_buffer
(
tab
.
get_room
(),
'%s is offline'
%
(
resource
.
get_jid
().
full
))
self
.
add_information_message_to_conversation_tab
(
jid
.
full
,
'%s is offline'
%
(
resource
.
get_jid
().
full
))
contact
.
remove_resource
(
resource
)
# Display the message in the conversation with the bare JID only if that was
# the only resource online (i.e. now the contact is completely disconnected)
if
not
contact
.
get_highest_priority_resource
():
# No resource left: that was the last one
tab
=
self
.
get_tab_by_name
(
jid
.
bare
)
if
tab
and
isinstance
(
tab
,
tabs
.
ConversationTab
):
self
.
add_message_to_text_buffer
(
tab
.
get_room
(),
'%s is offline'
%
(
jid
.
bare
))
self
.
add_information_message_to_conversation_tab
(
jid
.
bare
,
'%s is offline'
%
(
jid
.
bare
))
if
isinstance
(
self
.
current_tab
(),
tabs
.
RosterInfoTab
):
self
.
refresh_window
()
...
...
@@ -231,6 +227,19 @@ class Core(object):
resource
.
set_priority
(
priority
)
contact
.
add_resource
(
resource
)
self
.
information
(
"%s is online (%s)"
%
(
resource
.
get_jid
().
full
,
status
),
"Roster"
)
tab
=
self
.
get_tab_by_name
(
jid
.
full
)
if
tab
and
isinstance
(
tab
,
tabs
.
ConversationTab
):
self
.
add_message_to_text_buffer
(
tab
.
get_room
(),
'%s is offline'
%
(
resource
.
get_jid
().
full
))
def
add_information_message_to_conversation_tab
(
self
,
jid
,
msg
):
"""
Search for a ConversationTab with the given jid (full or bare), if yes, add
the given message to it
"""
tab
=
self
.
get_tab_by_name
(
jid
)
if
tab
and
isinstance
(
tab
,
tabs
.
ConversationTab
):
self
.
add_message_to_text_buffer
(
tab
.
get_room
(),
msg
)
def
on_connected
(
self
,
event
):
"""
...
...
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