Spellcheck
This commit is contained in:
parent
22d799a75e
commit
1d27ab2254
10 changed files with 39 additions and 39 deletions
|
@ -84,7 +84,7 @@ def create_paths():
|
||||||
if not path.exists():
|
if not path.exists():
|
||||||
for parent_path in reversed(path.parents):
|
for parent_path in reversed(path.parents):
|
||||||
# Create all parent folders
|
# Create all parent folders
|
||||||
# dont use mkdir(parent=True), as it ignores `mode`
|
# don't use mkdir(parent=True), as it ignores `mode`
|
||||||
# when creating the parents
|
# when creating the parents
|
||||||
if not parent_path.exists():
|
if not parent_path.exists():
|
||||||
print(('creating %s directory') % parent_path)
|
print(('creating %s directory') % parent_path)
|
||||||
|
|
|
@ -75,7 +75,7 @@ SERVICE_DIRECT_TLS = 'xmpps-client'
|
||||||
|
|
||||||
class CommonConnection:
|
class CommonConnection:
|
||||||
"""
|
"""
|
||||||
Common connection class, can be derivated for normal connection or zeroconf
|
Common connection class, can be derived for normal connection or zeroconf
|
||||||
connection
|
connection
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ class CommonConnection:
|
||||||
|
|
||||||
# Remember where we are in the register agent process
|
# Remember where we are in the register agent process
|
||||||
self.agent_registrations = {}
|
self.agent_registrations = {}
|
||||||
# To know the groupchat jid associated with a sranza ID. Useful to
|
# To know the groupchat jid associated with a stanza ID. Useful to
|
||||||
# request vcard or os info... to a real JID but act as if it comes from
|
# request vcard or os info... to a real JID but act as if it comes from
|
||||||
# the fake jid
|
# the fake jid
|
||||||
self.groupchat_jids = {} # {ID : groupchat_jid}
|
self.groupchat_jids = {} # {ID : groupchat_jid}
|
||||||
|
@ -164,7 +164,7 @@ class CommonConnection:
|
||||||
|
|
||||||
def reconnect(self):
|
def reconnect(self):
|
||||||
"""
|
"""
|
||||||
To be implemented by derivated classes
|
To be implemented by derived classes
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ class CommonConnection:
|
||||||
|
|
||||||
def check_jid(self, jid):
|
def check_jid(self, jid):
|
||||||
"""
|
"""
|
||||||
This function must be implemented by derivated classes. It has to return
|
This function must be implemented by derived classes. It has to return
|
||||||
the valid jid, or raise a helpers.InvalidFormat exception
|
the valid jid, or raise a helpers.InvalidFormat exception
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
@ -404,44 +404,44 @@ class CommonConnection:
|
||||||
|
|
||||||
def ack_subscribed(self, jid):
|
def ack_subscribed(self, jid):
|
||||||
"""
|
"""
|
||||||
To be implemented by derivated classes
|
To be implemented by derived classes
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def ack_unsubscribed(self, jid):
|
def ack_unsubscribed(self, jid):
|
||||||
"""
|
"""
|
||||||
To be implemented by derivated classes
|
To be implemented by derived classes
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def request_subscription(self, jid, msg='', name='', groups=None,
|
def request_subscription(self, jid, msg='', name='', groups=None,
|
||||||
auto_auth=False):
|
auto_auth=False):
|
||||||
"""
|
"""
|
||||||
To be implemented by derivated classes
|
To be implemented by derived classes
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def send_authorization(self, jid):
|
def send_authorization(self, jid):
|
||||||
"""
|
"""
|
||||||
To be implemented by derivated classes
|
To be implemented by derived classes
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def refuse_authorization(self, jid):
|
def refuse_authorization(self, jid):
|
||||||
"""
|
"""
|
||||||
To be implemented by derivated classes
|
To be implemented by derived classes
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def unsubscribe(self, jid, remove_auth = True):
|
def unsubscribe(self, jid, remove_auth = True):
|
||||||
"""
|
"""
|
||||||
To be implemented by derivated classes
|
To be implemented by derived classes
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def unsubscribe_agent(self, agent):
|
def unsubscribe_agent(self, agent):
|
||||||
"""
|
"""
|
||||||
To be implemented by derivated classes
|
To be implemented by derived classes
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
@ -458,13 +458,13 @@ class CommonConnection:
|
||||||
|
|
||||||
def new_account(self, name, config, sync=False):
|
def new_account(self, name, config, sync=False):
|
||||||
"""
|
"""
|
||||||
To be implemented by derivated classes
|
To be implemented by derived classes
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def _on_new_account(self, con=None, con_type=None):
|
def _on_new_account(self, con=None, con_type=None):
|
||||||
"""
|
"""
|
||||||
To be implemented by derivated classes
|
To be implemented by derived classes
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
@ -473,37 +473,37 @@ class CommonConnection:
|
||||||
|
|
||||||
def request_os_info(self, jid, resource):
|
def request_os_info(self, jid, resource):
|
||||||
"""
|
"""
|
||||||
To be implemented by derivated classes
|
To be implemented by derived classes
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def get_settings(self):
|
def get_settings(self):
|
||||||
"""
|
"""
|
||||||
To be implemented by derivated classes
|
To be implemented by derived classes
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def get_bookmarks(self):
|
def get_bookmarks(self):
|
||||||
"""
|
"""
|
||||||
To be implemented by derivated classes
|
To be implemented by derived classes
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def store_bookmarks(self):
|
def store_bookmarks(self):
|
||||||
"""
|
"""
|
||||||
To be implemented by derivated classes
|
To be implemented by derived classes
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def get_metacontacts(self):
|
def get_metacontacts(self):
|
||||||
"""
|
"""
|
||||||
To be implemented by derivated classes
|
To be implemented by derived classes
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def send_agent_status(self, agent, ptype):
|
def send_agent_status(self, agent, ptype):
|
||||||
"""
|
"""
|
||||||
To be implemented by derivated classes
|
To be implemented by derived classes
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
"""
|
"""
|
||||||
This module is in charge of taking care of all the infomation related to
|
This module is in charge of taking care of all the information related to
|
||||||
individual files. Files are identified by the account name and its sid.
|
individual files. Files are identified by the account name and its sid.
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class FilesProp:
|
||||||
_files_props = {}
|
_files_props = {}
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
raise Exception('this class should not be instatiated')
|
raise Exception('this class should not be instantiated')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def getNewFileProp(cls, account, sid):
|
def getNewFileProp(cls, account, sid):
|
||||||
|
@ -93,7 +93,7 @@ class FilesProp:
|
||||||
class FileProp(object):
|
class FileProp(object):
|
||||||
|
|
||||||
def __init__(self, account, sid):
|
def __init__(self, account, sid):
|
||||||
# Do not instatiate this class directly. Call FilesProp.getNeFileProp
|
# Do not instantiate this class directly. Call FilesProp.getNeFileProp
|
||||||
# instead
|
# instead
|
||||||
self.streamhosts = []
|
self.streamhosts = []
|
||||||
self.transfered_size = []
|
self.transfered_size = []
|
||||||
|
|
|
@ -76,7 +76,7 @@ class ConnectionJingle(object):
|
||||||
is a new session.
|
is a new session.
|
||||||
|
|
||||||
TODO: Also check if the stanza isn't an error stanza, if so route it
|
TODO: Also check if the stanza isn't an error stanza, if so route it
|
||||||
adequatelly.
|
adequately.
|
||||||
"""
|
"""
|
||||||
# get data
|
# get data
|
||||||
try:
|
try:
|
||||||
|
@ -209,7 +209,7 @@ class ConnectionJingle(object):
|
||||||
return sessions
|
return sessions
|
||||||
|
|
||||||
def set_file_info(self, file_):
|
def set_file_info(self, file_):
|
||||||
# Saves information about the files we have transfered in case they need
|
# Saves information about the files we have transferred in case they need
|
||||||
# to be requested again.
|
# to be requested again.
|
||||||
self.files.append(file_)
|
self.files.append(file_)
|
||||||
|
|
||||||
|
|
|
@ -466,7 +466,7 @@ class UserLocationPEP(AbstractPEP):
|
||||||
for entry in location.keys():
|
for entry in location.keys():
|
||||||
text = location[entry]
|
text = location[entry]
|
||||||
text = GLib.markup_escape_text(text)
|
text = GLib.markup_escape_text(text)
|
||||||
# Translate standart location tag
|
# Translate standard location tag
|
||||||
tag = LOCATION_DATA.get(entry, entry)
|
tag = LOCATION_DATA.get(entry, entry)
|
||||||
location_string += '\n<b>%(tag)s</b>: %(text)s' % \
|
location_string += '\n<b>%(tag)s</b>: %(text)s' % \
|
||||||
{'tag': tag.capitalize(), 'text': text}
|
{'tag': tag.capitalize(), 'text': text}
|
||||||
|
|
|
@ -80,7 +80,7 @@ class SocksQueue:
|
||||||
def start_listener(self, port, sha_str, sha_handler, file_props,
|
def start_listener(self, port, sha_str, sha_handler, file_props,
|
||||||
fingerprint=None, typ='sender'):
|
fingerprint=None, typ='sender'):
|
||||||
"""
|
"""
|
||||||
Start waiting for incomming connections on (host, port) and do a socks5
|
Start waiting for incoming connections on (host, port) and do a socks5
|
||||||
authentication using sid for generated SHA
|
authentication using sid for generated SHA
|
||||||
"""
|
"""
|
||||||
log.debug('Start listening for socks5 connection')
|
log.debug('Start listening for socks5 connection')
|
||||||
|
@ -190,7 +190,7 @@ class SocksQueue:
|
||||||
self.remove_receiver(streamhost['idx'])
|
self.remove_receiver(streamhost['idx'])
|
||||||
return
|
return
|
||||||
# set state -2, meaning that this streamhost is stopped,
|
# set state -2, meaning that this streamhost is stopped,
|
||||||
# but it may be connectected later
|
# but it may be connected later
|
||||||
if host['state'] >= 0:
|
if host['state'] >= 0:
|
||||||
if file_props.type_ == 's':
|
if file_props.type_ == 's':
|
||||||
self.remove_sender(host['idx'], False)
|
self.remove_sender(host['idx'], False)
|
||||||
|
@ -406,7 +406,7 @@ class SocksQueue:
|
||||||
|
|
||||||
def remove_receiver(self, idx, do_disconnect=True, remove_all=False):
|
def remove_receiver(self, idx, do_disconnect=True, remove_all=False):
|
||||||
"""
|
"""
|
||||||
Remove reciver from the list and decrease the number of active
|
Remove receiver from the list and decrease the number of active
|
||||||
connections with 1
|
connections with 1
|
||||||
"""
|
"""
|
||||||
if idx != -1:
|
if idx != -1:
|
||||||
|
|
|
@ -131,7 +131,7 @@ class CacheDictionary:
|
||||||
"""
|
"""
|
||||||
A dictionary that keeps items around for only a specific time. Lifetime is
|
A dictionary that keeps items around for only a specific time. Lifetime is
|
||||||
in minutes. Getrefresh specifies whether to refresh when an item is merely
|
in minutes. Getrefresh specifies whether to refresh when an item is merely
|
||||||
accessed instead of set aswell
|
accessed instead of set as well
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, lifetime, getrefresh = True):
|
def __init__(self, lifetime, getrefresh = True):
|
||||||
|
@ -2087,7 +2087,7 @@ class DiscussionGroupsBrowser(AgentBrowser):
|
||||||
def update_actions(self):
|
def update_actions(self):
|
||||||
"""
|
"""
|
||||||
Called when user selected a row. Make subscribe/unsubscribe buttons
|
Called when user selected a row. Make subscribe/unsubscribe buttons
|
||||||
sensitive appropriatelly
|
sensitive appropriately
|
||||||
"""
|
"""
|
||||||
# we have nothing to do if we don't have buttons...
|
# we have nothing to do if we don't have buttons...
|
||||||
if self.subscribe_button is None: return
|
if self.subscribe_button is None: return
|
||||||
|
|
|
@ -52,7 +52,7 @@ class GajimPlugin(object):
|
||||||
'''
|
'''
|
||||||
Short name of plugin.
|
Short name of plugin.
|
||||||
|
|
||||||
Used for quick indentification of plugin.
|
Used for quick identification of plugin.
|
||||||
|
|
||||||
:type: str
|
:type: str
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ class GajimPlugin(object):
|
||||||
Keys of this string should be strings with name of GUI extension point
|
Keys of this string should be strings with name of GUI extension point
|
||||||
to handles. Values should be 2-element tuples with references to handling
|
to handles. Values should be 2-element tuples with references to handling
|
||||||
functions. First function will be used to connect plugin with extpoint,
|
functions. First function will be used to connect plugin with extpoint,
|
||||||
the second one to successfuly disconnect from it. Connecting takes places
|
the second one to successfully disconnect from it. Connecting takes places
|
||||||
when plugin is activated and extpoint already exists, or when plugin is
|
when plugin is activated and extpoint already exists, or when plugin is
|
||||||
already activated but extpoint is being created (eg. chat window opens).
|
already activated but extpoint is being created (eg. chat window opens).
|
||||||
Disconnecting takes place when plugin is deactivated and extpoint exists
|
Disconnecting takes place when plugin is deactivated and extpoint exists
|
||||||
|
|
|
@ -51,7 +51,7 @@ class log_calls(object):
|
||||||
'GajimPluginConfigDialog', 'PluginsWindow']
|
'GajimPluginConfigDialog', 'PluginsWindow']
|
||||||
'''
|
'''
|
||||||
List of classes from which no logs should be emited when methods are called,
|
List of classes from which no logs should be emited when methods are called,
|
||||||
eventhough `log_calls` decorator is used.
|
even though `log_calls` decorator is used.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, classname='', log=log):
|
def __init__(self, classname='', log=log):
|
||||||
|
@ -60,7 +60,7 @@ class log_calls(object):
|
||||||
classname : str
|
classname : str
|
||||||
Name of class to prefix function name (if function is a method).
|
Name of class to prefix function name (if function is a method).
|
||||||
log : logging.Logger
|
log : logging.Logger
|
||||||
Logger to use when outputing debug information on when function has
|
Logger to use when outputting debug information on when function has
|
||||||
been entered and when left. By default: `plugins.helpers.log`
|
been entered and when left. By default: `plugins.helpers.log`
|
||||||
is used.
|
is used.
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -60,7 +60,7 @@ class PluginManager(metaclass=Singleton):
|
||||||
:todo: implement mechanism to dynamically load plugins where GUI extension
|
:todo: implement mechanism to dynamically load plugins where GUI extension
|
||||||
points have been already called (i.e. when plugin is activated
|
points have been already called (i.e. when plugin is activated
|
||||||
after GUI object creation). [DONE?]
|
after GUI object creation). [DONE?]
|
||||||
:todo: implement mechanism to dynamically deactive plugins (call plugin's
|
:todo: implement mechanism to dynamically deactivate plugins (call plugin's
|
||||||
deactivation handler) [DONE?]
|
deactivation handler) [DONE?]
|
||||||
:todo: when plug-in is deactivated all GUI extension points are removed
|
:todo: when plug-in is deactivated all GUI extension points are removed
|
||||||
from `PluginManager.gui_extension_points_handlers`. But when
|
from `PluginManager.gui_extension_points_handlers`. But when
|
||||||
|
@ -155,7 +155,7 @@ class PluginManager(metaclass=Singleton):
|
||||||
'''
|
'''
|
||||||
removes the plugin from the plugin list and deletes all loaded modules
|
removes the plugin from the plugin list and deletes all loaded modules
|
||||||
from sys. This way we will have a fresh start when the plugin gets added
|
from sys. This way we will have a fresh start when the plugin gets added
|
||||||
agin.
|
again.
|
||||||
'''
|
'''
|
||||||
if plugin.active:
|
if plugin.active:
|
||||||
self.deactivate_plugin(plugin)
|
self.deactivate_plugin(plugin)
|
||||||
|
@ -192,7 +192,7 @@ class PluginManager(metaclass=Singleton):
|
||||||
def extension_point(self, gui_extpoint_name, *args):
|
def extension_point(self, gui_extpoint_name, *args):
|
||||||
'''
|
'''
|
||||||
Invokes all handlers (from plugins) for a particular extension point, but
|
Invokes all handlers (from plugins) for a particular extension point, but
|
||||||
doesnt add it to collection for further processing.
|
doesn't add it to collection for further processing.
|
||||||
For example if you pass a message for encryption via extension point to a
|
For example if you pass a message for encryption via extension point to a
|
||||||
plugin, its undesired that the call is stored and replayed on activating the
|
plugin, its undesired that the call is stored and replayed on activating the
|
||||||
plugin. For example after an update.
|
plugin. For example after an update.
|
||||||
|
@ -487,7 +487,7 @@ class PluginManager(metaclass=Singleton):
|
||||||
:rtype: [] of class objects
|
:rtype: [] of class objects
|
||||||
|
|
||||||
:note: currently it only searches for plugin classes in '\*.py' files
|
:note: currently it only searches for plugin classes in '\*.py' files
|
||||||
present in given direcotory `path` (no recursion here)
|
present in given directory `path` (no recursion here)
|
||||||
|
|
||||||
:todo: add scanning zipped modules
|
:todo: add scanning zipped modules
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Add table
Reference in a new issue