Commit 357d7db0 authored by Éric Araujo's avatar Éric Araujo

fixed some whitespace thanks to 2to3 -f ws_comma

parent c9ad0f5d
...@@ -71,11 +71,11 @@ class CommandWindow: ...@@ -71,11 +71,11 @@ class CommandWindow:
self.window.connect('delete-event', self.window.connect('delete-event',
self.on_adhoc_commands_window_delete_event) self.on_adhoc_commands_window_delete_event)
for name in ('back_button', 'forward_button', for name in ('back_button', 'forward_button',
'execute_button','close_button','stages_notebook', 'execute_button', 'close_button', 'stages_notebook',
'retrieving_commands_stage_vbox', 'retrieving_commands_stage_vbox',
'command_list_stage_vbox','command_list_vbox', 'command_list_stage_vbox', 'command_list_vbox',
'sending_form_stage_vbox','sending_form_progressbar', 'sending_form_stage_vbox', 'sending_form_progressbar',
'notes_label','no_commands_stage_vbox','error_stage_vbox', 'notes_label', 'no_commands_stage_vbox', 'error_stage_vbox',
'error_description_label'): 'error_description_label'):
self.__dict__[name] = self.xml.get_object(name) self.__dict__[name] = self.xml.get_object(name)
......
...@@ -266,7 +266,7 @@ class AdvancedConfigurationWindow(object): ...@@ -266,7 +266,7 @@ class AdvancedConfigurationWindow(object):
def visible_func(self, model, treeiter): def visible_func(self, model, treeiter):
search_string = self.entry.get_text().decode('utf-8').lower() search_string = self.entry.get_text().decode('utf-8').lower()
for it in tree_model_pre_order(model,treeiter): for it in tree_model_pre_order(model, treeiter):
if model[it][C_TYPE] != '': if model[it][C_TYPE] != '':
opt_path = self.get_option_path(model, it) opt_path = self.get_option_path(model, it)
if len(opt_path) == 3: if len(opt_path) == 3:
......
...@@ -1053,7 +1053,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools): ...@@ -1053,7 +1053,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
self.scroll_to_end_id = None self.scroll_to_end_id = None
return False return False
def size_request(self, msg_textview , requisition): def size_request(self, msg_textview, requisition):
""" """
When message_textview changes its size: if the new height will enlarge When message_textview changes its size: if the new height will enlarge
the window, enable the scrollbar automatic policy. Also enable scrollbar the window, enable the scrollbar automatic policy. Also enable scrollbar
......
...@@ -117,7 +117,7 @@ class OldEntry(xmpp.Node, object): ...@@ -117,7 +117,7 @@ class OldEntry(xmpp.Node, object):
Get source link Get source link
""" """
try: try:
return self.getTag('feed').getTags('link',{'rel':'alternate'})[1].getData() return self.getTag('feed').getTags('link', {'rel':'alternate'})[1].getData()
except Exception: except Exception:
return None return None
......
...@@ -73,7 +73,7 @@ class Config: ...@@ -73,7 +73,7 @@ class Config:
'notify_on_new_message': [ opt_bool, True ], 'notify_on_new_message': [ opt_bool, True ],
'autopopupaway': [ opt_bool, False ], 'autopopupaway': [ opt_bool, False ],
'sounddnd': [ opt_bool, False, _('Play sound when user is busy')], 'sounddnd': [ opt_bool, False, _('Play sound when user is busy')],
'use_notif_daemon': [ opt_bool, True , _('Use D-Bus and Notification-Daemon to show notifications') ], 'use_notif_daemon': [ opt_bool, True, _('Use D-Bus and Notification-Daemon to show notifications') ],
'showoffline': [ opt_bool, False ], 'showoffline': [ opt_bool, False ],
'show_only_chat_and_online': [ opt_bool, False, _('Show only online and free for chat contacts in roster.')], 'show_only_chat_and_online': [ opt_bool, False, _('Show only online and free for chat contacts in roster.')],
'show_transports_group': [ opt_bool, True ], 'show_transports_group': [ opt_bool, True ],
...@@ -115,7 +115,7 @@ class Config: ...@@ -115,7 +115,7 @@ class Config:
'emoticons_theme': [opt_str, 'static', '', True ], 'emoticons_theme': [opt_str, 'static', '', True ],
'ascii_formatting': [ opt_bool, True, 'ascii_formatting': [ opt_bool, True,
_('Treat * / _ pairs as possible formatting characters.'), True], _('Treat * / _ pairs as possible formatting characters.'), True],
'show_ascii_formatting_chars': [ opt_bool, True , _('If True, do not ' 'show_ascii_formatting_chars': [ opt_bool, True, _('If True, do not '
'remove */_ . So *abc* will be bold but with * * not removed.')], 'remove */_ . So *abc* will be bold but with * * not removed.')],
'rst_formatting_outgoing_messages': [ opt_bool, False, 'rst_formatting_outgoing_messages': [ opt_bool, False,
_('Uses ReStructured text markup to send HTML, plus ascii formatting if selected. For syntax, see http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html (If you want to use this, install docutils)')], _('Uses ReStructured text markup to send HTML, plus ascii formatting if selected. For syntax, see http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html (If you want to use this, install docutils)')],
...@@ -268,7 +268,7 @@ class Config: ...@@ -268,7 +268,7 @@ class Config:
'max_conversation_lines': [opt_int, 500, _('Maximum number of lines that are printed in conversations. Oldest lines are cleared.')], 'max_conversation_lines': [opt_int, 500, _('Maximum number of lines that are printed in conversations. Oldest lines are cleared.')],
'attach_notifications_to_systray': [opt_bool, False, _('If True, notification windows from notification-daemon will be attached to systray icon.')], 'attach_notifications_to_systray': [opt_bool, False, _('If True, notification windows from notification-daemon will be attached to systray icon.')],
'check_idle_every_foo_seconds': [opt_int, 2, _('Choose interval between 2 checks of idleness.')], 'check_idle_every_foo_seconds': [opt_int, 2, _('Choose interval between 2 checks of idleness.')],
'latex_png_dpi': [opt_str, '108',_('Change the value to change the size of latex formulas displayed. The higher is larger.') ], 'latex_png_dpi': [opt_str, '108', _('Change the value to change the size of latex formulas displayed. The higher is larger.') ],
'uri_schemes': [opt_str, 'aaa aaas acap cap cid crid data dav dict dns fax file ftp go gopher h323 http https icap im imap info ipp iris iris.beep iris.xpc iris.xpcs iris.lwz ldap mid modem msrp msrps mtqp mupdate news nfs nntp opaquelocktoken pop pres rtsp service shttp sip sips snmp soap.beep soap.beeps tag tel telnet tftp thismessage tip tv urn vemmi xmlrpc.beep xmlrpc.beeps z39.50r z39.50s about cvs daap ed2k feed fish git iax2 irc ircs ldaps magnet mms rsync ssh svn sftp smb webcal', _('Valid uri schemes. Only schemes in this list will be accepted as "real" uri. (mailto and xmpp are handled separately)'), True], 'uri_schemes': [opt_str, 'aaa aaas acap cap cid crid data dav dict dns fax file ftp go gopher h323 http https icap im imap info ipp iris iris.beep iris.xpc iris.xpcs iris.lwz ldap mid modem msrp msrps mtqp mupdate news nfs nntp opaquelocktoken pop pres rtsp service shttp sip sips snmp soap.beep soap.beeps tag tel telnet tftp thismessage tip tv urn vemmi xmlrpc.beep xmlrpc.beeps z39.50r z39.50s about cvs daap ed2k feed fish git iax2 irc ircs ldaps magnet mms rsync ssh svn sftp smb webcal', _('Valid uri schemes. Only schemes in this list will be accepted as "real" uri. (mailto and xmpp are handled separately)'), True],
'ask_offline_status_on_connection': [ opt_bool, False, _('Ask offline status message to all offline contacts when connection to an accoutn is established. WARNING: This causes a lot of requests to be sent!') ], 'ask_offline_status_on_connection': [ opt_bool, False, _('Ask offline status message to all offline contacts when connection to an accoutn is established. WARNING: This causes a lot of requests to be sent!') ],
'shell_like_completion': [ opt_bool, False, _('If True, completion in groupchats will be like a shell auto-completion')], 'shell_like_completion': [ opt_bool, False, _('If True, completion in groupchats will be like a shell auto-completion')],
...@@ -342,7 +342,7 @@ class Config: ...@@ -342,7 +342,7 @@ class Config:
'msgwin-y-position': [opt_int, -1], # Default is to let the wm decide 'msgwin-y-position': [opt_int, -1], # Default is to let the wm decide
'msgwin-width': [opt_int, 480], 'msgwin-width': [opt_int, 480],
'msgwin-height': [opt_int, 440], 'msgwin-height': [opt_int, 440],
'listen_to_network_manager' : [opt_bool, True], 'listen_to_network_manager': [opt_bool, True],
'is_zeroconf': [opt_bool, False], 'is_zeroconf': [opt_bool, False],
'last_status': [opt_str, 'online'], 'last_status': [opt_str, 'online'],
'last_status_msg': [opt_str, ''], 'last_status_msg': [opt_str, ''],
...@@ -350,9 +350,9 @@ class Config: ...@@ -350,9 +350,9 @@ class Config:
'zeroconf_last_name': [ opt_str, '', '', True ], 'zeroconf_last_name': [ opt_str, '', '', True ],
'zeroconf_jabber_id': [ opt_str, '', '', True ], 'zeroconf_jabber_id': [ opt_str, '', '', True ],
'zeroconf_email': [ opt_str, '', '', True ], 'zeroconf_email': [ opt_str, '', '', True ],
'use_env_http_proxy' : [opt_bool, False], 'use_env_http_proxy': [opt_bool, False],
'answer_receipts' : [opt_bool, True, _('Answer to receipt requests')], 'answer_receipts': [opt_bool, True, _('Answer to receipt requests')],
'request_receipt' : [opt_bool, True, _('Sent receipt requests')], 'request_receipt': [opt_bool, True, _('Sent receipt requests')],
'publish_tune': [opt_bool, False], 'publish_tune': [opt_bool, False],
'publish_location': [opt_bool, False], 'publish_location': [opt_bool, False],
'subscribe_mood': [opt_bool, True], 'subscribe_mood': [opt_bool, True],
...@@ -493,7 +493,7 @@ class Config: ...@@ -493,7 +493,7 @@ class Config:
themes_default = { themes_default = {
# sorted alphanum # sorted alphanum
_('default'): [ '', '', '', 'B', '', '','', 'I', '', '', '', '', '','', _('default'): [ '', '', '', 'B', '', '', '', 'I', '', '', '', '', '', '',
'', 'B' ], '', 'B' ],
_('green'): [ '', '#94aa8c', '', 'B', '#0000ff', '#eff3e7', _('green'): [ '', '#94aa8c', '', 'B', '#0000ff', '#eff3e7',
......
...@@ -1118,7 +1118,7 @@ class Connection(CommonConnection, ConnectionHandlers): ...@@ -1118,7 +1118,7 @@ class Connection(CommonConnection, ConnectionHandlers):
msg = '>>>>>> ' msg = '>>>>>> '
if self._proxy['type']=='bosh': if self._proxy['type']=='bosh':
msg = '%s over BOSH %s' % (msg, self._proxy['bosh_uri']) msg = '%s over BOSH %s' % (msg, self._proxy['bosh_uri'])
if self._proxy['type'] in ['http','socks5'] or self._proxy['bosh_useproxy']: if self._proxy['type'] in ['http', 'socks5'] or self._proxy['bosh_useproxy']:
msg = '%s over proxy %s:%s' % (msg, self._proxy['host'], self._proxy['port']) msg = '%s over proxy %s:%s' % (msg, self._proxy['host'], self._proxy['port'])
log.info(msg) log.info(msg)
...@@ -1338,7 +1338,7 @@ class Connection(CommonConnection, ConnectionHandlers): ...@@ -1338,7 +1338,7 @@ class Connection(CommonConnection, ConnectionHandlers):
if not common.xmpp.isResultNode(resp): if not common.xmpp.isResultNode(resp):
self.dispatch('PING_ERROR', (pingTo)) self.dispatch('PING_ERROR', (pingTo))
return return
timeDiff = round(timePong - timePing,2) timeDiff = round(timePong - timePing, 2)
self.dispatch('PING_REPLY', (pingTo, timeDiff)) self.dispatch('PING_REPLY', (pingTo, timeDiff))
if pingTo: if pingTo:
timePing = time_time() timePing = time_time()
...@@ -2054,7 +2054,7 @@ class Connection(CommonConnection, ConnectionHandlers): ...@@ -2054,7 +2054,7 @@ class Connection(CommonConnection, ConnectionHandlers):
def send_gc_subject(self, jid, subject): def send_gc_subject(self, jid, subject):
if not self.connection: if not self.connection:
return return
msg_iq = common.xmpp.Message(jid,typ = 'groupchat', subject = subject) msg_iq = common.xmpp.Message(jid, typ = 'groupchat', subject = subject)
self.connection.send(msg_iq) self.connection.send(msg_iq)
def request_gc_config(self, room_jid): def request_gc_config(self, room_jid):
...@@ -2178,8 +2178,8 @@ class Connection(CommonConnection, ConnectionHandlers): ...@@ -2178,8 +2178,8 @@ class Connection(CommonConnection, ConnectionHandlers):
username = gajim.config.get_per('accounts', self.name, 'name') username = gajim.config.get_per('accounts', self.name, 'name')
iq = common.xmpp.Iq(typ = 'set', to = hostname) iq = common.xmpp.Iq(typ = 'set', to = hostname)
q = iq.setTag(common.xmpp.NS_REGISTER + ' query') q = iq.setTag(common.xmpp.NS_REGISTER + ' query')
q.setTagData('username',username) q.setTagData('username', username)
q.setTagData('password',password) q.setTagData('password', password)
self.connection.send(iq) self.connection.send(iq)
def get_password(self, callback): def get_password(self, callback):
...@@ -2260,7 +2260,7 @@ class Connection(CommonConnection, ConnectionHandlers): ...@@ -2260,7 +2260,7 @@ class Connection(CommonConnection, ConnectionHandlers):
item.addChild(node = form) item.addChild(node = form)
else: else:
for i in form.keys(): for i in form.keys():
item.setTagData(i,form[i]) item.setTagData(i, form[i])
def _on_response(resp): def _on_response(resp):
jid = jid = helpers.get_jid_from_iq(resp) jid = jid = helpers.get_jid_from_iq(resp)
tag = resp.getTag('query', namespace = common.xmpp.NS_SEARCH) tag = resp.getTag('query', namespace = common.xmpp.NS_SEARCH)
......
...@@ -180,7 +180,7 @@ class ConnectionDisco: ...@@ -180,7 +180,7 @@ class ConnectionDisco:
frm=to) frm=to)
iq.setAttr('id', id_) iq.setAttr('id', id_)
query = iq.setTag('query') query = iq.setTag('query')
query.setAttr('node','http://gajim.org#' + gajim.version.split('-', 1)[0]) query.setAttr('node', 'http://gajim.org#' + gajim.version.split('-', 1)[0])
for f in (common.xmpp.NS_BYTESTREAM, common.xmpp.NS_SI, for f in (common.xmpp.NS_BYTESTREAM, common.xmpp.NS_SI,
common.xmpp.NS_FILE, common.xmpp.NS_COMMANDS): common.xmpp.NS_FILE, common.xmpp.NS_COMMANDS):
feature = common.xmpp.Node('feature') feature = common.xmpp.Node('feature')
...@@ -1634,7 +1634,7 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ...@@ -1634,7 +1634,7 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream,
is_continued = False is_continued = False
if invite.getTag('invite').getTag('continue'): if invite.getTag('invite').getTag('continue'):
is_continued = True is_continued = True
self.dispatch('GC_INVITATION',(frm, jid_from, reason, password, self.dispatch('GC_INVITATION', (frm, jid_from, reason, password,
is_continued)) is_continued))
def _presenceCB(self, con, prs): def _presenceCB(self, con, prs):
......
...@@ -40,7 +40,7 @@ class GlobalEventsDispatcher(object): ...@@ -40,7 +40,7 @@ class GlobalEventsDispatcher(object):
if event_name in self.handlers: if event_name in self.handlers:
handlers_list = self.handlers[event_name] handlers_list = self.handlers[event_name]
i = 0 i = 0
for i,h in enumerate(handlers_list): for i, h in enumerate(handlers_list):
if priority < h[0]: if priority < h[0]:
break break
......
...@@ -102,7 +102,7 @@ class FancyFormatter(logging.Formatter): ...@@ -102,7 +102,7 @@ class FancyFormatter(logging.Formatter):
""" """
colors_mapping = { colors_mapping = {
'DEBUG': colors.BLUE, 'DEBUG': colors.BLUE,
'INFO' : colors.GREEN, 'INFO': colors.GREEN,
'WARNING': colors.BROWN, 'WARNING': colors.BROWN,
'ERROR': colors.RED, 'ERROR': colors.RED,
'CRITICAL': colors.BRIGHT_RED, 'CRITICAL': colors.BRIGHT_RED,
......
...@@ -706,7 +706,7 @@ class OptionsParser: ...@@ -706,7 +706,7 @@ class OptionsParser:
""" """
dirs = ('../data', gajim.gajimpaths.root, gajim.DATA_DIR) dirs = ('../data', gajim.gajimpaths.root, gajim.DATA_DIR)
for evt in gajim.config.get_per('soundevents'): for evt in gajim.config.get_per('soundevents'):
path = gajim.config.get_per('soundevents', evt ,'path') path = gajim.config.get_per('soundevents', evt, 'path')
# absolute and relative passes are necessary # absolute and relative passes are necessary
path = helpers.strip_soundfile_path(path, dirs, abs=False) path = helpers.strip_soundfile_path(path, dirs, abs=False)
path = helpers.strip_soundfile_path(path, dirs, abs=True) path = helpers.strip_soundfile_path(path, dirs, abs=True)
......
...@@ -189,7 +189,7 @@ class NSLookupResolver(CommonResolver): ...@@ -189,7 +189,7 @@ class NSLookupResolver(CommonResolver):
if not result: if not result:
return [] return []
hosts = [] hosts = []
lines = result.replace('\r','').split('\n') lines = result.replace('\r', '').split('\n')
current_host = None current_host = None
for line in lines: for line in lines:
line = line.lstrip() line = line.lstrip()
...@@ -305,7 +305,7 @@ class NsLookup(IdleCommand): ...@@ -305,7 +305,7 @@ class NsLookup(IdleCommand):
return return
def _compose_command_args(self): def _compose_command_args(self):
return ['nslookup', '-type=' + self.type , self.host] return ['nslookup', '-type=' + self.type, self.host]
def _return_result(self): def _return_result(self):
if self.result_handler: if self.result_handler:
......
...@@ -25,7 +25,7 @@ try: ...@@ -25,7 +25,7 @@ try:
from docutils import io from docutils import io
from docutils.core import Publisher from docutils.core import Publisher
from docutils.parsers.rst import roles from docutils.parsers.rst import roles
from docutils import nodes,utils from docutils import nodes, utils
from docutils.parsers.rst.roles import set_classes from docutils.parsers.rst.roles import set_classes
except ImportError: except ImportError:
print "Requires docutils 0.4 for set_classes to be available" print "Requires docutils 0.4 for set_classes to be available"
...@@ -91,7 +91,7 @@ else: ...@@ -91,7 +91,7 @@ else:
generate_uri_role('xep-reference', ('jep', 'xep'), generate_uri_role('xep-reference', ('jep', 'xep'),
'XEP #', 'http://www.xmpp.org/extensions/', 'xep-%04d.html', 'XEP #', 'http://www.xmpp.org/extensions/', 'xep-%04d.html',
pos_int_validator) pos_int_validator)
generate_uri_role('gajim-ticket-reference', ('ticket','gtrack'), generate_uri_role('gajim-ticket-reference', ('ticket', 'gtrack'),
'Gajim Ticket #', 'http://trac.gajim.org/ticket/', '%d', 'Gajim Ticket #', 'http://trac.gajim.org/ticket/', '%d',
pos_int_validator) pos_int_validator)
......
...@@ -387,7 +387,7 @@ class Socks5: ...@@ -387,7 +387,7 @@ class Socks5:
def open_file_for_reading(self): def open_file_for_reading(self):
if self.file is None: if self.file is None:
try: try:
self.file = open(self.file_props['file-name'],'rb') self.file = open(self.file_props['file-name'], 'rb')
if 'offset' in self.file_props and self.file_props['offset']: if 'offset' in self.file_props and self.file_props['offset']:
self.size = self.file_props['offset'] self.size = self.file_props['offset']
self.file.seek(self.size) self.file.seek(self.size)
...@@ -448,7 +448,7 @@ class Socks5: ...@@ -448,7 +448,7 @@ class Socks5:
self.disconnect() self.disconnect()
return add return add
def send_raw(self,raw_data): def send_raw(self, raw_data):
""" """
Write raw outgoing data Write raw outgoing data
""" """
...@@ -651,7 +651,7 @@ class Socks5: ...@@ -651,7 +651,7 @@ class Socks5:
host, = '.'.join(str(s) for s in host_arr) host, = '.'.join(str(s) for s in host_arr)
host_len = len(host) host_len = len(host)
elif host_type == 0x03: elif host_type == 0x03:
host_len, = struct.unpack('!B' , buff[4]) host_len, = struct.unpack('!B', buff[4])
host, = struct.unpack('!%ds' % host_len, buff[5:5 + host_len]) host, = struct.unpack('!%ds' % host_len, buff[5:5 + host_len])
portlen = len(buff[host_len + 5:]) portlen = len(buff[host_len + 5:])
if portlen == 1: if portlen == 1:
......
...@@ -424,7 +424,7 @@ class EncryptedStanzaSession(StanzaSession): ...@@ -424,7 +424,7 @@ class EncryptedStanzaSession(StanzaSession):
n, e = (crypto.decode_mpi(base64.b64decode( n, e = (crypto.decode_mpi(base64.b64decode(
keyvalue.getTagData(x))) for x in ('Modulus', 'Exponent')) keyvalue.getTagData(x))) for x in ('Modulus', 'Exponent'))
eir_pubkey = RSA.construct((n,long(e))) eir_pubkey = RSA.construct((n, long(e)))
pubkey_o = xmpp.c14n.c14n(keyvalue, self._is_buggy_gajim()) pubkey_o = xmpp.c14n.c14n(keyvalue, self._is_buggy_gajim())
else: else:
...@@ -750,7 +750,7 @@ class EncryptedStanzaSession(StanzaSession): ...@@ -750,7 +750,7 @@ class EncryptedStanzaSession(StanzaSession):
else: else:
negotiated['logging'] = self.logging_preference()[0] negotiated['logging'] = self.logging_preference()[0]
for r,a in (('recv_pubkey', 'resp_pubkey'), ('send_pubkey', for r, a in (('recv_pubkey', 'resp_pubkey'), ('send_pubkey',
'init_pubkey')): 'init_pubkey')):
negotiated[r] = None negotiated[r] = None
......
...@@ -202,7 +202,7 @@ class SASL(PlugIn): ...@@ -202,7 +202,7 @@ class SASL(PlugIn):
def MechanismHandler(self): def MechanismHandler(self):
if 'ANONYMOUS' in self.mecs and self.username is None: if 'ANONYMOUS' in self.mecs and self.username is None:
self.mecs.remove('ANONYMOUS') self.mecs.remove('ANONYMOUS')
node = Node('auth',attrs={'xmlns': NS_SASL, 'mechanism': 'ANONYMOUS'}) node = Node('auth', attrs={'xmlns': NS_SASL, 'mechanism': 'ANONYMOUS'})
self.mechanism = 'ANONYMOUS' self.mechanism = 'ANONYMOUS'
self.startsasl = SASL_IN_PROCESS self.startsasl = SASL_IN_PROCESS
self._owner.send(str(node)) self._owner.send(str(node))
...@@ -222,7 +222,7 @@ class SASL(PlugIn): ...@@ -222,7 +222,7 @@ class SASL(PlugIn):
self._owner.xmpp_hostname)[1] self._owner.xmpp_hostname)[1]
kerberos.authGSSClientStep(self.gss_vc, '') kerberos.authGSSClientStep(self.gss_vc, '')
response = kerberos.authGSSClientResponse(self.gss_vc) response = kerberos.authGSSClientResponse(self.gss_vc)
node=Node('auth',attrs={'xmlns': NS_SASL, 'mechanism': 'GSSAPI'}, node=Node('auth', attrs={'xmlns': NS_SASL, 'mechanism': 'GSSAPI'},
payload=(response or '')) payload=(response or ''))
self.mechanism = 'GSSAPI' self.mechanism = 'GSSAPI'
self.gss_step = GSS_STATE_STEP self.gss_step = GSS_STATE_STEP
...@@ -233,7 +233,7 @@ class SASL(PlugIn): ...@@ -233,7 +233,7 @@ class SASL(PlugIn):
log.info('GSSAPI authentication failed: %s' % str(e)) log.info('GSSAPI authentication failed: %s' % str(e))
if 'DIGEST-MD5' in self.mecs: if 'DIGEST-MD5' in self.mecs:
self.mecs.remove('DIGEST-MD5') self.mecs.remove('DIGEST-MD5')
node = Node('auth',attrs={'xmlns': NS_SASL, 'mechanism': 'DIGEST-MD5'}) node = Node('auth', attrs={'xmlns': NS_SASL, 'mechanism': 'DIGEST-MD5'})
self.mechanism = 'DIGEST-MD5' self.mechanism = 'DIGEST-MD5'
self.startsasl = SASL_IN_PROCESS self.startsasl = SASL_IN_PROCESS
self._owner.send(str(node)) self._owner.send(str(node))
...@@ -369,7 +369,7 @@ class SASL(PlugIn): ...@@ -369,7 +369,7 @@ class SASL(PlugIn):
sasl_data = u'' sasl_data = u''
for key in ('charset', 'username', 'realm', 'nonce', 'nc', 'cnonce', for key in ('charset', 'username', 'realm', 'nonce', 'nc', 'cnonce',
'digest-uri', 'response', 'qop'): 'digest-uri', 'response', 'qop'):
if key in ('nc','qop','response','charset'): if key in ('nc', 'qop', 'response', 'charset'):
sasl_data += u"%s=%s," % (key, self.resp[key]) sasl_data += u"%s=%s," % (key, self.resp[key])
else: else:
sasl_data += u'%s="%s",' % (key, self.resp[key]) sasl_data += u'%s="%s",' % (key, self.resp[key])
...@@ -422,10 +422,10 @@ class NonBlockingNonSASL(PlugIn): ...@@ -422,10 +422,10 @@ class NonBlockingNonSASL(PlugIn):
log.error('No result node arrived! Aborting...') log.error('No result node arrived! Aborting...')
return self.on_auth(None) return self.on_auth(None)
iq=Iq(typ='set',node=resp) iq=Iq(typ='set', node=resp)
query = iq.getTag('query') query = iq.getTag('query')
query.setTagData('username',self.user) query.setTagData('username', self.user)
query.setTagData('resource',self.resource) query.setTagData('resource', self.resource)
if query.getTag('digest'): if query.getTag('digest'):
log.info("Performing digest authentication") log.info("Performing digest authentication")
...@@ -454,7 +454,7 @@ class NonBlockingNonSASL(PlugIn): ...@@ -454,7 +454,7 @@ class NonBlockingNonSASL(PlugIn):
authentication") authentication")
query.setTagData('password', self.password) query.setTagData('password', self.password)
self._method = 'plain' self._method = 'plain'
resp = self.owner.Dispatcher.SendAndWaitForResponse(iq,func=self._on_auth) resp = self.owner.Dispatcher.SendAndWaitForResponse(iq, func=self._on_auth)
def _on_auth(self, resp): def _on_auth(self, resp):
if isResultNode(resp): if isResultNode(resp):
...@@ -527,7 +527,7 @@ class NonBlockingBind(PlugIn): ...@@ -527,7 +527,7 @@ class NonBlockingBind(PlugIn):
self._owner.onreceive(None) self._owner.onreceive(None)
self._owner.Dispatcher.SendAndWaitForResponse( self._owner.Dispatcher.SendAndWaitForResponse(
Protocol('iq',typ='set', payload=[Node('bind', attrs={'xmlns':NS_BIND}, Protocol('iq', typ='set', payload=[Node('bind', attrs={'xmlns':NS_BIND},
payload=self._resource)]), func=self._on_bound) payload=self._resource)]), func=self._on_bound)
def _on_bound(self, resp): def _on_bound(self, resp):
......
...@@ -373,7 +373,7 @@ class NonBlockingBOSH(NonBlockingTransport): ...@@ -373,7 +373,7 @@ class NonBlockingBOSH(NonBlockingTransport):
def get_current_state(self): def get_current_state(self):
t = '------ SOCKET_ID\tSOCKET_STATE\tPENDING_REQS\n' t = '------ SOCKET_ID\tSOCKET_STATE\tPENDING_REQS\n'
for s in self.http_socks: for s in self.http_socks:
t = '%s------ %s\t%s\t%s\n' % (t,id(s), s.get_state(), s.pending_requests) t = '%s------ %s\t%s\t%s\n' % (t, id(s), s.get_state(), s.pending_requests)
t = '%s------ prio stanzas: %s, queued XMPP stanzas: %s, not_acked stanzas: %s' \ t = '%s------ prio stanzas: %s, queued XMPP stanzas: %s, not_acked stanzas: %s' \
% (t, self.prio_bosh_stanzas, self.stanza_buffer, % (t, self.prio_bosh_stanzas, self.stanza_buffer,
self.ack_checker.get_not_acked_rids()) self.ack_checker.get_not_acked_rids())
...@@ -417,7 +417,7 @@ class NonBlockingBOSH(NonBlockingTransport): ...@@ -417,7 +417,7 @@ class NonBlockingBOSH(NonBlockingTransport):
'xmpp:version': '1.0', 'xmpp:version': '1.0',
'ver': '1.6', 'ver': '1.6',
'xmlns:xmpp': 'urn:xmpp:xbosh'}) 'xmlns:xmpp': 'urn:xmpp:xbosh'})
self.send_BOSH((t,True)) self.send_BOSH((t, True))
def start_disconnect(self): def start_disconnect(self):
NonBlockingTransport.start_disconnect(self) NonBlockingTransport.start_disconnect(self)
......
...@@ -431,7 +431,7 @@ class NonBlockingClient: ...@@ -431,7 +431,7 @@ class NonBlockingClient:
Raise event to connection instance. DATA_SENT and DATA_RECIVED events Raise event to connection instance. DATA_SENT and DATA_RECIVED events
are used in XML console to show XMPP traffic are used in XML console to show XMPP traffic
""" """
log.info('raising event from transport: :::::%s::::\n_____________\n%s\n_____________\n' % (event_type,data)) log.info('raising event from transport: :::::%s::::\n_____________\n%s\n_____________\n' % (event_type, data))
if hasattr(self, 'Dispatcher'): if hasattr(self, 'Dispatcher'):
self.Dispatcher.Event('', event_type, data) self.Dispatcher.Event('', event_type, data)
...@@ -556,13 +556,13 @@ class NonBlockingClient: ...@@ -556,13 +556,13 @@ class NonBlockingClient:
### following methods are moved from blocking client class of xmpppy ### following methods are moved from blocking client class of xmpppy
############################################################################### ###############################################################################
def RegisterDisconnectHandler(self,handler): def RegisterDisconnectHandler(self, handler):
""" """
Register handler that will be called on disconnect Register handler that will be called on disconnect
""" """
self.disconnect_handlers.append(handler) self.disconnect_handlers.append(handler)
def UnregisterDisconnectHandler(self,handler): def UnregisterDisconnectHandler(self, handler):
""" """
Unregister handler that is called on disconnect Unregister handler that is called on disconnect
""" """
......
...@@ -277,13 +277,13 @@ class XMPPDispatcher(PlugIn): ...@@ -277,13 +277,13 @@ class XMPPDispatcher(PlugIn):
if not typ and not ns: if not typ and not ns:
typ='default' typ='default'
if xmlns not in self.handlers: if xmlns not in self.handlers:
self.RegisterNamespace(xmlns,'warn') self.RegisterNamespace(xmlns, 'warn')
if name not in self.handlers[xmlns]: if name not in self.handlers[xmlns]:
self.RegisterProtocol(name,Protocol,xmlns,'warn') self.RegisterProtocol(name, Protocol, xmlns, 'warn')
if typ+ns not in self.handlers[xmlns][name]: if typ+ns not in self.handlers[xmlns][name]:
self.handlers[xmlns][name][typ+ns]=[] self.handlers[xmlns][name][typ+ns]=[]
if makefirst: if makefirst:
self.handlers[xmlns][name][typ+ns].insert(0,{'func':handler, self.handlers[xmlns][name][typ+ns].insert(0, {'func':handler,
'system':system}) 'system':system})
else: else:
self.handlers[xmlns][name][typ+ns].append({'func':handler, self.handlers[xmlns][name][typ+ns].append({'func':handler,
...@@ -340,7 +340,7 @@ class XMPPDispatcher(PlugIn): ...@@ -340,7 +340,7 @@ class XMPPDispatcher(PlugIn):
Return stanza back to the sender with <feature-not-implemented/> error Return stanza back to the sender with <feature-not-implemented/> error
set set
""" """
if stanza.getType() in ('get','set'): if stanza.getType() in ('get', 'set'):
conn._owner.send(Error(stanza, ERR_FEATURE_NOT_IMPLEMENTED)) conn._owner.send(Error(stanza, ERR_FEATURE_NOT_IMPLEMENTED))
def RegisterCycleHandler(self, handler): def RegisterCycleHandler(self, handler):
...@@ -572,7 +572,7 @@ class BOSHDispatcher(XMPPDispatcher): ...@@ -572,7 +572,7 @@ class BOSHDispatcher(XMPPDispatcher):
fromstream = self._metastream fromstream = self._metastream
fromstream.setAttr('from', fromstream.getAttr('to')) fromstream.setAttr('from', fromstream.getAttr('to'))
fromstream.delAttr('to') fromstream.delAttr('to')
data = '%s%s>%s' % (XML_DECLARATION,str(fromstream)[:-2] ,data) data = '%s%s>%s' % (XML_DECLARATION, str(fromstream)[:-2], data)
self.restart = False self.restart = False
return XMPPDispatcher.ProcessNonBlocking(self, data) return XMPPDispatcher.ProcessNonBlocking(self, data)
......
...@@ -45,9 +45,9 @@ def getRegInfo(disp, host, info={}, sync=True): ...@@ -45,9 +45,9 @@ def getRegInfo(disp, host, info={}, sync=True):
See JEP-0077 for details. See JEP-0077 for details.
""" """
iq=Iq('get',NS_REGISTER,to=host) iq=Iq('get', NS_REGISTER, to=host)
for i in info.keys(): for i in info.keys():
iq.setTagData(i,info[i]) iq.setTagData(i, info[i])
if sync: if sync:
disp.SendAndCallForResponse(iq, lambda resp: disp.SendAndCallForResponse(iq, lambda resp:
_ReceivedRegInfo(disp.Dispatcher, resp, host)) _ReceivedRegInfo(disp.Dispatcher, resp, host))
...@@ -55,26 +55,26 @@ def getRegInfo(disp, host, info={}, sync=True): ...@@ -55,26 +55,26 @@ def getRegInfo(disp, host, info={}, sync=True):
disp.SendAndCallForResponse(iq, _ReceivedRegInfo, {'agent': host }) disp.SendAndCallForResponse(iq, _ReceivedRegInfo, {'agent': host })
def _ReceivedRegInfo(con, resp, agent): def _ReceivedRegInfo(con, resp, agent):
Iq('get',NS_REGISTER,to=agent) Iq('get', NS_REGISTER, to=agent)
if not isResultNode(resp): if not isResultNode(resp):
error_msg = resp.getErrorMsg() error_msg = resp.getErrorMsg()
con.Event(NS_REGISTER,REGISTER_DATA_RECEIVED,(agent,None,False,error_msg)) con.Event(NS_REGISTER, REGISTER_DATA_RECEIVED, (agent, None, False, error_msg))
return return
tag=resp.getTag('query',namespace=NS_REGISTER) tag=resp.getTag('query', namespace=NS_REGISTER)
if not tag: if not tag:
error_msg = resp.getErrorMsg() error_msg = resp.getErrorMsg()
con.Event(NS_REGISTER,REGISTER_DATA_RECEIVED,(agent,None,False,error_msg)) con.Event(NS_REGISTER, REGISTER_DATA_RECEIVED, (agent, None, False, error_msg))
return return
df=tag.getTag('x',namespace=NS_DATA) df=tag.getTag('x', namespace=NS_DATA)
if df: if df:
con.Event(NS_REGISTER,REGISTER_DATA_RECEIVED,(agent,df,True,