From 05a86e8357d75a921bd40f1c265d339cce33ead0 Mon Sep 17 00:00:00 2001 From: mariolenz Date: Mon, 28 Dec 2009 23:04:23 +0100 Subject: [PATCH] harmonize indentation. Fixes #5518 --- src/common/gajim.py | 8 +++---- src/common/xmpp/protocol.py | 12 +++++----- src/common/zeroconf/zeroconf_avahi.py | 4 ++-- src/common/zeroconf/zeroconf_bonjour.py | 22 ++++++++--------- src/groupchat_control.py | 8 +++---- src/history_manager.py | 32 ++++++++++++------------- src/roster_window.py | 4 ++-- 7 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/common/gajim.py b/src/common/gajim.py index a0eab9d84..0de76fcca 100644 --- a/src/common/gajim.py +++ b/src/common/gajim.py @@ -82,7 +82,7 @@ MY_EMOTS_PATH = gajimpaths['MY_EMOTS'] MY_ICONSETS_PATH = gajimpaths['MY_ICONSETS'] MY_MOOD_ICONSETS_PATH = gajimpaths['MY_MOOD_ICONSETS'] MY_ACTIVITY_ICONSETS_PATH = gajimpaths['MY_ACTIVITY_ICONSETS'] -MY_CACERTS = gajimpaths['MY_CACERTS'] +MY_CACERTS = gajimpaths['MY_CACERTS'] TMP = gajimpaths['TMP'] DATA_DIR = gajimpaths['DATA'] ICONS_DIR = gajimpaths['ICONS'] @@ -223,9 +223,9 @@ def get_server_from_jid(jid): return jid[pos:] def get_resource_from_jid(jid): - tokens = jid.split('/', 1) - if len(tokens) > 1: - return tokens[1] + tokens = jid.split('/', 1) + if len(tokens) > 1: + return tokens[1] def get_name_and_server_from_jid(jid): name = get_nick_from_jid(jid) diff --git a/src/common/xmpp/protocol.py b/src/common/xmpp/protocol.py index a59ea81cb..16b7ff058 100644 --- a/src/common/xmpp/protocol.py +++ b/src/common/xmpp/protocol.py @@ -523,12 +523,12 @@ class Protocol(Node): return time.strftime('%Y%m%dT%H:%M:%S', time.gmtime()) def getTimestamp2(self): - """ - Return the timestamp in the 'yyyymmddThhmmss' format - """ - if self.timestamp: - return self.timestamp - return time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime()) + """ + Return the timestamp in the 'yyyymmddThhmmss' format + """ + if self.timestamp: + return self.timestamp + return time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime()) def getID(self): """ diff --git a/src/common/zeroconf/zeroconf_avahi.py b/src/common/zeroconf/zeroconf_avahi.py index baa373880..1db21adb4 100644 --- a/src/common/zeroconf/zeroconf_avahi.py +++ b/src/common/zeroconf/zeroconf_avahi.py @@ -77,7 +77,7 @@ class Zeroconf: log.debug('Found service %s in domain %s on %i.%i.' % (name, domain, interface, protocol)) if not self.connected: - return + return # synchronous resolving self.server.ResolveService( int(interface), int(protocol), name, stype, @@ -90,7 +90,7 @@ class Zeroconf: log.debug('Service %s in domain %s on %i.%i disappeared.' % (name, domain, interface, protocol)) if not self.connected: - return + return if name != self.name: for key in self.contacts.keys(): if self.contacts[key][C_BARE_NAME] == name: diff --git a/src/common/zeroconf/zeroconf_bonjour.py b/src/common/zeroconf/zeroconf_bonjour.py index 10568a7a7..772c9b2f0 100644 --- a/src/common/zeroconf/zeroconf_bonjour.py +++ b/src/common/zeroconf/zeroconf_bonjour.py @@ -10,11 +10,11 @@ ## ## Gajim is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License -## along with Gajim. If not, see . +## along with Gajim. If not, see . ## from common import gajim @@ -28,14 +28,14 @@ except ImportError, e: pass -resolve_timeout = 1 +resolve_timeout = 1 class Zeroconf: def __init__(self, new_serviceCB, remove_serviceCB, name_conflictCB, disconnected_CB, error_CB, name, host, port): - self.domain = None # specific domain to browse + self.domain = None # specific domain to browse self.stype = '_presence._tcp' - self.port = port # listening port that gets announced + self.port = port # listening port that gets announced self.username = name self.host = host self.txt = pybonjour.TXTRecord() # service data @@ -48,7 +48,7 @@ class Zeroconf: self.disconnected_CB = disconnected_CB self.error_CB = error_CB - self.contacts = {} # all current local contacts with data + self.contacts = {} # all current local contacts with data self.connected = False self.announced = False self.invalid_self_contact = {} @@ -58,7 +58,7 @@ class Zeroconf: def browse_callback(self, sdRef, flags, interfaceIndex, errorCode, serviceName, regtype, replyDomain): gajim.log.debug('Found service %s in domain %s on %i(type: %s).' % (serviceName, replyDomain, interfaceIndex, regtype)) if not self.connected: - return + return if errorCode != pybonjour.kDNSServiceErr_NoError: return if not (flags & pybonjour.kDNSServiceFlagsAdd): @@ -83,7 +83,7 @@ class Zeroconf: def remove_service_callback(self, name): gajim.log.debug('Service %s disappeared.' % name) if not self.connected: - return + return if name != self.name: for key in self.contacts.keys(): if self.contacts[key][C_BARE_NAME] == name: @@ -103,7 +103,7 @@ class Zeroconf: def service_resolved_callback(self, sdRef, flags, interfaceIndex, errorCode, fullname, hosttarget, port, txtRecord): - # TODO: do proper decoding... + # TODO: do proper decoding... escaping= { r'\.': '.', r'\032': ' ', @@ -211,7 +211,7 @@ class Zeroconf: txt['version'] = 1 txt['txtvers'] = 1 - # replace gajim's show messages with compatible ones + # replace gajim's show messages with compatible ones if 'status' in self.txt: txt['status'] = self.replace_show(self.txt['status']) else: @@ -221,7 +221,7 @@ class Zeroconf: try: sdRef = pybonjour.DNSServiceRegister(name = self.name, - regtype = self.stype, port = self.port, txtRecord = self.txt, + regtype = self.stype, port = self.port, txtRecord = self.txt, callBack = self.service_added_callback) self.service_sdRef = sdRef except pybonjour.BonjourError, e: diff --git a/src/groupchat_control.py b/src/groupchat_control.py index 5a5d7749e..71f3cf3ac 100644 --- a/src/groupchat_control.py +++ b/src/groupchat_control.py @@ -126,8 +126,8 @@ def tree_cell_data_func(column, renderer, model, iter_, tv=None): class PrivateChatControl(ChatControl): TYPE_ID = message_control.TYPE_PM - # Set a command host to bound to. Every command given through a private chat - # will be processed with this command host. + # Set a command host to bound to. Every command given through a private chat + # will be processed with this command host. COMMAND_HOST = PrivateChatCommands def __init__(self, parent_win, gc_contact, contact, account, session): @@ -193,8 +193,8 @@ class PrivateChatControl(ChatControl): class GroupchatControl(ChatControlBase): TYPE_ID = message_control.TYPE_GC - # Set a command host to bound to. Every command given through a group chat - # will be processed with this command host. + # Set a command host to bound to. Every command given through a group chat + # will be processed with this command host. COMMAND_HOST = GroupChatCommands def __init__(self, parent_win, contact, acct, is_continued=False): diff --git a/src/history_manager.py b/src/history_manager.py index 13dd22a62..82c8e1475 100644 --- a/src/history_manager.py +++ b/src/history_manager.py @@ -57,23 +57,23 @@ import getopt from common import i18n def parseOpts(): - config_path = None + config_path = None - try: - shortargs = 'hc:' - longargs = 'help config_path=' - opts = getopt.getopt(sys.argv[1:], shortargs, longargs.split())[0] - except getopt.error, msg: - print str(msg) - print 'for help use --help' - sys.exit(2) - for o, a in opts: - if o in ('-h', '--help'): - print 'history_manager [--help] [--config-path]' - sys.exit() - elif o in ('-c', '--config-path'): - config_path = a - return config_path + try: + shortargs = 'hc:' + longargs = 'help config_path=' + opts = getopt.getopt(sys.argv[1:], shortargs, longargs.split())[0] + except getopt.error, msg: + print str(msg) + print 'for help use --help' + sys.exit(2) + for o, a in opts: + if o in ('-h', '--help'): + print 'history_manager [--help] [--config-path]' + sys.exit() + elif o in ('-c', '--config-path'): + config_path = a + return config_path config_path = parseOpts() del parseOpts diff --git a/src/roster_window.py b/src/roster_window.py index 49aa14b5b..d80efce69 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -1778,7 +1778,7 @@ class RosterWindow: """ Remove contacts on last events removed - Only performed if removal was requested before but the contact still had + Only performed if removal was requested before but the contact still had pending events """ contact_list = ((event.jid.split('/')[0], event.account) for event in \ @@ -5748,7 +5748,7 @@ class RosterWindow: self.popups_notification_height = 0 self.popup_notification_windows = [] - # Remove contact from roster when last event opened + # Remove contact from roster when last event opened # { (contact, account): { backend: boolean } self.contacts_to_be_removed = {} gajim.events.event_removed_subscribe(self.on_event_removed)