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
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Contributor 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
mesonium
gajim
Commits
176bd508
Commit
176bd508
authored
3 years ago
by
Philipp Hörist
Browse files
Options
Downloads
Patches
Plain Diff
Add SimpleClientState
parent
b054c3e4
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
gajim/common/client.py
+11
-3
11 additions, 3 deletions
gajim/common/client.py
gajim/common/const.py
+18
-0
18 additions, 0 deletions
gajim/common/const.py
with
29 additions
and
3 deletions
gajim/common/client.py
+
11
−
3
View file @
176bd508
...
...
@@ -28,12 +28,14 @@
from
gajim.common
import
helpers
from
gajim.common
import
modules
from
gajim.common.const
import
ClientState
from
gajim.common.const
import
SimpleClientState
from
gajim.common.structs
import
UNKNOWN_PRESENCE
from
gajim.common.helpers
import
get_custom_host
from
gajim.common.helpers
import
get_user_proxy
from
gajim.common.helpers
import
warn_about_plain_connection
from
gajim.common.helpers
import
get_resource
from
gajim.common.helpers
import
get_idle_status_message
from
gajim.common.helpers
import
Observable
from
gajim.common.idle
import
Monitor
from
gajim.common.i18n
import
_
...
...
@@ -45,8 +47,9 @@
log
=
logging
.
getLogger
(
'
gajim.client
'
)
class
Client
:
class
Client
(
Observable
)
:
def
__init__
(
self
,
account
):
Observable
.
__init__
(
self
,
log
)
self
.
_client
=
None
self
.
_account
=
account
self
.
name
=
account
...
...
@@ -199,6 +202,8 @@ def _on_resume_successful(self, _client, _signal_name):
account
=
self
.
_account
,
show
=
self
.
_status
))
self
.
notify
(
'
state-changed
'
,
SimpleClientState
.
CONNECTED
)
def
_set_client_available
(
self
):
self
.
_set_state
(
ClientState
.
AVAILABLE
)
app
.
nec
.
push_incoming_event
(
NetworkEvent
(
'
account-connected
'
,
...
...
@@ -270,18 +275,18 @@ def _on_password(password):
self
.
_schedule_reconnect
()
app
.
nec
.
push_incoming_event
(
NetworkEvent
(
'
our-show
'
,
account
=
self
.
_account
,
show
=
'
error
'
))
self
.
notify
(
'
state-changed
'
,
SimpleClientState
.
RESUME_IN_PREGRESS
)
else
:
self
.
get_module
(
'
Chatstate
'
).
enabled
=
False
app
.
nec
.
push_incoming_event
(
NetworkEvent
(
'
our-show
'
,
account
=
self
.
_account
,
show
=
'
offline
'
))
self
.
_after_disconnect
()
self
.
notify
(
'
state-changed
'
,
SimpleClientState
.
DISCONNECTED
)
def
_after_disconnect
(
self
):
self
.
_disable_reconnect_timer
()
self
.
get_module
(
'
VCardAvatars
'
).
avatar_advertised
=
False
app
.
proxy65_manager
.
disconnect
(
self
.
_client
)
self
.
get_module
(
'
Bytestream
'
).
remove_all_transfers
()
...
...
@@ -440,6 +445,8 @@ def _finish_connect(self):
self
.
get_module
(
'
Annotations
'
).
request_annotations
()
self
.
get_module
(
'
Blocking
'
).
get_blocking_list
()
self
.
notify
(
'
state-changed
'
,
SimpleClientState
.
CONNECTED
)
# Inform GUI we just signed in
app
.
nec
.
push_incoming_event
(
NetworkEvent
(
'
signed-in
'
,
account
=
self
.
_account
,
conn
=
self
))
...
...
@@ -624,6 +631,7 @@ def _screensaver_state_changed(application, _param):
Monitor
.
set_extended_away
(
active
)
def
cleanup
(
self
):
self
.
disconnect_signals
()
self
.
_destroyed
=
True
if
Monitor
.
is_available
():
Monitor
.
disconnect
(
self
.
_idle_handler_id
)
...
...
This diff is collapsed.
Click to expand it.
gajim/common/const.py
+
18
−
0
View file @
176bd508
...
...
@@ -274,6 +274,24 @@ def is_available(self):
return
self
==
ClientState
.
AVAILABLE
class
SimpleClientState
(
IntEnum
):
DISCONNECTED
=
'
disconnected
'
CONNECTED
=
'
connected
'
RESUME_IN_PREGRESS
=
'
resume-in-progress
'
@property
def
is_disconnected
(
self
):
return
self
==
SimpleClientState
.
DISCONNECTED
@property
def
is_connected
(
self
):
return
self
==
SimpleClientState
.
CONNECTED
@property
def
is_resume_in_progress
(
self
):
return
self
==
SimpleClientState
.
RESUME_IN_PREGRESS
class
JingleState
(
Enum
):
NULL
=
'
stop
'
CONNECTING
=
'
connecting
'
...
...
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