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
eta
gajim
Commits
746a0bf9
Commit
746a0bf9
authored
18 years ago
by
Yann Leboulanger
Browse files
Options
Downloads
Patches
Plain Diff
show connection lost error in popups instead of error dialogs. Fixes #2138
parent
5c734410
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
data/pixmaps/events/connection_lost.png
+0
-0
0 additions, 0 deletions
data/pixmaps/events/connection_lost.png
src/common/connection.py
+11
-10
11 additions, 10 deletions
src/common/connection.py
src/gajim.py
+9
-0
9 additions, 0 deletions
src/gajim.py
src/notify.py
+2
-0
2 additions, 0 deletions
src/notify.py
with
22 additions
and
10 deletions
data/pixmaps/events/connection_lost.png
0 → 100644
+
0
−
0
View file @
746a0bf9
3.13 KiB
This diff is collapsed.
Click to expand it.
src/common/connection.py
+
11
−
10
View file @
746a0bf9
...
...
@@ -137,22 +137,21 @@ class Connection(ConnectionHandlers):
if
not
self
.
on_purpose
:
self
.
disconnect
()
if
gajim
.
config
.
get_per
(
'
accounts
'
,
self
.
name
,
'
autoreconnect
'
)
\
and
self
.
retrycount
<=
10
:
and
self
.
retrycount
<=
10
:
self
.
connected
=
1
self
.
dispatch
(
'
STATUS
'
,
'
connecting
'
)
self
.
time_to_reconnect
=
10
# this check has moved from _reconnect method
if
self
.
retrycount
>
5
:
self
.
time_to_reconnect
=
20
else
:
self
.
time_to_reconnect
=
10
gajim
.
idlequeue
.
set_alarm
(
self
.
_reconnect_alarm
,
self
.
time_to_reconnect
)
gajim
.
idlequeue
.
set_alarm
(
self
.
_reconnect_alarm
,
self
.
time_to_reconnect
)
elif
self
.
on_connect_failure
:
self
.
on_connect_failure
()
self
.
on_connect_failure
=
None
else
:
# show error dialog
# show error dialog
self
.
_connection_lost
()
else
:
self
.
disconnect
()
...
...
@@ -162,9 +161,9 @@ class Connection(ConnectionHandlers):
def
_connection_lost
(
self
):
self
.
disconnect
(
on_purpose
=
False
)
self
.
dispatch
(
'
STATUS
'
,
'
offline
'
)
self
.
dispatch
(
'
ERROR
'
,
(
_
(
'
Connection with account
"
%s
"
has been lost
'
)
%
self
.
name
,
_
(
'
To continue sending and receiving messages, you will need to reconnect.
'
)))
self
.
dispatch
(
'
CONNECTION_LOST
'
,
(
_
(
'
Connection with account
"
%s
"
has been lost
'
)
%
self
.
name
,
_
(
'
To continue sending and receiving messages, you will need to reconnect.
'
)))
def
_event_dispatcher
(
self
,
realm
,
event
,
data
):
if
realm
==
common
.
xmpp
.
NS_REGISTER
:
...
...
@@ -388,7 +387,8 @@ class Connection(ConnectionHandlers):
if
not
self
.
retrycount
and
self
.
connected
!=
0
:
self
.
disconnect
(
on_purpose
=
True
)
self
.
dispatch
(
'
STATUS
'
,
'
offline
'
)
self
.
dispatch
(
'
ERROR
'
,
(
_
(
'
Could not connect to
"
%s
"'
)
%
self
.
_hostname
,
self
.
dispatch
(
'
CONNECTION_LOST
'
,
(
_
(
'
Could not connect to
"
%s
"'
)
%
self
.
_hostname
,
_
(
'
Check your connection or try again later.
'
)))
def
_connect_success
(
self
,
con
,
con_type
):
...
...
@@ -424,7 +424,8 @@ class Connection(ConnectionHandlers):
if
not
con
:
self
.
disconnect
(
on_purpose
=
True
)
self
.
dispatch
(
'
STATUS
'
,
'
offline
'
)
self
.
dispatch
(
'
ERROR
'
,
(
_
(
'
Could not connect to
"
%s
"'
)
%
self
.
_hostname
,
self
.
dispatch
(
'
CONNECTION_LOST
'
,
(
_
(
'
Could not connect to
"
%s
"'
)
%
self
.
_hostname
,
_
(
'
Check your connection or try again later
'
)))
if
self
.
on_connect_auth
:
self
.
on_connect_auth
(
None
)
...
...
This diff is collapsed.
Click to expand it.
src/gajim.py
+
9
−
0
View file @
746a0bf9
...
...
@@ -309,6 +309,14 @@ class Interface:
gajim
.
con_types
[
account
]
=
con_type
self
.
roster
.
draw_account
(
account
)
def
handle_event_connection_lost
(
self
,
account
,
array
):
# ('CONNECTION_LOST', account, [title, text])
path
=
os
.
path
.
join
(
gajim
.
DATA_DIR
,
'
pixmaps
'
,
'
events
'
,
'
connection_lost.png
'
)
path
=
gtkgui_helpers
.
get_path_to_generic_or_avatar
(
path
)
notify
.
popup
(
_
(
'
Connection Failed
'
),
account
,
account
,
'
connection_failed
'
,
path
,
array
[
0
],
array
[
1
])
def
unblock_signed_in_notifications
(
self
,
account
):
gajim
.
block_signed_in_notifications
[
account
]
=
False
...
...
@@ -1676,6 +1684,7 @@ class Interface:
'
ROSTER_INFO
'
:
self
.
handle_event_roster_info
,
'
BOOKMARKS
'
:
self
.
handle_event_bookmarks
,
'
CON_TYPE
'
:
self
.
handle_event_con_type
,
'
CONNECTION_LOST
'
:
self
.
handle_event_connection_lost
,
'
FILE_REQUEST
'
:
self
.
handle_event_file_request
,
'
GMAIL_NOTIFY
'
:
self
.
handle_event_gmail_notify
,
'
FILE_REQUEST_ERROR
'
:
self
.
handle_event_file_request_error
,
...
...
This diff is collapsed.
Click to expand it.
src/notify.py
+
2
−
0
View file @
746a0bf9
...
...
@@ -382,6 +382,8 @@ class DesktopNotification:
ntype
=
'
im.invitation
'
elif
event_type
==
_
(
'
Contact Changed Status
'
):
ntype
=
'
presence.status
'
elif
event_type
==
_
(
'
Connection Failed
'
):
ntype
=
'
connection.failed
'
else
:
# default failsafe values
self
.
path_to_image
=
os
.
path
.
abspath
(
...
...
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