Commit e23cbe36 authored by Emmanuel Gil Peyrot's avatar Emmanuel Gil Peyrot Committed by Philipp Hörist

Fix typos

Thanks codespell!
parent c0785403
Pipeline #5617 passed with stages
in 2 minutes and 47 seconds
......@@ -233,7 +233,7 @@ class ChatControl(ChatControlBase):
])
if self._type.is_chat:
# Dont connect this when PrivateChatControl is used
# Dont connect this when PrivateChatControl is used
self.register_event('update-roster-avatar', ged.GUI1, self._on_update_roster_avatar)
# pylint: enable=line-too-long
......@@ -1251,7 +1251,7 @@ class ChatControl(ChatControlBase):
def read_queue(self):
"""
Read queue and print messages containted in it
Read queue and print messages contained in it
"""
jid = self.contact.jid
jid_with_resource = jid
......
......@@ -855,11 +855,11 @@ class ChatControlBase(ChatCommandProcessor, CommandTools, EventHelper):
position = message_buffer.get_insert()
end = message_buffer.get_iter_at_mark(position)
text = message_buffer.get_text(start, end, False)
splitted = text.split()
split = text.split()
if (text.startswith(self.COMMAND_PREFIX) and
not text.startswith(self.COMMAND_PREFIX * 2) and
len(splitted) == 1):
text = splitted[0]
len(split) == 1):
text = split[0]
bare = text.lstrip(self.COMMAND_PREFIX)
if len(text) == 1:
self.command_hits = []
......@@ -1425,7 +1425,7 @@ class ChatControlBase(ChatCommandProcessor, CommandTools, EventHelper):
direction = Gdk.ScrollDirection.RIGHT
else:
app.log('autoscroll').warning(
'Scroll directions cant be determined')
'Scroll directions cant be determined')
if direction != Gdk.ScrollDirection.UP:
return
......
......@@ -87,7 +87,7 @@ gc_connected = {} # type: Dict[str, Dict[str, bool]]
# {room_jid: password}
gc_passwords = {} # type: Dict[str, str]
# dict of rooms that must be automaticaly configured
# dict of rooms that must be automatically 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]]]]
......
......@@ -124,7 +124,7 @@ class CommonContact(XMPPEntity):
if self.show == 'offline':
# Unfortunately, if all resources are offline, the contact
# includes the last resource that was online. Check for its
# show, so we can be sure it's existant. Otherwise, we still
# show, so we can be sure it's existent. Otherwise, we still
# return caps for a contact that has no resources left.
return False
......@@ -159,7 +159,7 @@ class Contact(CommonContact):
CommonContact.__init__(self, jid, account, resource, show,
None, status, name, chatstate)
self.contact_name = '' # nick choosen by contact
self.contact_name = '' # nick chosen by contact
self.groups = [i if i else _('General') for i in set(groups)] # filter duplicate values
self.avatar_sha = avatar_sha
self._is_groupchat = groupchat
......
......@@ -34,7 +34,7 @@ class PysqliteOperationalError(Exception):
class DatabaseMalformed(Exception):
"""
The databas can't be read
The database can't be read
"""
def __init__(self, path=''):
......
......@@ -432,9 +432,9 @@ def datetime_tuple(timestamp):
Because of various datetime formats are used the following exceptions
are handled:
- Optional milliseconds appened to the string are removed
- Optional Z (that means UTC) appened to the string are removed
- XEP-082 datetime strings have all '-' cahrs removed to meet
- Optional milliseconds appended to the string are removed
- Optional Z (that means UTC) appended to the string are removed
- XEP-082 datetime strings have all '-' chars removed to meet
the above format.
"""
date, tim = timestamp.split('T', 1)
......@@ -1518,7 +1518,7 @@ def is_affiliation_change_allowed(self_contact, contact, target_aff):
return False
if target_aff in ('admin', 'owner'):
# Admin cant edit admin/owner list
# Admin cant edit admin/owner list
return False
return self_contact.affiliation > contact.affiliation
......
......@@ -38,7 +38,7 @@ def get_locale_dirs():
path = gettext.find(DOMAIN)
if path is not None:
# gettext can find the location itself
# so we dont need the localedir
# so we dont need the localedir
return
if Path('/app/share/run-as-flatpak').exists():
......
......@@ -51,8 +51,8 @@ class State(IntEnum):
# This also includes any candidate-error received or sent
CAND_SENT_AND_RECEIVED = 4
TRANSPORT_REPLACE = 5
# We are transfering the file
TRANSFERING = 6
# We are transferring the file
TRANSFERRING = 6
class JingleFileTransfer(JingleContent):
......@@ -114,7 +114,7 @@ class JingleFileTransfer(JingleContent):
State.INITIALIZED : StateInitialized(self),
State.CAND_SENT : StateCandSent(self),
State.CAND_RECEIVED : StateCandReceived(self),
State.TRANSFERING : StateTransfering(self),
State.TRANSFERRING : StateTransfering(self),
State.TRANSPORT_REPLACE : StateTransportReplace(self),
State.CAND_SENT_AND_RECEIVED : StateCandSentAndRecv(self)
}
......@@ -167,7 +167,7 @@ class JingleFileTransfer(JingleContent):
self.session.connection.get_module('Jingle').set_file_info(file_info)
def _compute_hash(self):
# Caculates the hash and returns a xep-300 hash stanza
# Calculates the hash and returns a xep-300 hash stanza
if self.file_props.algo is None:
return
try:
......@@ -181,7 +181,7 @@ class JingleFileTransfer(JingleContent):
# DEBUG
#hash_ = '1294809248109223'
if not hash_:
# Hash alogrithm not supported
# Hash algorithm not supported
return
self.file_props.hash_ = hash_
h.addHash(hash_, self.file_props.algo)
......@@ -218,7 +218,7 @@ class JingleFileTransfer(JingleContent):
if self.session.werequest:
raise nbxmpp.NodeProcessed
# We send the file
self.__state_changed(State.TRANSFERING)
self.__state_changed(State.TRANSFERRING)
raise nbxmpp.NodeProcessed
self.file_props.streamhosts = self.transport.remote_candidates
# Calculate file hash in a new thread
......@@ -243,7 +243,7 @@ class JingleFileTransfer(JingleContent):
fingerprint=fingerprint,
receiving=False)
raise nbxmpp.NodeProcessed
self.__state_changed(State.TRANSFERING)
self.__state_changed(State.TRANSFERRING)
raise nbxmpp.NodeProcessed
def __on_session_terminate(self, stanza, content, error, action):
......@@ -282,7 +282,7 @@ class JingleFileTransfer(JingleContent):
response = stanza.buildReply('result')
response.delChild(response.getQuery())
self.session.connection.connection.send(response)
self.__state_changed(State.TRANSFERING)
self.__state_changed(State.TRANSFERRING)
raise nbxmpp.NodeProcessed
else:
args = {'candError' : True}
......@@ -300,7 +300,7 @@ class JingleFileTransfer(JingleContent):
not app.socks5queue.listener.connections:
app.socks5queue.listener.disconnect()
if content.getTag('transport').getTag('activated'):
self.state = State.TRANSFERING
self.state = State.TRANSFERRING
app.socks5queue.send_file(self.file_props,
self.session.connection.name, 'client')
return
......@@ -308,7 +308,7 @@ class JingleFileTransfer(JingleContent):
'sendCand': False}
if self.state == State.CAND_SENT:
self.__state_changed(State.CAND_SENT_AND_RECEIVED, args)
self.__state_changed(State.TRANSFERING)
self.__state_changed(State.TRANSFERRING)
raise nbxmpp.NodeProcessed
self.__state_changed(State.CAND_RECEIVED, args)
......@@ -325,14 +325,14 @@ class JingleFileTransfer(JingleContent):
self.__state_changed(State.TRANSPORT_REPLACE)
return
# initiate transfer
self.__state_changed(State.TRANSFERING)
self.__state_changed(State.TRANSFERRING)
def __transport_setup(self, stanza=None, content=None, error=None,
action=None):
# Sets up a few transport specific things for the file transfer
if self.transport.type_ == TransportType.IBB:
# No action required, just set the state to transfering
self.state = State.TRANSFERING
# No action required, just set the state to transferring
self.state = State.TRANSFERRING
else:
self._listen_host()
......@@ -401,7 +401,7 @@ class JingleFileTransfer(JingleContent):
def start_ibb_transfer(self):
if self.file_props.type_ == 's':
self.__state_changed(State.TRANSFERING)
self.__state_changed(State.TRANSFERRING)
def get_content(desc):
......
......@@ -35,7 +35,7 @@ class JingleFileTransferStates:
def action(self, args=None):
'''
This method MUST be overriden by a subclass
This method MUST be overridden by a subclass
'''
raise NotImplementedError('This is an abstract method!')
......@@ -107,7 +107,7 @@ class StateCandReceived(JingleFileTransferStates):
streamhost_used = cand
break
if streamhost_used is None:
log.info("unknow streamhost")
log.info("unknown streamhost")
return
# We save the candidate nominated by peer
self.jft.nominated_cand['peer-cand'] = streamhost_used
......@@ -141,7 +141,7 @@ class StateTransportReplace(JingleFileTransferStates):
class StateTransfering(JingleFileTransferStates):
'''
This state will start the transfer depeding on the type of transport
This state will start the transfer depending on the type of transport
we have.
'''
......@@ -153,7 +153,7 @@ class StateTransfering(JingleFileTransferStates):
fp)
def _start_sock5_transfer(self):
# It tells wether we start the transfer as client or server
# It tells whether we start the transfer as client or server
mode = None
if self.jft.is_our_candidate_used():
mode = 'client'
......
......@@ -134,8 +134,8 @@ class JingleRTPContent(JingleContent):
def add_remote_candidates(self, candidates):
JingleContent.add_remote_candidates(self, candidates)
# FIXME: connectivity should not be etablished yet
# Instead, it should be etablished after session-accept!
# FIXME: connectivity should not be established yet
# Instead, it should be established after session-accept!
if self.sent:
self.p2pstream.add_remote_candidates(candidates)
......@@ -347,13 +347,13 @@ class JingleAudio(JingleRTPContent):
def set_mic_volume(self, vol):
"""
vol must be between 0 ans 1
vol must be between 0 and 1
"""
self.mic_volume.set_property('volume', vol)
def set_out_volume(self, vol):
"""
vol must be between 0 ans 1
vol must be between 0 and 1
"""
self.out_volume.set_property('volume', vol)
......
......@@ -562,7 +562,7 @@ class JingleSession:
pjid, hash_data, n, self.connection.name)
if not file_info:
log.warning('The peer %s is requesting a ' \
'file that we dont have or ' \
'file that we dont have or ' \
'it is not allowed to request', pjid)
self.decline_session()
raise nbxmpp.NodeProcessed
......
......@@ -242,7 +242,7 @@ def createCertificate(req, issuerCert, issuerKey, serial, notBefore, notAfter, d
"""
Generate a certificate given a certificate request.
Arguments: req - Certificate reqeust to use
Arguments: req - Certificate request to use
issuerCert - The certificate of the issuer
issuerKey - The private key of the issuer
serial - Serial number for the certificate
......
......@@ -354,7 +354,7 @@ class Logger:
@staticmethod
def _execute_multiple(con, statements):
"""
Execute mutliple statements with the option to fail on duplicates
Execute multiple statements with the option to fail on duplicates
but still continue
"""
for sql in statements:
......@@ -480,7 +480,7 @@ class Logger:
If jid is gajim@conf/nkour it's likely a pm one, how we know gajim@conf
is not a normal guy and nkour is not his resource? we ask if gajim@conf
is already in jids (with type room jid) this fails if user disables
logging for room and only enables for pm (so higly unlikely) and if we
logging for room and only enables for pm (so highly unlikely) and if we
fail we do not go chaos (user will see the first pm as if it was message
in room's public chat) and after that all okay
"""
......@@ -750,7 +750,7 @@ class Logger:
Get recent messages
Pending messages are already in queue to be printed when the
ChatControl is opened, so we dont want to request those messages.
ChatControl is opened, so we dont want to request those messages.
How many messages are requested depends on the 'restore_lines'
config value. How far back in time messages are requested depends on
_get_timeout().
......@@ -759,7 +759,7 @@ class Logger:
:param jid: The jid from which we request the conversation lines
:param pending: How many messages are currently pending so we dont
:param pending: How many messages are currently pending so we dont
request those messages
returns a list of namedtuples
......@@ -849,7 +849,7 @@ class Logger:
Search the conversation log for messages containing the `query` string.
The search can either span the complete log for the given
`account` and `jid` or be restriced to a single day by
`account` and `jid` or be restricted to a single day by
specifying `date`.
:param account: The account
......@@ -1192,7 +1192,7 @@ class Logger:
data = {}
account_jid_id = self.get_jid_id(account_jid, type_=JIDConstant.NORMAL_TYPE)
# First we fill data with roster_entry informations
# First we fill data with roster_entry information
rows = self._con.execute('''
SELECT j.jid, re.jid_id, re.name, re.subscription, re.ask, re.avatar_sha
FROM roster_entry re, jids j
......
......@@ -22,7 +22,7 @@ from gajim.common.i18n import _
def parseLogLevel(arg):
"""
Eiter numeric value or level name from logging module
Either numeric value or level name from logging module
"""
if arg.isdigit():
return int(arg)
......
......@@ -40,7 +40,7 @@ class AdHocCommand:
@staticmethod
def is_visible_for(_samejid):
"""
This returns True if that command should be visible and invokable for
This returns True if that command should be visible and invocable for
others
samejid - True when command is invoked by an entity with the same bare
......
......@@ -58,7 +58,7 @@ class BaseModule(EventHelper):
key, self.__class__.__name__))
if not app.account_is_connected(self._account):
self._log.warning('Account not connected, cant use %s', key)
self._log.warning('Account not connected, cant use %s', key)
return None
module = self._con.connection.get_module(self._nbxmpp_extends)
......@@ -70,7 +70,7 @@ class BaseModule(EventHelper):
def _nbxmpp(self, module_name=None):
if not app.account_is_connected(self._account):
self._log.warning('Account not connected, cant use nbxmpp method')
self._log.warning('Account not connected, cant use nbxmpp method')
return Mock()
if module_name is None:
......
......@@ -79,7 +79,7 @@ class BitsOfBinary(BaseModule):
del self.awaiting_cids[cid]
return
# An error occured, call callback without modifying data.
# An error occurred, call callback without modifying data.
for func in self.awaiting_cids[cid]:
cb = func[0]
args = func[1]
......
......@@ -74,8 +74,8 @@ class Blocking(BaseModule):
def _blocking_push_received(self, _con, stanza, _properties):
reply = stanza.buildReply('result')
childs = reply.getChildren()
for child in childs:
children = reply.getChildren()
for child in children:
reply.delChild(child)
self._nbxmpp().send(reply)
......
......@@ -133,7 +133,7 @@ class Bytestream(BaseModule):
"""
Send iq, confirming that we want to download the file
"""
# user response to ConfirmationDialog may come after we've disconneted
# user response to ConfirmationDialog may come after we've disconnected
if not app.account_is_available(self._account):
return
......
......@@ -223,7 +223,7 @@ class Chatstate(BaseModule):
return None
if not contact.is_groupchat:
# Dont send chatstates to ourself
# Dont send chatstates to ourself
if self._con.get_own_jid().bareMatch(contact.jid):
return None
......@@ -255,7 +255,7 @@ class Chatstate(BaseModule):
@ensure_enabled
def set_chatstate(self, contact: ContactT, state: State) -> None:
# Dont send chatstates to ourself
# Dont send chatstates to ourself
if self._con.get_own_jid().bareMatch(contact.jid):
return
......@@ -280,7 +280,7 @@ class Chatstate(BaseModule):
return
if not contact.is_groupchat:
# Dont leak presence to contacts
# Dont leak presence to contacts
# which are not allowed to see our status
if not contact.is_pm_contact:
if contact and contact.sub in ('to', 'none'):
......
......@@ -84,7 +84,7 @@ class EntityTime(BaseModule):
utc_time = time_.getTag('utc').getData()
date_time = parse_datetime(utc_time, check_utc=True)
if date_time is None:
self._log.warning('Wrong timezone defintion: %s %s',
self._log.warning('Wrong timezone definition: %s %s',
utc_time, stanza.getFrom())
return None
......
......@@ -199,7 +199,7 @@ class HTTPUpload(BaseModule):
message = Soup.Message.new('PUT', transfer.put_uri)
message.connect('starting', self._check_certificate)
# Set CAN_REBUILD so chunks get discarded after they are beeing
# Set CAN_REBUILD so chunks get discarded after they have been
# written to the network
message.set_flags(Soup.MessageFlags.CAN_REBUILD |
Soup.MessageFlags.NO_REDIRECT)
......
......@@ -23,7 +23,7 @@ Handles the jingle signalling protocol
# * XEP 0177 (raw udp)
# * UI:
# - make state and codec informations available to the user
# - make state and codec information available to the user
# - video integration
# * config:
# - codecs
......
......@@ -112,7 +112,8 @@ class Message(BaseModule):
if properties.type.is_groupchat and properties.has_server_delay:
# Only for XEP-0045 MUC History
# Dont check for message text because the message could be encrypted
# Don’t check for message text because the message could be
# encrypted.
if app.logger.deduplicate_muc_message(self._account,
properties.jid.getBare(),
properties.jid.getResource(),
......
......@@ -12,7 +12,7 @@
# You should have received a copy of the GNU General Public License
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
# All XEPs that dont need their own module
# All XEPs that dont need their own module
import logging
......
......@@ -592,7 +592,7 @@ class MUC(BaseModule):
raise nbxmpp.NodeProcessed
def _fake_subject_change(self, room_jid):
# This is for servers which dont send empty subjects as part of the
# This is for servers which dont send empty subjects as part of the
# event order on joining a MUC. For example jabber.ru
self._log.warning('Fake subject received for %s', room_jid)
del self._join_timeouts[room_jid]
......@@ -655,7 +655,7 @@ class MUC(BaseModule):
return
if properties.is_mam_message:
# Some servers store captcha challenges in MAM, dont process them
# Some servers store captcha challenges in MAM, dont process them
self._log.warning('Ignore captcha challenge received from MAM')
raise nbxmpp.NodeProcessed
......
......@@ -173,7 +173,7 @@ class Presence(BaseModule):
contact.resource = resource
app.contacts.add_contact(self._account, contact)
else:
# Convert the inital roster contact to a contact with resource
# Convert the initial roster contact to a contact with resource
contact.resource = resource
event.old_show = 0
if contact.show in status_strings:
......
......@@ -95,7 +95,7 @@ class PrivacyLists(BaseModule):
self._log.info('Received lists: %s', lists)
# Download default list if we dont have it
# Download default list if we dont have it
if self.default_list != new_default:
self.default_list = new_default
if new_default is not None:
......@@ -132,11 +132,11 @@ class PrivacyLists(BaseModule):
item = child.getAttrs()
childs = []
children = []
for scnd_child in child.getChildren():
childs.append(scnd_child.getName())
children.append(scnd_child.getName())
item['child'] = childs
item['child'] = children
if len(item) not in (3, 5):
self._log.warning('Wrong count of attrs: %s', stanza)
continue
......@@ -171,8 +171,8 @@ class PrivacyLists(BaseModule):
node = nbxmpp.Node('list', {'name': name})
iq = nbxmpp.Iq('set', Namespace.PRIVACY, payload=[node])
for item in rules:
childs = item.get('child', [])
for child in childs:
children = item.get('child', [])
for child in children:
node.setTag(child)
item.pop('child', None)
node.setTag('item', item)
......
......@@ -88,7 +88,8 @@ class Roster(BaseModule):
def _roster_received(self, _nbxmpp_client, stanza):
if not nbxmpp.isResultNode(stanza):
self._log.warning('Unable to retrive roster: %s', stanza.getError())
self._log.warning('Unable to retrieve roster: %s',
stanza.getError())
else:
self._log.info('Received Roster')
received_from_server = False
......@@ -162,7 +163,7 @@ class Roster(BaseModule):
Omit avatar_sha from the returned attrs
update: False
Include the default value fro avatar_sha in the returned attrs
Include the default value from avatar_sha in the returned attrs
'''
default_attrs = {'name': None,
......
......@@ -63,7 +63,7 @@ class VCardAvatars(BaseModule):
# Initial presence reflection
if self._con.avatar_conversion:
# XEP-0398: Tells us the current avatar sha on the
# inital presence reflection
# initial presence reflection
self._self_update_received(properties)
else:
# Presence from another resource of ours
......@@ -115,7 +115,7 @@ class VCardAvatars(BaseModule):
field_var = '{http://modules.prosody.im/mod_vcard_muc}avatar#sha1'
if not disco_info.has_field(Namespace.MUC_INFO, field_var):
# Workaround so we dont delete the avatar for servers that dont
# Workaround so we don’t delete the avatar for servers that don’t
# support sha in disco info. Once there is a accepted XEP this
# can be removed
return
......
......@@ -333,7 +333,7 @@ class SocksQueue:
def isHashInSockObjs(self, sockobjs, hash_):
'''
It tells wether there is a particular hash in sockobjs or not
It tells whether there is a particular hash in sockobjs or not
'''
for key in sockobjs:
if hash_ in key:
......@@ -1394,7 +1394,7 @@ class Socks5ReceiverServer(Socks5Server, Socks5Receiver):
class Socks5Listener(IdleObject):
def __init__(self, idlequeue, port, fp, fingerprint=None):
"""
Handle all incomming connections on (0.0.0.0, port)
Handle all incoming connections on (0.0.0.0, port)
This class implements IdleObject, but we will expect
only pollin events though
......@@ -1464,7 +1464,7 @@ class Socks5Listener(IdleObject):
def pollin(self):
"""
Accept a new incomming connection and notify queue
Accept a new incoming connection and notify queue
"""
sock = self.accept_conn()
self.queue.on_connection_accepted(sock, self)
......@@ -1485,7 +1485,7 @@ class Socks5Listener(IdleObject):
def accept_conn(self):
"""
Accept a new incomming connection
Accept a new incoming connection
"""
_sock = self._serv.accept()
_sock[0].setblocking(False)
......
......@@ -51,7 +51,7 @@ ACTIVITY_TIMEOUT_SECONDS = 30
class ZeroconfListener(IdleObject):
def __init__(self, port, conn_holder):
"""
Handle all incomming connections on ('0.0.0.0', port)
Handle all incoming connections on ('0.0.0.0', port)
"""
self.port = port
self.queue_idx = -1
......@@ -97,7 +97,7 @@ class ZeroconfListener(IdleObject):
def pollin(self):
"""
Accept a new incomming connection and notify queue
Accept a new incoming connection and notify queue
"""
sock = self.accept_conn()
# loop through roster to find who has connected to us
......@@ -162,7 +162,7 @@ class P2PClient(IdleObject):
self.on_connect, self)
self.Server = conn.host # set Server to the last host name / address tried
if not self.conn_holder:
# An error occured, disconnect() has been called
# An error occurred, disconnect() has been called
if on_not_ok:
on_not_ok('Connection to host could not be established.')
return
......@@ -426,7 +426,7 @@ class P2PConnection(IdleObject, PlugIn):
self.on_receive = None
return
_tmp = self.on_receive
# make sure this cb is not overriden by recursive calls
# make sure this cb is not overridden by recursive calls
if not recv_handler(None) and _tmp == self.on_receive:
self.on_receive = recv_handler
......@@ -518,7 +518,7 @@ class P2PConnection(IdleObject, PlugIn):
pass
elif errnum in [errno.ECONNRESET, errno.ENOTCONN, errno.ESHUTDOWN]:
self.pollend()
# don't proccess result, cas it will raise error
# don’t process result, in case it will raise an error
return
elif not received:
if errnum != ssl.SSL_ERROR_EOF:
......
......@@ -48,7 +48,7 @@ class ConnectionHandlersZeroconf(connection_handlers.ConnectionHandlersBase):
return
log.info('Zeroconf MessageCB')
# Dont trust from attr set by sender
# Dont trust from attr set by sender
stanza.setFrom(con._owner.to)
app.nec.push_incoming_event(NetworkEvent(
......
......@@ -33,7 +33,7 @@ class ServerState(IntEnum):
class EntryGroup(IntEnum):
UNCOMMITED = 0
UNCOMMITTED = 0
REGISTERING = 1
ESTABLISHED = 2
COLLISION = 3
......
......@@ -393,7 +393,7 @@ class Zeroconf:
log.error('Error while browsing for services. %s', error)
return True
# resolve_all() is called every X seconds and querys for new clients
# resolve_all() is called every X seconds and queries for new clients