Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonathan Schleifer <js@webkeks.org>2009-06-15 23:00:14 +0400
committerJonathan Schleifer <js@webkeks.org>2009-06-15 23:00:14 +0400
commit086d0313749715b29b44087eba5f7531123d3a9d (patch)
treeeee8fa73d7f14bb8e5432c13f22e94b0e5ea982b /src
parent2327600745cf06c79a8a653a0714d1ab7a808b9c (diff)
Remove spaces at EOL.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am18
-rw-r--r--src/advanced.py16
-rw-r--r--src/common/connection.py10
-rw-r--r--src/common/dataforms.py80
-rw-r--r--src/common/optparser.py2
-rw-r--r--src/common/resolver.py36
-rw-r--r--src/common/xmpp/auth_nb.py12
-rw-r--r--src/common/xmpp/bosh.py42
-rw-r--r--src/common/xmpp/client_nb.py32
-rw-r--r--src/common/xmpp/dispatcher_nb.py36
-rw-r--r--src/common/xmpp/features_nb.py10
-rw-r--r--src/common/xmpp/idlequeue.py78
-rw-r--r--src/common/xmpp/plugin.py12
-rw-r--r--src/common/xmpp/proxy_connectors.py20
-rw-r--r--src/common/xmpp/roster_nb.py6
-rw-r--r--src/common/xmpp/simplexml.py2
-rw-r--r--src/common/xmpp/tls_nb.py14
-rw-r--r--src/common/xmpp/transports_nb.py48
-rw-r--r--src/config.py18
-rw-r--r--src/dialogs.py4
-rw-r--r--src/eggtrayicon.c4
-rw-r--r--src/ipython_view.py2
-rw-r--r--src/message_textview.py2
-rw-r--r--src/network_manager_listener.py40
-rw-r--r--src/systray.py4
-rw-r--r--src/trayiconmodule.c4
26 files changed, 276 insertions, 276 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 9cbe07d3b..2915635cd 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,7 +3,7 @@ SUBDIRS = osx
CLEANFILES = \
trayicon.c
INCLUDES = \
- $(PYTHON_INCLUDES)
+ $(PYTHON_INCLUDES)
export MACOSX_DEPLOYMENT_TARGET=10.4
if BUILD_TRAYICON
@@ -18,10 +18,10 @@ nodist_trayicon_la_SOURCES = \
trayicon.c
trayicon_la_LDFLAGS = \
- -module -avoid-version
+ -module -avoid-version
trayicon_la_CFLAGS = $(PYGTK_CFLAGS)
-trayicon.c:
+trayicon.c:
pygtk-codegen-2.0 --prefix trayicon \
--register $(PYGTK_DEFS)/gdk-types.defs \
--register $(PYGTK_DEFS)/gtk-types.defs \
@@ -29,21 +29,21 @@ trayicon.c:
$(srcdir)/trayicon.defs > $@
endif
gajimsrcdir = $(pkgdatadir)/src
-gajimsrc_PYTHON = $(srcdir)/*.py
+gajimsrc_PYTHON = $(srcdir)/*.py
gajimsrc1dir = $(pkgdatadir)/src/common
gajimsrc1_PYTHON = \
- $(srcdir)/common/*.py
+ $(srcdir)/common/*.py
gajimsrc2dir = $(pkgdatadir)/src/common/xmpp
gajimsrc2_PYTHON = \
- $(srcdir)/common/xmpp/*.py
+ $(srcdir)/common/xmpp/*.py
gajimsrc3dir = $(pkgdatadir)/src/common/zeroconf
gajimsrc3_PYTHON = \
- $(srcdir)/common/zeroconf/*.py
+ $(srcdir)/common/zeroconf/*.py
-DISTCLEANFILES =
+DISTCLEANFILES =
EXTRA_DIST = $(gajimsrc_PYTHON) \
$(gajimsrc1_PYTHON) \
@@ -53,7 +53,7 @@ EXTRA_DIST = $(gajimsrc_PYTHON) \
trayiconmodule.c \
eggtrayicon.h \
trayicon.defs \
- trayicon.override
+ trayicon.override
dist-hook:
rm -f $(distdir)/ipython_view.py
diff --git a/src/advanced.py b/src/advanced.py
index ea6a4d580..d96e4ce92 100644
--- a/src/advanced.py
+++ b/src/advanced.py
@@ -268,14 +268,14 @@ class AdvancedConfigurationWindow(object):
def visible_func(self, model, treeiter):
search_string = self.entry.get_text().lower()
- for it in tree_model_pre_order(model,treeiter):
- if model[it][C_TYPE] != '':
- opt_path = self.get_option_path(model, it)
- if len(opt_path) == 3:
- desc = gajim.config.get_desc_per(opt_path[2], opt_path[1],
- opt_path[0])
- elif len(opt_path) == 1:
- desc = gajim.config.get_desc(opt_path[0])
+ for it in tree_model_pre_order(model,treeiter):
+ if model[it][C_TYPE] != '':
+ opt_path = self.get_option_path(model, it)
+ if len(opt_path) == 3:
+ desc = gajim.config.get_desc_per(opt_path[2], opt_path[1],
+ opt_path[0])
+ elif len(opt_path) == 1:
+ desc = gajim.config.get_desc(opt_path[0])
if search_string in model[it][C_PREFNAME] or (desc and \
search_string in desc.lower()):
return True
diff --git a/src/common/connection.py b/src/common/connection.py
index 362631095..74a91c22f 100644
--- a/src/common/connection.py
+++ b/src/common/connection.py
@@ -727,11 +727,11 @@ class Connection(ConnectionHandlers):
gajim.config.set_per('accounts', self.name, 'ssl_fingerprint_sha1',
con.Connection.ssl_fingerprint_sha1)
self._register_handlers(con, con_type)
- con.auth(
- user=name,
- password=self.password,
- resource=self.server_resource,
- sasl=1,
+ con.auth(
+ user=name,
+ password=self.password,
+ resource=self.server_resource,
+ sasl=1,
on_auth=self.__on_auth)
def ssl_certificate_accepted(self):
diff --git a/src/common/dataforms.py b/src/common/dataforms.py
index 788a91501..bd9c3e15f 100644
--- a/src/common/dataforms.py
+++ b/src/common/dataforms.py
@@ -104,7 +104,7 @@ class DataField(ExtendedNode):
""" Keeps data about one field - var, field type, labels, instructions...
Base class for different kinds of fields. Use Field() function to
construct one of these. """
-
+
def __init__(self, typ=None, var=None, value=None, label=None, desc=None,
required=False, options=None, extend=None):
@@ -137,7 +137,7 @@ class DataField(ExtendedNode):
def fset(self, value):
assert isinstance(value, basestring)
self.setAttr('type', value)
-
+
return locals()
@nested_property
@@ -152,7 +152,7 @@ class DataField(ExtendedNode):
def fdel(self):
self.delAttr('var')
-
+
return locals()
@nested_property
@@ -163,15 +163,15 @@ class DataField(ExtendedNode):
if not l:
l = self.var
return l
-
+
def fset(self, value):
assert isinstance(value, basestring)
self.setAttr('label', value)
-
+
def fdel(self):
if self.getAttr('label'):
self.delAttr('label')
-
+
return locals()
@nested_property
@@ -179,19 +179,19 @@ class DataField(ExtendedNode):
'''Human-readable description of field meaning.'''
def fget(self):
return self.getTagData('desc') or u''
-
+
def fset(self, value):
assert isinstance(value, basestring)
if value == '':
fdel(self)
else:
self.setTagData('desc', value)
-
+
def fdel(self):
t = self.getTag('desc')
if t is not None:
self.delChild(t)
-
+
return locals()
@nested_property
@@ -199,14 +199,14 @@ class DataField(ExtendedNode):
'''Controls whether this field required to fill. Boolean.'''
def fget(self):
return bool(self.getTag('required'))
-
+
def fset(self, value):
t = self.getTag('required')
if t and not value:
self.delChild(t)
elif not t and value:
self.addChild('required')
-
+
return locals()
class BooleanField(DataField):
@@ -222,15 +222,15 @@ class BooleanField(DataField):
if v is None:
return False # default value is False
raise WrongFieldValue
-
+
def fset(self, value):
self.setTagData('value', value and '1' or '0')
-
+
def fdel(self, value):
t = self.getTag('value')
if t is not None:
self.delChild(t)
-
+
return locals()
class StringField(DataField):
@@ -240,19 +240,19 @@ class StringField(DataField):
'''Value of field. May be any unicode string.'''
def fget(self):
return self.getTagData('value') or u''
-
+
def fset(self, value):
assert isinstance(value, basestring)
if value == '':
return fdel(self)
self.setTagData('value', value)
-
+
def fdel(self):
try:
self.delChild(self.getTag('value'))
except ValueError: # if there already were no value tag
pass
-
+
return locals()
class ListField(DataField):
@@ -271,16 +271,16 @@ class ListField(DataField):
l = v
options.append((l, v))
return options
-
+
def fset(self, values):
fdel(self)
for value, label in values:
self.addChild('option', {'label': label}).setTagData('value', value)
-
+
def fdel(self):
for element in self.getTags('option'):
self.delChild(element)
-
+
return locals()
def iter_options(self):
@@ -307,16 +307,16 @@ class ListMultiField(ListField):
for element in self.getTags('value'):
values.append(element.getData())
return values
-
+
def fset(self, values):
fdel(self)
for value in values:
self.addChild('value').setData(value)
-
+
def fdel(self):
for element in self.getTags('value'):
self.delChild(element)
-
+
return locals()
def iter_values(self):
@@ -332,18 +332,18 @@ class TextMultiField(DataField):
for element in self.iterTags('value'):
value += '\n' + element.getData()
return value[1:]
-
+
def fset(self, value):
fdel(self)
if value == '':
return
for line in value.split('\n'):
self.addChild('value').setData(line)
-
+
def fdel(self):
for element in self.getTags('value'):
self.delChild(element)
-
+
return locals()
class DataRecord(ExtendedNode):
@@ -376,18 +376,18 @@ class DataRecord(ExtendedNode):
'''List of fields in this record.'''
def fget(self):
return self.getTags('field')
-
+
def fset(self, fields):
fdel(self)
for field in fields:
if not isinstance(field, DataField):
ExtendField(extend=field)
self.addChild(node=field)
-
+
def fdel(self):
for element in self.getTags('field'):
self.delChild(element)
-
+
return locals()
def iter_fields(self):
@@ -425,11 +425,11 @@ class DataForm(ExtendedNode):
filledform = DataForm(replyto=thisform)...'''
def fget(self):
return self.getAttr('type')
-
+
def fset(self, type_):
assert type_ in ('form', 'submit', 'cancel', 'result')
self.setAttr('type', type_)
-
+
return locals()
@nested_property
@@ -437,16 +437,16 @@ class DataForm(ExtendedNode):
''' Title of the form. Human-readable, should not contain any \\r\\n.'''
def fget(self):
return self.getTagData('title')
-
+
def fset(self, title):
self.setTagData('title', title)
-
+
def fdel(self):
try:
self.delChild('title')
except ValueError:
pass
-
+
return locals()
@nested_property
@@ -458,17 +458,17 @@ class DataForm(ExtendedNode):
for valuenode in self.getTags('instructions'):
value += '\n' + valuenode.getData()
return value[1:]
-
+
def fset(self, value):
fdel(self)
if value == '': return
for line in value.split('\n'):
self.addChild('instructions').setData(line)
-
+
def fdel(self):
for value in self.getTags('instructions'):
self.delChild(value)
-
+
return locals()
class SimpleDataForm(DataForm, DataRecord):
@@ -523,18 +523,18 @@ class MultipleDataForm(DataForm):
''' A list of all records. '''
def fget(self):
return list(self.iter_records())
-
+
def fset(self, records):
fdel(self)
for record in records:
if not isinstance(record, DataRecord):
DataRecord(extend=record)
self.addChild(node=record)
-
+
def fdel(self):
for record in self.getTags('item'):
self.delChild(record)
-
+
return locals()
def iter_records(self):
diff --git a/src/common/optparser.py b/src/common/optparser.py
index 975330518..8ea23b037 100644
--- a/src/common/optparser.py
+++ b/src/common/optparser.py
@@ -618,7 +618,7 @@ class OptionsParser:
replace(' xmpp', '')
gajim.config.set('uri_schemes', new_values)
gajim.config.set('version', '0.12.0.1')
-
+
def update_config_to_01211(self):
if 'trayicon' in self.old_values:
if self.old_values['trayicon'] == 'False':
diff --git a/src/common/resolver.py b/src/common/resolver.py
index efcfc0b78..0be528f38 100644
--- a/src/common/resolver.py
+++ b/src/common/resolver.py
@@ -34,7 +34,7 @@ host_pattern = re.compile('^[a-z0-9\-._]*[a-z0-9]\.[a-z]{2,}$')
try:
#raise ImportError("Manually disabled libasync")
- import libasyncns
+ import libasyncns
USE_LIBASYNCNS = True
log.info("libasyncns-python loaded")
except ImportError:
@@ -75,7 +75,7 @@ class CommonResolver():
return
if self.handlers.has_key(host+type):
# host is about to be resolved by another connection,
- # attach our callback
+ # attach our callback
self.handlers[host+type].append(on_ready)
else:
# host has never been resolved, start now
@@ -97,10 +97,10 @@ class CommonResolver():
# FIXME: API usage is not consistent! This one requires that process is called
class LibAsyncNSResolver(CommonResolver):
'''
- Asynchronous resolver using libasyncns-python. process() method has to be
+ Asynchronous resolver using libasyncns-python. process() method has to be
called in order to proceed the pending requests.
- Based on patch submitted by Damien Thebault.
- '''
+ Based on patch submitted by Damien Thebault.
+ '''
def __init__(self):
self.asyncns = libasyncns.Asyncns()
CommonResolver.__init__(self)
@@ -163,16 +163,16 @@ class NSLookupResolver(CommonResolver):
self.idlequeue = idlequeue
self.process = False
CommonResolver.__init__(self)
-
+
def parse_srv_result(self, fqdn, result):
- ''' parse the output of nslookup command and return list of
+ ''' parse the output of nslookup command and return list of
properties: 'host', 'port','weight', 'priority' corresponding to the found
srv hosts '''
if os.name == 'nt':
return self._parse_srv_result_nt(fqdn, result)
elif os.name == 'posix':
return self._parse_srv_result_posix(fqdn, result)
-
+
def _parse_srv_result_nt(self, fqdn, result):
# output from win32 nslookup command
if not result:
@@ -195,7 +195,7 @@ class NSLookupResolver(CommonResolver):
hosts.append(current_host)
current_host = None
continue
- prop_type = res[0].strip()
+ prop_type = res[0].strip()
prop_value = res[1].strip()
if prop_type.find('prio') > -1:
try:
@@ -221,7 +221,7 @@ class NSLookupResolver(CommonResolver):
hosts.append(current_host)
current_host = None
return hosts
-
+
def _parse_srv_result_posix(self, fqdn, result):
# typical output of bind-tools nslookup command:
# _xmpp-client._tcp.jabber.org service = 30 30 5222 jabber.org.
@@ -261,12 +261,12 @@ class NSLookupResolver(CommonResolver):
hosts.append({'host': host, 'port': port, 'weight': weight,
'prio': prio})
return hosts
-
+
def _on_ready(self, host, type, result):
# nslookup finished, parse the result and call the handlers
result_list = self.parse_srv_result(host, result)
CommonResolver._on_ready(self, host, type, result_list)
-
+
def start_resolve(self, host, type):
''' spawn new nslookup process and start waiting for results '''
ns = NsLookup(self._on_ready, host, type)
@@ -278,7 +278,7 @@ class NSLookupResolver(CommonResolver):
class NsLookup(IdleCommand):
def __init__(self, on_result, host='_xmpp-client', type='srv'):
IdleCommand.__init__(self, on_result)
- self.commandtimeout = 10
+ self.commandtimeout = 10
self.host = host.lower()
self.type = type.lower()
if not host_pattern.match(self.host):
@@ -290,24 +290,24 @@ class NsLookup(IdleCommand):
log.error('Invalid querytype: %s' % self.type)
self.canexecute = False
return
-
+
def _compose_command_args(self):
return ['nslookup', '-type=' + self.type , self.host]
-
+
def _return_result(self):
if self.result_handler:
self.result_handler(self.host, self.type, self.result)
self.result_handler = None
-
+
# below lines is on how to use API and assist in testing
if __name__ == '__main__':
import gobject
import gtk
from xmpp import idlequeue
-
+
idlequeue = idlequeue.get_idlequeue()
resolver = get_resolver(idlequeue)
-
+
def clicked(widget):
global resolver
host = text_view.get_text()
diff --git a/src/common/xmpp/auth_nb.py b/src/common/xmpp/auth_nb.py
index 65148ffb7..f5fe786dc 100644
--- a/src/common/xmpp/auth_nb.py
+++ b/src/common/xmpp/auth_nb.py
@@ -127,7 +127,7 @@ class SASL(PlugIn):
self.password = password
self.on_sasl = on_sasl
self.realm = None
-
+
def plugin(self, owner):
if 'version' not in self._owner.Dispatcher.Stream._document_attrs:
self.startsasl = SASL_UNSUPPORTED
@@ -257,11 +257,11 @@ class SASL(PlugIn):
self.startsasl = SASL_SUCCESS
log.info('Successfully authenticated with remote server.')
handlers = self._owner.Dispatcher.dumpHandlers()
-
+
# Bosh specific dispatcher replugging
# save old features. They will be used in case we won't get response on
# stream restart after SASL auth (happens with XMPP over BOSH with
- # Openfire)
+ # Openfire)
old_features = self._owner.Dispatcher.Stream.features
self._owner.Dispatcher.PlugOut()
dispatcher_nb.Dispatcher.get_instance().PlugIn(self._owner,
@@ -294,7 +294,7 @@ class SASL(PlugIn):
self._owner.send(Node('response', attrs={'xmlns':NS_SASL},
payload=response).__str__())
raise NodeProcessed
-
+
# magic foo...
chal = challenge_splitter(data)
if not self.realm and 'realm' in chal:
@@ -325,7 +325,7 @@ class SASL(PlugIn):
if self.on_sasl:
self.on_sasl()
raise NodeProcessed
-
+
def set_password(self, password):
if password is None:
self.password = ''
@@ -450,7 +450,7 @@ class NonBlockingBind(PlugIn):
''' Start resource binding, if allowed at this time. Used internally. '''
if self._owner.Dispatcher.Stream.features:
try:
- self.FeaturesHandler(self._owner.Dispatcher,
+ self.FeaturesHandler(self._owner.Dispatcher,
self._owner.Dispatcher.Stream.features)
except NodeProcessed:
pass
diff --git a/src/common/xmpp/bosh.py b/src/common/xmpp/bosh.py
index b6cb99613..1b34adc48 100644
--- a/src/common/xmpp/bosh.py
+++ b/src/common/xmpp/bosh.py
@@ -1,4 +1,4 @@
-## bosh.py
+## bosh.py
##
##
## Copyright (C) 2008 Tomas Karasek <tom.to.the.k@gmail.com>
@@ -83,12 +83,12 @@ class NonBlockingBOSH(NonBlockingTransport):
self.proxy_dict = {}
if self.over_proxy and self.estabilish_tls:
self.proxy_dict['type'] = 'http'
- # with SSL over proxy, we do HTTP CONNECT to proxy to open a channel to
+ # with SSL over proxy, we do HTTP CONNECT to proxy to open a channel to
# BOSH Connection Manager
self.proxy_dict['xmpp_server'] = (urisplit(self.bosh_uri)[1], self.bosh_port)
self.proxy_dict['credentials'] = self.proxy_creds
-
+
def connect(self, conn_5tuple, on_connect, on_connect_failure):
NonBlockingTransport.connect(self, conn_5tuple, on_connect, on_connect_failure)
@@ -146,7 +146,7 @@ class NonBlockingBOSH(NonBlockingTransport):
else:
self.send_BOSH(None)
-
+
def get_socket_in(self, state):
''' gets sockets in desired state '''
@@ -177,12 +177,12 @@ class NonBlockingBOSH(NonBlockingTransport):
def send_BOSH(self, payload):
'''
- Tries to send a stanza in payload by appeding it to a buffer and plugging a
+ Tries to send a stanza in payload by appeding it to a buffer and plugging a
free socket for writing.
'''
total_pending_reqs = sum([s.pending_requests for s in self.http_socks])
- # when called after HTTP response (Payload=None) and when there are already
+ # when called after HTTP response (Payload=None) and when there are already
# some pending requests and no data to send, or when the socket is
# disconnected, we do nothing
if payload is None and \
@@ -199,7 +199,7 @@ class NonBlockingBOSH(NonBlockingTransport):
# sent after HTTP response from CM, exception is when we're disconnecting - then we
# send anyway
if total_pending_reqs >= self.bosh_requests and self.get_state()!=DISCONNECTING:
- log.warn('attemp to make more requests than allowed by Connection Manager:\n%s' %
+ log.warn('attemp to make more requests than allowed by Connection Manager:\n%s' %
self.get_current_state())
return
@@ -212,7 +212,7 @@ class NonBlockingBOSH(NonBlockingTransport):
# if there is a connecting socket, we just wait for when it connects,
# payload will be sent in a sec when the socket connects
if self.get_socket_in(CONNECTING): return
-
+
# being here means there are either DISCONNECTED sockets or all sockets are
# CONNECTED with too many pending requests
s = self.get_socket_in(DISCONNECTED)
@@ -240,8 +240,8 @@ class NonBlockingBOSH(NonBlockingTransport):
Builds a BOSH body tag from data in buffers and adds key, rid and ack
attributes to it.
This method is called from _do_send() of underlying transport. This is to
- ensure rid and keys will be processed in correct order. If I generate them
- before plugging a socket for write (and did it for two sockets/HTTP
+ ensure rid and keys will be processed in correct order. If I generate them
+ before plugging a socket for write (and did it for two sockets/HTTP
connections) in parallel, they might be sent in wrong order, which results
in violating the BOSH session and server-side disconnect.
'''
@@ -299,7 +299,7 @@ class NonBlockingBOSH(NonBlockingTransport):
else:
socket.disconnect()
-
+
def handle_body_attrs(self, stanza_attrs):
'''
@@ -322,7 +322,7 @@ class NonBlockingBOSH(NonBlockingTransport):
ack = None
if stanza_attrs.has_key('ack'):
ack = stanza_attrs['ack']
- self.ack_checker.process_incoming_ack(ack=ack,
+ self.ack_checker.process_incoming_ack(ack=ack,
socket=self.current_recv_socket)
if stanza_attrs.has_key('type'):
@@ -359,7 +359,7 @@ class NonBlockingBOSH(NonBlockingTransport):
self.send_BOSH(stanza)
-
+
def get_current_state(self):
t = '------ SOCKET_ID\tSOCKET_STATE\tPENDING_REQS\n'
for s in self.http_socks:
@@ -368,11 +368,11 @@ class NonBlockingBOSH(NonBlockingTransport):
% (t, self.prio_bosh_stanzas, self.stanza_buffer,
self.ack_checker.get_not_acked_rids())
return t
-
+
def connect_and_flush(self, socket):
socket.connect(
- conn_5tuple = self.conn_5tuple,
+ conn_5tuple = self.conn_5tuple,
on_connect = self.on_http_request_possible,
on_connect_failure = self.disconnect)
@@ -415,7 +415,7 @@ class NonBlockingBOSH(NonBlockingTransport):
def get_new_http_socket(self):
- http_dict = {'http_uri': self.bosh_uri,
+ http_dict = {'http_uri': self.bosh_uri,
'http_port': self.bosh_port,
'http_version': self.http_version,
'http_persistent': self.http_persistent,
@@ -461,13 +461,13 @@ class NonBlockingBOSH(NonBlockingTransport):
def get_rand_number():
# with 50-bit random initial rid, session would have to go up
- # to 7881299347898368 messages to raise rid over 2**53
+ # to 7881299347898368 messages to raise rid over 2**53
# (see http://www.xmpp.org/extensions/xep-0124.html#rids)
# it's also used for sequence key initialization
r = random.Random()
r.seed()
return r.getrandbits(50)
-
+
class AckChecker():
@@ -507,11 +507,11 @@ class AckChecker():
self.ack = ack
-
+
def get_rid(self):
self.rid = self.rid + 1
return self.rid
-
+
@@ -537,7 +537,7 @@ class KeyStack():
if self.first_call:
self.first_call = False
return (None, self.keys.pop())
-
+
if len(self.keys)>1:
return (self.keys.pop(), None)
else:
diff --git a/src/common/xmpp/client_nb.py b/src/common/xmpp/client_nb.py
index 554be2199..4cf9a4cc0 100644
--- a/src/common/xmpp/client_nb.py
+++ b/src/common/xmpp/client_nb.py
@@ -40,7 +40,7 @@ class NonBlockingClient:
:param domain: domain - for to: attribute (from account info)
:param idlequeue: processing idlequeue
- :param caller: calling object - it has to implement methods
+ :param caller: calling object - it has to implement methods
_event_dispatcher which is called from dispatcher instance
'''
self.Namespace = protocol.NS_CLIENT
@@ -100,7 +100,7 @@ class NonBlockingClient:
self.connected = ''
self.stream_started = False
-
+
self.disconnecting = True
log.debug('Client disconnected..')
@@ -117,7 +117,7 @@ class NonBlockingClient:
else:
# we are connected to XMPP server
if not stream_started:
- # if error occur before XML stream was opened, e.g. no response on
+ # if error occur before XML stream was opened, e.g. no response on
# init request, we call the on_connect_failure callback because
# proper connection is not established yet and it's not a proxy
# issue
@@ -133,12 +133,12 @@ class NonBlockingClient:
def connect(self, on_connect, on_connect_failure, hostname=None, port=5222,
on_proxy_failure=None, proxy=None, secure_tuple=('plain', None, None)):
- '''
+ '''
Open XMPP connection (open XML streams in both directions).
:param on_connect: called after stream is successfully opened
:param on_connect_failure: called when error occures during connection
- :param hostname: hostname of XMPP server from SRV request
+ :param hostname: hostname of XMPP server from SRV request
:param port: port number of XMPP server
:param on_proxy_failure: called if error occurres during TCP connection to
proxy server or during proxy connecting process
@@ -163,10 +163,10 @@ class NonBlockingClient:
self.xmpp_hostname = hostname
else:
self.xmpp_hostname = self.Server
-
- # We only check for SSL here as for TLS we will first have to start a
+
+ # We only check for SSL here as for TLS we will first have to start a
# PLAIN connection and negotiate TLS afterwards.
- # establish_tls will instruct transport to start secure connection
+ # establish_tls will instruct transport to start secure connection
# directly
establish_tls = self.desired_security == 'ssl'
certs = (self.cacerts, self.mycerts)
@@ -182,7 +182,7 @@ class NonBlockingClient:
# (DNS request will be done for proxy or BOSH CM hostname)
tcp_host, tcp_port, proxy_user, proxy_pass = \
transports_nb.get_proxy_data_from_dict(proxy)
-
+
if proxy['type'] == 'bosh':
# Setup BOSH transport
self.socket = bosh.NonBlockingBOSH.get_instance(
@@ -238,8 +238,8 @@ class NonBlockingClient:
if err_message:
log.debug('While looping over DNS A records: %s' % err_message)
if self.ip_addresses == []:
- msg = 'Run out of hosts for name %s:%s.' % (self.Server, self.Port)
- msg = msg + ' Error for last IP: %s' % err_message
+ msg = 'Run out of hosts for name %s:%s.' % (self.Server, self.Port)
+ msg = msg + ' Error for last IP: %s' % err_message
self.disconnect(msg)
else:
self.current_ip = self.ip_addresses.pop(0)
@@ -374,7 +374,7 @@ class NonBlockingClient:
log.warn('While connecting with type = "tls": TLS unsupported ' +
'by remote server')
self._on_connect()
-
+
elif self.connected in ['ssl', 'tls']:
self._on_connect()
else:
@@ -434,14 +434,14 @@ class NonBlockingClient:
:param resource: resource that shall be used for auth/connecting
:param sasl: Boolean indicating if SASL shall be used. (default: True)
:param on_auth: Callback, called after auth. On auth failure, argument
- is None.
+ is None.
'''
self._User, self._Password = user, password
self._Resource, self._sasl = resource, sasl
self.on_auth = on_auth
self._on_doc_attrs()
return
-
+
def _on_old_auth(self, res):
''' Callback used by NON-SASL auth. On auth failure, res is None. '''
if res:
@@ -472,7 +472,7 @@ class NonBlockingClient:
return
self.SASL.auth()
return True
-
+
def _on_start_sasl(self, data=None):
''' Callback used by SASL, called on each auth step.'''
if data:
@@ -493,7 +493,7 @@ class NonBlockingClient:
auth_nb.NonBlockingBind.get_instance().PlugIn(self)
self.onreceive(self._on_auth_bind)
return True
-
+
def _on_auth_bind(self, data):
# FIXME: Why use this callback and not bind directly?
if data:
diff --git a/src/common/xmpp/dispatcher_nb.py b/src/common/xmpp/dispatcher_nb.py
index 6663cf9c6..98ca5be7a 100644
--- a/src/common/xmpp/dispatcher_nb.py
+++ b/src/common/xmpp/dispatcher_nb.py
@@ -16,7 +16,7 @@
'''
-Main xmpp decision making logic. Provides library with methods to assign
+Main xmpp decision making logic. Provides library with methods to assign
different handlers to different XMPP stanzas and namespaces.
'''
@@ -54,12 +54,12 @@ class Dispatcher():
BOSHDispatcher().PlugIn(client_obj, after_SASL, old_features)
else:
assert False # should never be reached
-
+
@classmethod
def get_instance(cls, *args, **kwargs):
'''
Factory Method for object creation.
-
+
Use this instead of directly initializing the class in order to make
unit testing much easier.
'''
@@ -70,7 +70,7 @@ class XMPPDispatcher(PlugIn):
'''
Handles XMPP stream and is the first who takes control over a fresh stanza.
- Is plugged into NonBlockingClient but can be replugged to restart handled
+ Is plugged into NonBlockingClient but can be replugged to restart handled
stream headers (used by SASL f.e.).
'''
def __init__(self):
@@ -84,7 +84,7 @@ class XMPPDispatcher(PlugIn):
self._exported_methods=[self.RegisterHandler, self.RegisterDefaultHandler,
self.RegisterEventHandler, self.UnregisterCycleHandler,
self.RegisterCycleHandler, self.RegisterHandlerOnce,
- self.UnregisterHandler, self.RegisterProtocol,
+ self.UnregisterHandler, self.RegisterProtocol,
self.SendAndWaitForResponse, self.SendAndCallForResponse,
self.getAnID, self.Event, self.send]
@@ -104,7 +104,7 @@ class XMPPDispatcher(PlugIn):
def restoreHandlers(self, handlers):
'''
Restores user-registered callbacks structure from dump previously
- obtained via dumpHandlers. Used within the library to carry user
+ obtained via dumpHandlers. Used within the library to carry user
handlers set over Dispatcher replugins.
'''
self.handlers = handlers
@@ -213,7 +213,7 @@ class XMPPDispatcher(PlugIn):
def RegisterNamespace(self, xmlns, order='info'):
'''
Creates internal structures for newly registered namespace.
- You can register handlers for this namespace afterwards. By default
+ You can register handlers for this namespace afterwards. By default
one namespace is already registered
(jabber:client or jabber:component:accept depending on context.
'''
@@ -226,7 +226,7 @@ class XMPPDispatcher(PlugIn):
'''
Used to declare some top-level stanza name to dispatcher.
Needed to start registering handlers for such stanzas.
-
+
Iq, message and presence protocols are registered by default.
'''
if not xmlns:
@@ -246,12 +246,12 @@ class XMPPDispatcher(PlugIn):
makefirst=False, system=False):
'''
Register user callback as stanzas handler of declared type.
-
+
Callback must take (if chained, see later) arguments:
dispatcher instance (for replying), incoming return of previous handlers.
The callback must raise xmpp.NodeProcessed just before return if it wants
other callbacks to be called with the same stanza as argument _and_, more
- importantly library from returning stanza to sender with error set.
+ importantly library from returning stanza to sender with error set.
:param name: name of stanza. F.e. "iq".
:param handler: user callback.
@@ -279,13 +279,13 @@ class XMPPDispatcher(PlugIn):
if typ+ns not in self.handlers[xmlns][name]:
self.handlers[xmlns][name][typ+ns]=[]
if makefirst:
- self.handlers[xmlns][name][typ+ns].insert(0,{'func':handler,
+ self.handlers[xmlns][name][typ+ns].insert(0,{'func':handler,
'system':system})
else:
- self.handlers[xmlns][name][typ+ns].append({'func':handler,
+ self.handlers[xmlns][name][typ+ns].append({'func':handler,
'system':system})
- def RegisterHandlerOnce(self, name, handler, typ='', ns='', xmlns=None,
+ def RegisterHandlerOnce(self, name, handler, typ='', ns='', xmlns=None,
makefirst=0, system=0):
''' Unregister handler after first call (not implemented yet). '''
# FIXME Drop or implement
@@ -352,8 +352,8 @@ class XMPPDispatcher(PlugIn):
def Event(self, realm, event, data):
'''
- Raise some event.
-
+ Raise some event.
+
:param realm: scope of event. Usually a namespace.
:param event: the event itself. F.e. "SUCCESSFUL SEND".
:param data: data that comes along with event. Depends on event.
@@ -453,7 +453,7 @@ class XMPPDispatcher(PlugIn):
def _WaitForData(self, data):
'''
- Internal wrapper around ProcessNonBlocking. Will check for
+ Internal wrapper around ProcessNonBlocking. Will check for
'''
if data is None:
return
@@ -520,7 +520,7 @@ class XMPPDispatcher(PlugIn):
return ID
-class BOSHDispatcher(XMPPDispatcher):
+class BOSHDispatcher(XMPPDispatcher):
def PlugIn(self, owner, after_SASL=False, old_features=None):
self.old_features = old_features
@@ -543,7 +543,7 @@ class BOSHDispatcher(XMPPDispatcher):
if locale.getdefaultlocale()[0]:
self._metastream.setAttr('xml:lang',
locale.getdefaultlocale()[0].split('_')[0])
-
+
self.restart = True
self._owner.Connection.send_init(after_SASL=self.after_SASL)
diff --git a/src/common/xmpp/features_nb.py b/src/common/xmpp/features_nb.py
index 427ca9724..b713e38b2 100644
--- a/src/common/xmpp/features_nb.py
+++ b/src/common/xmpp/features_nb.py
@@ -41,7 +41,7 @@ def getRegInfo(disp, host, info={}, sync=True):
'''
Gets registration form from remote host. Info dict can be prefilled
:param disp: plugged dispatcher instance
- :param info: dict, like {'username':'joey'}.
+ :param info: dict, like {'username':'joey'}.
See JEP-0077 for details.
'''
@@ -79,7 +79,7 @@ def _ReceivedRegInfo(con, resp, agent):
def register(disp, host, info, cb):
'''
Perform registration on remote server with provided info.
-
+
If registration fails you can get additional info from the dispatcher's
owner attributes lastErrNode, lastErr and lastErrCode.
'''
@@ -187,8 +187,8 @@ def setDefaultPrivacyList(disp, listname=None):
def setPrivacyList(disp, listname, tags):
'''
- Set the ruleset.
-
+ Set the ruleset.
+
'list' should be the simpleXML node formatted according to RFC 3921 (XMPP-IM) I.e. Node('list',{'name':listname},payload=[...]). Returns true on success.
'''
iq = Iq('set', NS_PRIVACY, xmlns = '')
@@ -196,7 +196,7 @@ def setPrivacyList(disp, listname, tags):
for item in tags:
if 'type' in item and 'value' in item:
item_tag = list_query.setTag('item', {'action': item['action'],
- 'order': item['order'], 'type': item['type'],
+ 'order': item['order'], 'type': item['type'],
'value': item['value']})
else:
item_tag = list_query.setTag('item', {'action': item['action'],
diff --git a/src/common/xmpp/idlequeue.py b/src/common/xmpp/idlequeue.py
index 19a64c20e..63cb26bf6 100644
--- a/src/common/xmpp/idlequeue.py
+++ b/src/common/xmpp/idlequeue.py
@@ -12,8 +12,8 @@
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
-'''
-Idlequeues are Gajim's network heartbeat. Transports can be plugged as
+'''
+Idlequeues are Gajim's network heartbeat. Transports can be plugged as
idle objects and be informed about possible IO.
'''
import os
@@ -35,13 +35,13 @@ elif os.name == 'posix':
import fcntl
FLAG_WRITE = 20 # write only
-FLAG_READ = 19 # read only
+FLAG_READ = 19 # read only
FLAG_READ_WRITE = 23 # read and write
FLAG_CLOSE = 16 # wait for close
PENDING_READ = 3 # waiting read event
PENDING_WRITE = 4 # waiting write event
-IS_CLOSED = 16 # channel closed
+IS_CLOSED = 16 # channel closed
def get_idlequeue():
@@ -91,30 +91,30 @@ class IdleCommand(IdleObject):
IdleObject.__init__(self)
# how long (sec.) to wait for result ( 0 - forever )
# it is a class var, instead of a constant and we can override it.
- self.commandtimeout = 0
+ self.commandtimeout = 0
# when we have some kind of result (valid, ot not) we call this handler
self.result_handler = on_result
# if it is True, we can safetely execute the command
self.canexecute = True
self.idlequeue = None
self.result =''
-
+
def set_idlequeue(self, idlequeue):
self.idlequeue = idlequeue
-
+
def _return_result(self):
if self.result_handler:
self.result_handler(self.result)
self.result_handler = None
-
+
def _compose_command_args(self):
return ['echo', 'da']
-
+
def _compose_command_line(self):
''' return one line representation of command and its arguments '''
- return reduce(lambda left, right: left + ' ' + right,
+ return reduce(lambda left, right: left + ' ' + right,
self._compose_command_args())
-
+
def wait_child(self):
if self.pipe.poll() is None:
# result timeout
@@ -141,16 +141,16 @@ class IdleCommand(IdleObject):
self._start_nt()
elif os.name == 'posix':
self._start_posix()
-
+
def _start_nt(self):
- # if gajim is started from noninteraactive shells stdin is closed and
+ # if gajim is started from noninteraactive shells stdin is closed and
# cannot be forwarded, so we have to keep it open
- self.pipe = Popen(self._compose_command_args(), stdout=PIPE,
+ self.pipe = Popen(self._compose_command_args(), stdout=PIPE,
bufsize = 1024, shell = True, stderr = STDOUT, stdin = PIPE)
if self.commandtimeout >= 0:
self.endtime = self.idlequeue.current_time() + self.commandtimeout
self.idlequeue.set_alarm(self.wait_child, 0.1)
-
+
def _start_posix(self):
self.pipe = os.popen(self._compose_command_line())
self.fd = self.pipe.fileno()
@@ -158,19 +158,19 @@ class IdleCommand(IdleObject):
self.idlequeue.plug_idle(self, False, True)
if self.commandtimeout >= 0:
self.idlequeue.set_read_timeout(self.fd, self.commandtimeout)
-
+
def end(self):
self.idlequeue.unplug_idle(self.fd)
try:
self.pipe.close()
except:
pass
-
+
def pollend(self):
self.idlequeue.remove_timeout(self.fd)
self.end()
self._return_result()
-
+
def pollin(self):
try:
res = self.pipe.read()
@@ -180,25 +180,25 @@ class IdleCommand(IdleObject):
return self.pollend()
else:
self.result += res
-
+
def read_timeout(self):
self.end()
self._return_result()
-
+
class IdleQueue:
'''
IdleQueue provide three distinct time based features. Uses select.poll()
-
+
1. Alarm timeout: Execute a callback after foo seconds
- 2. Timeout event: Call read_timeout() of an plugged object if a timeout
+ 2. Timeout event: Call read_timeout() of an plugged object if a timeout
has been set, but not removed in time.
3. Check file descriptor of plugged objects for read, write and error
- events
+ events
'''
# (timeout, boolean)
# Boolean is True if timeout is specified in seconds, False means miliseconds
- PROCESS_TIMEOUT = (200, False)
+ PROCESS_TIMEOUT = (200, False)
def __init__(self):
self.queue = {}
@@ -219,7 +219,7 @@ class IdleQueue:
self.selector = select.poll()
def set_alarm(self, alarm_cb, seconds):
- '''
+ '''
Sets up a new alarm. alarm_cb will be called after specified seconds.
'''
alarm_time = self.current_time() + seconds
@@ -230,24 +230,24 @@ class IdleQueue:
self.alarms[alarm_time] = [alarm_cb]
return alarm_time
- def remove_alarm(self, alarm_cb, alarm_time):
+ def remove_alarm(self, alarm_cb, alarm_time):
'''
Removes alarm callback alarm_cb scheduled on alarm_time.
Returns True if it was removed sucessfully, otherwise False
- '''
+ '''
if not alarm_time in self.alarms:
- return False
- i = -1
+ return False
+ i = -1
for i in range(len(self.alarms[alarm_time])):
- # let's not modify the list inside the loop
+ # let's not modify the list inside the loop
if self.alarms[alarm_time][i] is alarm_cb:
- break
+ break
if i != -1:
- del self.alarms[alarm_time][i]
+ del self.alarms[alarm_time][i]
if self.alarms[alarm_time] == []:
- del self.alarms[alarm_time]
- return True
- else:
+ del self.alarms[alarm_time]
+ return True
+ else:
return False
def remove_timeout(self, fd, timeout=None):
@@ -298,7 +298,7 @@ class IdleQueue:
log.debug('Calling %s for fd %s' % (func, fd))
func()
else:
- log.debug('Calling read_timeout for fd %s' % fd)
+ log.debug('Calling read_timeout for fd %s' % fd)
self.queue[fd].read_timeout()
self.remove_timeout(fd, timeout)
@@ -314,7 +314,7 @@ class IdleQueue:
def plug_idle(self, obj, writable=True, readable=True):
'''
- Plug an IdleObject into idlequeue. Filedescriptor fd must be set.
+ Plug an IdleObject into idlequeue. Filedescriptor fd must be set.
:param obj: the IdleObject
:param writable: True if obj has data to sent
@@ -371,7 +371,7 @@ class IdleQueue:
obj.pollout()
return True
- elif flags & IS_CLOSED:
+ elif flags & IS_CLOSED:
# io error, don't expect more events
self.remove_timeout(obj.fd)
self.unplug_idle(obj.fd)
@@ -472,7 +472,7 @@ class GlibIdleQueue(IdleQueue):
'''
# (timeout, boolean)
# Boolean is True if timeout is specified in seconds, False means miliseconds
- PROCESS_TIMEOUT = (2, True)
+ PROCESS_TIMEOUT = (2, True)
def _init_idle(self):
'''
diff --git a/src/common/xmpp/plugin.py b/src/common/xmpp/plugin.py
index 6734695bf..7f5d91ee1 100644
--- a/src/common/xmpp/plugin.py
+++ b/src/common/xmpp/plugin.py
@@ -23,12 +23,12 @@ log = logging.getLogger('gajim.c.x.plugin')
class PlugIn:
'''
- Abstract xmpppy plugin infrastructure code, providing plugging in/out and
+ Abstract xmpppy plugin infrastructure code, providing plugging in/out and
debugging functionality.
Inherit to develop pluggable objects. No code change on the owner class
required (the object where we plug into)
-
+
For every instance of PlugIn class the 'owner' is the class in what the plug
was plugged.
'''
@@ -38,7 +38,7 @@ class PlugIn:
def PlugIn(self, owner):
'''
Attach to owner and register ourself and our _exported_methods in it.
- If defined by a subclass, call self.plugin(owner) to execute hook
+ If defined by a subclass, call self.plugin(owner) to execute hook
code after plugging.
'''
self._owner=owner
@@ -57,7 +57,7 @@ class PlugIn:
owner.__dict__['Dispatcher']=self
else:
owner.__dict__[self.__class__.__name__]=self
-
+
# Execute hook
if hasattr(self,'plugin'):
return self.plugin(owner)
@@ -82,12 +82,12 @@ class PlugIn:
if hasattr(self,'plugout'):
return self.plugout()
del self._owner
-
+
@classmethod
def get_instance(cls, *args, **kwargs):
'''
Factory Method for object creation.
-
+
Use this instead of directly initializing the class in order to make
unit testing easier. For testing, this method can be patched to inject
mock objects.
diff --git a/src/common/xmpp/proxy_connectors.py b/src/common/xmpp/proxy_connectors.py
index c75ceb6a0..e4fb4dbd8 100644
--- a/src/common/xmpp/proxy_connectors.py
+++ b/src/common/xmpp/proxy_connectors.py
@@ -1,6 +1,6 @@
## proxy_connectors.py
## based on transports_nb.py
-##
+##
## Copyright (C) 2003-2004 Alexey "Snake" Nezhdanov
## modified by Dimitur Kirov <dkirov@gmail.com>
## modified by Tomas Karasek <tom.to.the.k@gmail.com>
@@ -16,7 +16,7 @@
## GNU General Public License for more details.
'''
Module containing classes for proxy connecting. So far its HTTP CONNECT
-and SOCKS5 proxy.
+and SOCKS5 proxy.
Authentication to NTLM (Microsoft implementation) proxies can be next.
'''
@@ -38,7 +38,7 @@ class ProxyConnector:
:param send_method: transport send method
:param onreceive: method to set on_receive callbacks
- :param old_on_receive: on_receive callback that should be set when
+ :param old_on_receive: on_receive callback that should be set when
proxy connection was successful
:param on_success: called after proxy connection was successfully opened
:param on_failure: called when errors occured while connecting
@@ -55,12 +55,12 @@ class ProxyConnector:
self.old_on_receive = old_on_receive
self.start_connecting()
-
+
@classmethod
def get_instance(cls, *args, **kwargs):
'''
Factory Method for object creation.
-
+
Use this instead of directly initializing the class in order to make
unit testing much easier.
'''
@@ -72,7 +72,7 @@ class ProxyConnector:
def connecting_over(self):
self.onreceive(self.old_on_receive)
self.on_success()
-
+
class HTTPCONNECTConnector(ProxyConnector):
def start_connecting(self):
'''
@@ -93,14 +93,14 @@ class HTTPCONNECTConnector(ProxyConnector):
connector.append('\r\n')
self.onreceive(self._on_headers_sent)
self.send('\r\n'.join(connector))
-
+
def _on_headers_sent(self, reply):
if reply is None:
return
self.reply = reply.replace('\r', '')
- try:
+ try:
proto, code, desc = reply.split('\n')[0].split(' ', 2)
- except:
+ except:
log.error("_on_headers_sent:", exc_info=True)
#traceback.print_exc()
self.on_failure('Invalid proxy reply')
@@ -117,7 +117,7 @@ class HTTPCONNECTConnector(ProxyConnector):
class SOCKS5Connector(ProxyConnector):
'''
SOCKS5 proxy connection class. Allows to use SOCKS5 proxies with
- (optionally) simple authentication (only USERNAME/PASSWORD auth).
+ (optionally) simple authentication (only USERNAME/PASSWORD auth).
'''
def start_connecting(self):
log.info('Proxy server contacted, performing authentification')
diff --git a/src/common/xmpp/roster_nb.py b/src/common/xmpp/roster_nb.py
index cd802b36b..ee83131b5 100644
--- a/src/common/xmpp/roster_nb.py
+++ b/src/common/xmpp/roster_nb.py
@@ -30,7 +30,7 @@ log = logging.getLogger('gajim.c.x.roster_nb')
class NonBlockingRoster(PlugIn):
''' Defines a plenty of methods that will allow you to manage roster.
- Also automatically track presences from remote JIDs taking into
+ Also automatically track presences from remote JIDs taking into
account that every JID can have multiple resources connected. Does not
currently support 'error' presences.
You can also use mapping interface for access to the internal representation of
@@ -44,7 +44,7 @@ class NonBlockingRoster(PlugIn):
self._exported_methods=[self.getRoster]
def Request(self,force=0):
- ''' Request roster from server if it were not yet requested
+ ''' Request roster from server if it were not yet requested
(or if the 'force' argument is set). '''
if self.set is None: self.set=0
elif not force: return
@@ -182,7 +182,7 @@ class NonBlockingRoster(PlugIn):
''' Authorise JID 'jid'. Works only if these JID requested auth previously. '''
self._owner.send(Presence(jid,'subscribed'))
def Unauthorize(self,jid):
- ''' Unauthorise JID 'jid'. Use for declining authorisation request
+ ''' Unauthorise JID 'jid'. Use for declining authorisation request
or for removing existing authorization. '''
self._owner.send(Presence(jid,'unsubscribed'))
def getRaw(self):
diff --git a/src/common/xmpp/simplexml.py b/src/common/xmpp/simplexml.py
index f1f91f697..a65818902 100644
--- a/src/common/xmpp/simplexml.py
+++ b/src/common/xmpp/simplexml.py
@@ -438,7 +438,7 @@ class NodeBuilder:
def handle_namespace_start(self, prefix, uri):
'''XML Parser callback. Used internally'''
self.check_data_buffer()
-
+
def getDom(self):
''' Returns just built Node. '''
self.check_data_buffer()
diff --git a/src/common/xmpp/tls_nb.py b/src/common/xmpp/tls_nb.py
index 52a429cc4..cde9d4c43 100644
--- a/src/common/xmpp/tls_nb.py
+++ b/src/common/xmpp/tls_nb.py
@@ -1,6 +1,6 @@
## tls_nb.py
## based on transports_nb.py
-##
+##
## Copyright (C) 2003-2004 Alexey "Snake" Nezhdanov
## modified by Dimitur Kirov <dkirov@gmail.com>
## modified by Tomas Karasek <tom.to.the.k@gmail.com>
@@ -228,7 +228,7 @@ class StdlibSSLWrapper(SSLWrapper):
class NonBlockingTLS(PlugIn):
'''
TLS connection used to encrypts already estabilished tcp connection.
-
+
Can be plugged into NonBlockingTCP and will make use of StdlibSSLWrapper or
PyOpenSSLWrapper.
'''
@@ -243,10 +243,10 @@ class NonBlockingTLS(PlugIn):
self.mycerts = mycerts
# from ssl.h (partial extract)
- ssl_h_bits = { "SSL_ST_CONNECT": 0x1000, "SSL_ST_ACCEPT": 0x2000,
- "SSL_CB_LOOP": 0x01, "SSL_CB_EXIT": 0x02,
- "SSL_CB_READ": 0x04, "SSL_CB_WRITE": 0x08,
- "SSL_CB_ALERT": 0x4000,
+ ssl_h_bits = { "SSL_ST_CONNECT": 0x1000, "SSL_ST_ACCEPT": 0x2000,
+ "SSL_CB_LOOP": 0x01, "SSL_CB_EXIT": 0x02,
+ "SSL_CB_READ": 0x04, "SSL_CB_WRITE": 0x08,
+ "SSL_CB_ALERT": 0x4000,
"SSL_CB_HANDSHAKE_START": 0x10, "SSL_CB_HANDSHAKE_DONE": 0x20}
def plugin(self, owner):
@@ -281,7 +281,7 @@ class NonBlockingTLS(PlugIn):
typedict = {OpenSSL.crypto.TYPE_RSA: "RSA",
OpenSSL.crypto.TYPE_DSA: "DSA"}
print >> stream, "PKey bits:", pkey.bits()
- print >> stream, "PKey type: %s (%d)" % (typedict.get(pkey.type(),
+ print >> stream, "PKey type: %s (%d)" % (typedict.get(pkey.type(),
"Unknown"), pkey.type())
def _startSSL(self):
diff --git a/src/common/xmpp/transports_nb.py b/src/common/xmpp/transports_nb.py
index ad49eb6cb..4cc0e7581 100644
--- a/src/common/xmpp/transports_nb.py
+++ b/src/common/xmpp/transports_nb.py
@@ -16,7 +16,7 @@
## GNU General Public License for more details.
'''
-Transports are objects responsible for connecting to XMPP server and putting
+Transports are objects responsible for connecting to XMPP server and putting
data to wrapped sockets in in desired form (SSL, TLS, TCP, for HTTP proxy,
for SOCKS5 proxy...)
@@ -55,13 +55,13 @@ def get_proxy_data_from_dict(proxy):
tcp_host, tcp_port, proxy_user, proxy_pass = None, None, None, None
proxy_type = proxy['type']
if proxy_type == 'bosh' and not proxy['bosh_useproxy']:
- # with BOSH not over proxy we have to parse the hostname from BOSH URI
- tcp_host, tcp_port = urisplit(proxy['bosh_uri'])[1], proxy['bosh_port']
+ # with BOSH not over proxy we have to parse the hostname from BOSH URI
+ tcp_host, tcp_port = urisplit(proxy['bosh_uri'])[1], proxy['bosh_port']
tcp_host = tcp_host.split(':')[0]
- else:
- # with proxy!=bosh or with bosh over HTTP proxy we're connecting to proxy
- # machine
- tcp_host, tcp_port = proxy['host'], proxy['port']
+ else:
+ # with proxy!=bosh or with bosh over HTTP proxy we're connecting to proxy
+ # machine
+ tcp_host, tcp_port = proxy['host'], proxy['port']
if proxy['useauth']:
proxy_user, proxy_pass = proxy['user'], proxy['pass']
return tcp_host, tcp_port, proxy_user, proxy_pass
@@ -102,13 +102,13 @@ class NonBlockingTransport(PlugIn):
'''
Each trasport class can have different constructor but it has to have at
least all the arguments of NonBlockingTransport constructor.
-
+
:param raise_event: callback for monitoring of sent and received data
:param on_disconnect: callback called on disconnection during runtime
:param idlequeue: processing idlequeue
:param estabilish_tls: boolean whether to estabilish TLS connection after
TCP connection is done
- :param certs: tuple of (cacerts, mycerts) see constructor of
+ :param certs: tuple of (cacerts, mycerts) see constructor of
tls_nb.NonBlockingTLS for more details
'''
PlugIn.__init__(self)
@@ -121,10 +121,10 @@ class NonBlockingTransport(PlugIn):
self.server = None
self.port = None
self.conn_5tuple = None
- self.set_state(DISCONNECTED)
- self.estabilish_tls = estabilish_tls
- self.certs = certs
- # type of used ssl lib (if any) will be assigned to this member var
+ self.set_state(DISCONNECTED)
+ self.estabilish_tls = estabilish_tls
+ self.certs = certs
+ # type of used ssl lib (if any) will be assigned to this member var
self.ssl_lib = None
self._exported_methods=[self.onreceive, self.set_send_timeout,
self.set_send_timeout2, self.set_timeout, self.remove_timeout,
@@ -214,13 +214,13 @@ class NonBlockingTransport(PlugIn):
def _tcp_connecting_started(self):
self.set_state(CONNECTING)
- def read_timeout(self):
+ def read_timeout(self):
''' called when there's no response from server in defined timeout '''
if self.on_timeout:
self.on_timeout()
self.renew_send_timeout()
- def read_timeout2(self):
+ def read_timeout2(self):
''' called when there's no response from server in defined timeout '''
if self.on_timeout2:
self.on_timeout2()
@@ -289,7 +289,7 @@ class NonBlockingTCP(NonBlockingTransport, IdleObject):
self.proxy_dict = proxy_dict
self.on_remote_disconnect = self.disconnect
-
+
# FIXME: transport should not be aware xmpp
def start_disconnect(self):
NonBlockingTransport.start_disconnect(self)
@@ -312,16 +312,16 @@ class NonBlockingTCP(NonBlockingTransport, IdleObject):
self._send = self._sock.send
self._recv = self._sock.recv
self.fd = self._sock.fileno()
-
+
# we want to be notified when send is possible to connected socket because
# it means the TCP connection is estabilished
self._plug_idle(writable=True, readable=False)
self.peerhost = None
- # variable for errno symbol that will be found from exception raised
+ # variable for errno symbol that will be found from exception raised
# from connect()
errnum = 0
-
+
# set timeout for TCP connecting - if nonblocking connect() fails, pollend
# is called. If if succeeds pollout is called.
self.idlequeue.set_read_timeout(self.fd, CONNECT_TIMEOUT_SECONDS)
@@ -334,12 +334,12 @@ class NonBlockingTCP(NonBlockingTransport, IdleObject):
if errnum in (errno.EINPROGRESS, errno.EALREADY, errno.EWOULDBLOCK):
# connecting in progress
- log.info('After NB connect() of %s. "%s" raised => CONNECTING' %
+ log.info('After NB connect() of %s. "%s" raised => CONNECTING' %
(id(self), errstr))
self._tcp_connecting_started()
return
- # if there was some other exception, call failure callback and unplug
+ # if there was some other exception, call failure callback and unplug
# transport which will also remove read_timeouts for descriptor
self._on_connect_failure('Exception while connecting to %s:%s - %s %s' %
(self.server, self.port, errnum, errstr))
@@ -481,7 +481,7 @@ class NonBlockingTCP(NonBlockingTransport, IdleObject):
def _plug_idle(self, writable, readable):
'''
Plugs file descriptor of socket to Idlequeue.
-
+
Plugged socket will be watched for "send possible" or/and "recv possible"
events. pollin() callback is invoked on "recv possible", pollout() on
"send_possible".
@@ -618,7 +618,7 @@ class NonBlockingHTTP(NonBlockingTCP):
# buffer for partial responses
self.recvbuff = ''
- self.expected_length = 0
+ self.expected_length = 0
self.pending_requests = 0
self.on_http_request_possible = on_http_request_possible
self.last_recv_time = 0
@@ -641,7 +641,7 @@ class NonBlockingHTTP(NonBlockingTCP):
try:
statusline, headers, self.recvbuff = self.parse_http_message(data)
except ValueError:
- self.disconnect()
+ self.disconnect()
return
if statusline[1] != '200':
log.error('HTTP Error: %s %s' % (statusline[1], statusline[2]))
diff --git a/src/config.py b/src/config.py
index a4b6c679e..a838a98ff 100644
--- a/src/config.py
+++ b/src/config.py
@@ -788,14 +788,14 @@ class PreferencesWindow:
gajim.config.set('trayicon', 'on_event')
else:
gajim.config.set('trayicon', 'always')
-
+
def on_advanced_notifications_button_clicked(self, widget):
dialogs.AdvancedNotificationsWindow()
def on_play_sounds_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'sounds_on',
[self.xml.get_widget('manage_sounds_button')])
-
+
def on_manage_sounds_button_clicked(self, widget):
if self.sounds_preferences is None:
self.sounds_preferences = ManageSoundsWindow()
@@ -3558,7 +3558,7 @@ class ManageSoundsWindow:
def __init__(self):
self.xml = gtkgui_helpers.get_glade('manage_sounds_window.glade')
self.window = self.xml.get_widget('manage_sounds_window')
-
+
# sounds treeview
self.sound_tree = self.xml.get_widget('sounds_treeview')
@@ -3581,14 +3581,14 @@ class ManageSoundsWindow:
col.set_attributes(renderer, text = 1)
self.fill_sound_treeview()
-
+
self.xml.signal_autoconnect(self)
self.sound_tree.get_model().connect('row-changed',
self.on_sounds_treemodel_row_changed)
-
+
self.window.show_all()
-
+
def on_sounds_treemodel_row_changed(self, model, path, iter_):
sound_event = model[iter_][3].decode('utf-8')
gajim.config.set_per('soundevents', sound_event, 'enabled',
@@ -3596,7 +3596,7 @@ class ManageSoundsWindow:
gajim.config.set_per('soundevents', sound_event, 'path',
model[iter_][2].decode('utf-8'))
gajim.interface.save_config()
-
+
def sound_toggled_cb(self, cell, path):
model = self.sound_tree.get_model()
model[path][0] = not model[path][0]
@@ -3675,10 +3675,10 @@ class ManageSoundsWindow:
return
snd_event_config_name = model[iter_][3]
helpers.play_sound(snd_event_config_name)
-
+
def on_close_button_clicked(self, widget):
self.window.hide()
-
+
def on_manage_sounds_window_delete_event(self, widget, event):
self.window.hide()
return True # do NOT destroy the window
diff --git a/src/dialogs.py b/src/dialogs.py
index cd056776d..f2938e3df 100644
--- a/src/dialogs.py
+++ b/src/dialogs.py
@@ -2593,10 +2593,10 @@ class XMLConsoleWindow:
at_the_end = True
end_iter = buffer.get_end_iter()
if kind == 'incoming':
- buffer.insert_with_tags_by_name(end_iter, '<!-- In -->\n',
+ buffer.insert_with_tags_by_name(end_iter, '<!-- In -->\n',
'in_comment')
elif kind == 'outgoing':
- buffer.insert_with_tags_by_name(end_iter, '<!-- Out -->\n',
+ buffer.insert_with_tags_by_name(end_iter, '<!-- Out -->\n',
'out_comment')
end_iter = buffer.get_end_iter()
buffer.insert_with_tags_by_name(end_iter, stanza.replace('><', '>\n<') + \
diff --git a/src/eggtrayicon.c b/src/eggtrayicon.c
index 3333079b8..56b3a0fb9 100644
--- a/src/eggtrayicon.c
+++ b/src/eggtrayicon.c
@@ -259,7 +259,7 @@ egg_tray_icon_manager_filter (GdkXEvent *xevent, GdkEvent *event, gpointer user_
return GDK_FILTER_CONTINUE;
}
-#endif
+#endif
static void
egg_tray_icon_unrealize (GtkWidget *widget)
@@ -568,7 +568,7 @@ egg_tray_icon_cancel_message (EggTrayIcon *icon,
{
g_return_if_fail (EGG_IS_TRAY_ICON (icon));
g_return_if_fail (id > 0);
-#ifdef GDK_WINDOWING_X11
+#ifdef GDK_WINDOWING_X11
egg_tray_icon_send_manager_message (icon, SYSTEM_TRAY_CANCEL_MESSAGE,
(Window)gtk_plug_get_id (GTK_PLUG (icon)),
id, 0, 0);
diff --git a/src/ipython_view.py b/src/ipython_view.py
index ef1cae5d2..4bc8a9564 100644
--- a/src/ipython_view.py
+++ b/src/ipython_view.py
@@ -382,7 +382,7 @@ class ConsoleView(gtk.TextView):
def _showReturned(self, text):
'''
Show returned text from last command and print new prompt.
-
+
@param text: Text to show.
@type text: string
'''
diff --git a/src/message_textview.py b/src/message_textview.py
index fb4aadf97..40ba81067 100644
--- a/src/message_textview.py
+++ b/src/message_textview.py
@@ -119,7 +119,7 @@ class MessageTextView(gtk.TextView):
else:
start, finish = buffer.get_bounds()
return (start, finish)
-
+
def set_tag(self, widget, tag):
buffer = self.get_buffer()
start, finish = self.get_active_iters()
diff --git a/src/network_manager_listener.py b/src/network_manager_listener.py
index 80c2cf86a..e624cc68e 100644
--- a/src/network_manager_listener.py
+++ b/src/network_manager_listener.py
@@ -39,17 +39,17 @@ def device_no_longer_active(self, *args):
'listen_to_network_manager') and connection.connected > 1:
connection._disconnectedReconnCB()
-def state_changed(state):
+def state_changed(state):
'''For Network Manager 0.7'''
- if props.Get("org.freedesktop.NetworkManager", "State") == 3:
- for connection in gajim.connections.itervalues():
- if gajim.config.get_per('accounts', connection.name,
- 'listen_to_network_manager') and connection.time_to_reconnect:
- connection._reconnect()
- else:
- for connection in gajim.connections.itervalues():
- if gajim.config.get_per('accounts', connection.name,
- 'listen_to_network_manager') and connection.connected > 1:
+ if props.Get("org.freedesktop.NetworkManager", "State") == 3:
+ for connection in gajim.connections.itervalues():
+ if gajim.config.get_per('accounts', connection.name,
+ 'listen_to_network_manager') and connection.time_to_reconnect:
+ connection._reconnect()
+ else:
+ for connection in gajim.connections.itervalues():
+ if gajim.config.get_per('accounts', connection.name,
+ 'listen_to_network_manager') and connection.connected > 1:
connection._disconnectedReconnCB()
supported = False
@@ -61,23 +61,23 @@ if sys.platform == 'darwin':
elif dbus_support.supported:
import dbus
import dbus.glib
-
- try:
+
+ try:
from common.dbus_support import system_bus
bus = system_bus.bus()
if 'org.freedesktop.NetworkManager' in bus.list_names():
- nm_object = bus.get_object('org.freedesktop.NetworkManager',
- '/org/freedesktop/NetworkManager')
- props = dbus.Interface(nm_object,"org.freedesktop.DBus.Properties")
- bus.add_signal_receiver(state_changed,
- 'StateChanged',
- 'org.freedesktop.NetworkManager',
- 'org.freedesktop.NetworkManager',
+ nm_object = bus.get_object('org.freedesktop.NetworkManager',
+ '/org/freedesktop/NetworkManager')
+ props = dbus.Interface(nm_object,"org.freedesktop.DBus.Properties")
+ bus.add_signal_receiver(state_changed,
+ 'StateChanged',
+ 'org.freedesktop.NetworkManager',
+ 'org.freedesktop.NetworkManager',
'/org/freedesktop/NetworkManager')
supported = True
-
+
except dbus.DBusException:
try:
if 'org.freedesktop.NetworkManager' in bus.list_names():
diff --git a/src/systray.py b/src/systray.py
index 5aca0b106..72d60b919 100644
--- a/src/systray.py
+++ b/src/systray.py
@@ -203,8 +203,8 @@ class Systray:
single_message_menuitem.set_sensitive(iskey)
join_gc_menuitem.set_sensitive(iskey)
- accounts_list = sorted(gajim.contacts.get_accounts())
- # items that get shown whether an account is zeroconf or not
+ accounts_list = sorted(gajim.contacts.get_accounts())
+ # items that get shown whether an account is zeroconf or not
if connected_accounts > 1: # 2 or more connections? make submenus
account_menu_for_chat_with = gtk.Menu()
chat_with_menuitem.set_submenu(account_menu_for_chat_with)
diff --git a/src/trayiconmodule.c b/src/trayiconmodule.c
index 427540885..7a2b1206f 100644
--- a/src/trayiconmodule.c
+++ b/src/trayiconmodule.c
@@ -29,12 +29,12 @@ DL_EXPORT(void)
inittrayicon(void)
{
PyObject *m, *d;
-
+
init_pygobject ();
m = Py_InitModule ("trayicon", trayicon_functions);
d = PyModule_GetDict (m);
-
+
trayicon_register_classes (d);
if (PyErr_Occurred ()) {