parent
95bd86320b
commit
eb8093d25f
|
@ -258,10 +258,8 @@ class AccountsWindow(Gtk.ApplicationWindow):
|
|||
'accounts', account, 'name')
|
||||
app.block_signed_in_notifications[account] = True
|
||||
app.sleeper_state[account] = 'off'
|
||||
app.encrypted_chats[account] = []
|
||||
app.last_message_time[account] = {}
|
||||
app.status_before_autoaway[account] = ''
|
||||
app.transport_avatar[account] = {}
|
||||
app.gajim_optional_features[account] = []
|
||||
app.caps_hash[account] = ''
|
||||
helpers.update_optional_features(account)
|
||||
|
@ -292,10 +290,8 @@ class AccountsWindow(Gtk.ApplicationWindow):
|
|||
del app.to_be_removed[account]
|
||||
del app.newly_added[account]
|
||||
del app.sleeper_state[account]
|
||||
del app.encrypted_chats[account]
|
||||
del app.last_message_time[account]
|
||||
del app.status_before_autoaway[account]
|
||||
del app.transport_avatar[account]
|
||||
del app.gajim_optional_features[account]
|
||||
del app.caps_hash[account]
|
||||
if len(app.connections) >= 2:
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from typing import Dict # pylint: disable=unused-import
|
||||
from typing import List # pylint: disable=unused-import
|
||||
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
|
@ -68,48 +71,61 @@ css_config = None
|
|||
|
||||
os_info = None # used to cache os information
|
||||
|
||||
transport_type = {} # list the type of transport
|
||||
transport_type = {} # type: Dict[str, str]
|
||||
|
||||
last_message_time = {} # list of time of the latest incoming message
|
||||
# dict of time of the latest incoming message per jid
|
||||
# {acct1: {jid1: time1, jid2: time2}, }
|
||||
encrypted_chats = {} # list of encrypted chats {acct1: [jid1, jid2], ..}
|
||||
last_message_time = {} # type: Dict[str, Dict[str, float]]
|
||||
|
||||
contacts = LegacyContactsAPI()
|
||||
gc_connected = {} # tell if we are connected to the room or not
|
||||
|
||||
# tell if we are connected to the room or not
|
||||
# {acct: {room_jid: True}}
|
||||
gc_passwords = {} # list of the pass required to enter a room
|
||||
gc_connected = {} # type: Dict[str, Dict[str, bool]]
|
||||
|
||||
# dict of the pass required to enter a room
|
||||
# {room_jid: password}
|
||||
automatic_rooms = {} # list of rooms that must be automaticaly configured
|
||||
gc_passwords = {} # type: Dict[str, str]
|
||||
|
||||
# dict of rooms that must be automaticaly configured
|
||||
# and for which we have a list of invities
|
||||
# {account: {room_jid: {'invities': []}}}
|
||||
automatic_rooms = {} # type: Dict[str, Dict[str, Dict[str, List[str]]]]
|
||||
|
||||
groups = {} # list of groups
|
||||
newly_added = {} # list of contacts that has just signed in
|
||||
to_be_removed = {} # list of contacts that has just signed out
|
||||
# dict of groups, holds if they are expanded or not
|
||||
groups = {} # type: Dict[str, Dict[str, Dict[str, bool]]]
|
||||
|
||||
# list of contacts that has just signed in
|
||||
newly_added = {} # type: Dict[str, List[str]]
|
||||
|
||||
# list of contacts that has just signed out
|
||||
to_be_removed = {} # type: Dict[str, List[str]]
|
||||
|
||||
events = Events()
|
||||
|
||||
notification = None
|
||||
|
||||
nicks = {} # list of our nick names in each account
|
||||
# list of our nick names in each account
|
||||
nicks = {} # type: Dict[str, str]
|
||||
|
||||
# should we block 'contact signed in' notifications for this account?
|
||||
# this is only for the first 30 seconds after we change our show
|
||||
# to something else than offline
|
||||
# can also contain account/transport_jid to block notifications for contacts
|
||||
# from this transport
|
||||
block_signed_in_notifications = {}
|
||||
con_types = {} # type of each connection (ssl, tls, tcp, ...)
|
||||
|
||||
sleeper_state = {} # whether we pass auto away / xa or not
|
||||
# type of each connection (ssl, tls, tcp, ...)
|
||||
con_types = {} # type: Dict[str, Optional[str]]
|
||||
|
||||
# whether we pass auto away / xa or not
|
||||
#'off': don't use sleeper for this account
|
||||
#'online': online and use sleeper
|
||||
#'autoaway': autoaway and use sleeper
|
||||
#'autoxa': autoxa and use sleeper
|
||||
status_before_autoaway = {}
|
||||
sleeper_state = {} # type: Dict[str, str]
|
||||
|
||||
# jid of transport contacts for which we need to ask avatar when transport will
|
||||
# be online
|
||||
transport_avatar = {} # {transport_jid: [jid_list]}
|
||||
status_before_autoaway = {} # type: Dict[str, str]
|
||||
|
||||
# Is Gnome configured to activate on single click ?
|
||||
single_click = False
|
||||
|
|
|
@ -32,6 +32,7 @@ if TYPE_CHECKING:
|
|||
from gajim.common.zeroconf.connection_zeroconf import ConnectionZeroconf
|
||||
from gajim.common.contacts import Contact
|
||||
from gajim.common.contacts import GC_Contact
|
||||
from gajim.common.nec import NetworkEvent
|
||||
|
||||
ConnectionT = Union['Connection', 'ConnectionZeroconf']
|
||||
ContactT = Union['Contact', 'GC_Contact']
|
||||
|
@ -44,3 +45,9 @@ PEPHandlersDict = Dict[str, List[PEPNotifyCallback]]
|
|||
|
||||
# Configpaths
|
||||
PathTuple = Tuple[Optional[PathLocation], str, Optional[PathType]]
|
||||
|
||||
# Plugins
|
||||
PluginExtensionPoints = Dict[str, Tuple[Optional[Callable[..., None]],
|
||||
Optional[Callable[..., None]]]]
|
||||
EventHandlersDict = Dict[str, Tuple[int, Callable[['NetworkEvent'], Optional[bool]]]]
|
||||
PluginEvents = List['NetworkEvent']
|
||||
|
|
|
@ -674,10 +674,8 @@ class RemoveAccountWindow:
|
|||
del app.to_be_removed[self.account]
|
||||
del app.newly_added[self.account]
|
||||
del app.sleeper_state[self.account]
|
||||
del app.encrypted_chats[self.account]
|
||||
del app.last_message_time[self.account]
|
||||
del app.status_before_autoaway[self.account]
|
||||
del app.transport_avatar[self.account]
|
||||
del app.gajim_optional_features[self.account]
|
||||
del app.caps_hash[self.account]
|
||||
if len(app.connections) >= 2: # Do not merge accounts if only one exists
|
||||
|
|
|
@ -582,10 +582,8 @@ class AccountCreationWizard:
|
|||
app.nicks[self.account] = config['name']
|
||||
app.block_signed_in_notifications[self.account] = True
|
||||
app.sleeper_state[self.account] = 'off'
|
||||
app.encrypted_chats[self.account] = []
|
||||
app.last_message_time[self.account] = {}
|
||||
app.status_before_autoaway[self.account] = ''
|
||||
app.transport_avatar[self.account] = {}
|
||||
app.gajim_optional_features[self.account] = []
|
||||
app.caps_hash[self.account] = ''
|
||||
helpers.update_optional_features(self.account)
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from typing import cast
|
||||
|
||||
import sys
|
||||
import os
|
||||
import traceback
|
||||
|
@ -40,7 +42,8 @@ if __name__ == '__main__':
|
|||
glade_file = os.path.join('data', 'gui', 'exception_dialog.ui')
|
||||
else:
|
||||
from gajim.common import configpaths
|
||||
glade_file = os.path.join(configpaths.get('GUI'), 'exception_dialog.ui')
|
||||
gui_path = cast(str, configpaths.get('GUI'))
|
||||
glade_file = os.path.join(gui_path, 'exception_dialog.ui')
|
||||
|
||||
|
||||
_exception_in_progress = threading.Lock()
|
||||
|
|
|
@ -2714,10 +2714,8 @@ class Interface:
|
|||
app.nicks[a] = app.config.get_per('accounts', a, 'name')
|
||||
app.block_signed_in_notifications[a] = True
|
||||
app.sleeper_state[a] = 0
|
||||
app.encrypted_chats[a] = []
|
||||
app.last_message_time[a] = {}
|
||||
app.status_before_autoaway[a] = ''
|
||||
app.transport_avatar[a] = {}
|
||||
app.gajim_optional_features[a] = []
|
||||
app.caps_hash[a] = ''
|
||||
|
||||
|
|
|
@ -21,15 +21,25 @@ Base class for implementing plugin.
|
|||
:license: GPL
|
||||
'''
|
||||
|
||||
from typing import List # pylint: disable=W0611
|
||||
from typing import Tuple # pylint: disable=W0611
|
||||
from typing import Dict # pylint: disable=W0611
|
||||
from typing import Any # pylint: disable=W0611
|
||||
|
||||
import os
|
||||
import locale
|
||||
import logging
|
||||
import pickle
|
||||
|
||||
from gajim.common import configpaths
|
||||
from gajim.common.types import PluginExtensionPoints # pylint: disable=W0611
|
||||
from gajim.common.types import EventHandlersDict # pylint: disable=W0611
|
||||
from gajim.common.types import PluginEvents # pylint: disable=W0611
|
||||
|
||||
from gajim.plugins.helpers import log_calls, log
|
||||
from gajim.plugins.gui import GajimPluginConfigDialog
|
||||
|
||||
import logging
|
||||
|
||||
log = logging.getLogger('gajim.p.plugin')
|
||||
|
||||
|
||||
|
@ -86,7 +96,7 @@ class GajimPlugin:
|
|||
|
||||
:todo: should be allow rich text here (like HTML or reStructuredText)?
|
||||
'''
|
||||
authors = []
|
||||
authors = [] # type: List[str]
|
||||
'''
|
||||
Plugin authors.
|
||||
|
||||
|
@ -104,7 +114,7 @@ class GajimPlugin:
|
|||
:todo: should we check whether provided string is valid URI? (Maybe
|
||||
using 'property')
|
||||
'''
|
||||
gui_extension_points = {}
|
||||
gui_extension_points = {} # type: PluginExtensionPoints
|
||||
'''
|
||||
Extension points that plugin wants to connect with and handlers to be used.
|
||||
|
||||
|
@ -118,7 +128,7 @@ class GajimPlugin:
|
|||
or when extpoint is destroyed and plugin is activate (eg. chat window
|
||||
closed).
|
||||
'''
|
||||
config_default_values = {}
|
||||
config_default_values = {} # type: Dict[str, Tuple[Any, str]]
|
||||
'''
|
||||
Default values for keys that should be stored in plug-in config.
|
||||
|
||||
|
@ -132,7 +142,7 @@ class GajimPlugin:
|
|||
|
||||
:type: {} of 2-element tuples
|
||||
'''
|
||||
events_handlers = {}
|
||||
events_handlers = {} # type: EventHandlersDict
|
||||
'''
|
||||
Dictionary with events handlers.
|
||||
|
||||
|
@ -143,7 +153,7 @@ class GajimPlugin:
|
|||
|
||||
:type: {} with 2-element tuples
|
||||
'''
|
||||
events = []
|
||||
events = [] # type: PluginEvents
|
||||
'''
|
||||
New network event classes to be registered in Network Events Controller.
|
||||
|
||||
|
@ -152,7 +162,7 @@ class GajimPlugin:
|
|||
'''
|
||||
|
||||
@log_calls('GajimPlugin')
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
self.config = GajimPluginConfig(self)
|
||||
'''
|
||||
Plug-in configuration dictionary.
|
||||
|
@ -168,11 +178,11 @@ class GajimPlugin:
|
|||
self.init()
|
||||
|
||||
@log_calls('GajimPlugin')
|
||||
def save_config(self):
|
||||
def save_config(self) -> None:
|
||||
self.config.save()
|
||||
|
||||
@log_calls('GajimPlugin')
|
||||
def load_config(self):
|
||||
def load_config(self) -> None:
|
||||
self.config.load()
|
||||
|
||||
def __eq__(self, plugin):
|
||||
|
@ -203,7 +213,6 @@ class GajimPlugin:
|
|||
def deactivate(self):
|
||||
pass
|
||||
|
||||
import pickle
|
||||
|
||||
class GajimPluginConfig():
|
||||
@log_calls('GajimPluginConfig')
|
||||
|
|
|
@ -35,10 +35,8 @@ class MockConnection(Mock, ConnectionHandlers):
|
|||
app.nicks[account] = app.config.get_per('accounts', account, 'name')
|
||||
app.block_signed_in_notifications[account] = True
|
||||
app.sleeper_state[account] = 0
|
||||
app.encrypted_chats[account] = []
|
||||
app.last_message_time[account] = {}
|
||||
app.status_before_autoaway[account] = ''
|
||||
app.transport_avatar[account] = {}
|
||||
app.gajim_optional_features[account] = []
|
||||
app.caps_hash[account] = ''
|
||||
|
||||
|
|
Loading…
Reference in New Issue