harmonize indentation. Fixes #5518

This commit is contained in:
mariolenz 2009-12-28 23:04:23 +01:00
parent e6b4382aaf
commit 05a86e8357
7 changed files with 45 additions and 45 deletions

View File

@ -82,7 +82,7 @@ MY_EMOTS_PATH = gajimpaths['MY_EMOTS']
MY_ICONSETS_PATH = gajimpaths['MY_ICONSETS'] MY_ICONSETS_PATH = gajimpaths['MY_ICONSETS']
MY_MOOD_ICONSETS_PATH = gajimpaths['MY_MOOD_ICONSETS'] MY_MOOD_ICONSETS_PATH = gajimpaths['MY_MOOD_ICONSETS']
MY_ACTIVITY_ICONSETS_PATH = gajimpaths['MY_ACTIVITY_ICONSETS'] MY_ACTIVITY_ICONSETS_PATH = gajimpaths['MY_ACTIVITY_ICONSETS']
MY_CACERTS = gajimpaths['MY_CACERTS'] MY_CACERTS = gajimpaths['MY_CACERTS']
TMP = gajimpaths['TMP'] TMP = gajimpaths['TMP']
DATA_DIR = gajimpaths['DATA'] DATA_DIR = gajimpaths['DATA']
ICONS_DIR = gajimpaths['ICONS'] ICONS_DIR = gajimpaths['ICONS']
@ -223,9 +223,9 @@ def get_server_from_jid(jid):
return jid[pos:] return jid[pos:]
def get_resource_from_jid(jid): def get_resource_from_jid(jid):
tokens = jid.split('/', 1) tokens = jid.split('/', 1)
if len(tokens) > 1: if len(tokens) > 1:
return tokens[1] return tokens[1]
def get_name_and_server_from_jid(jid): def get_name_and_server_from_jid(jid):
name = get_nick_from_jid(jid) name = get_nick_from_jid(jid)

View File

@ -523,12 +523,12 @@ class Protocol(Node):
return time.strftime('%Y%m%dT%H:%M:%S', time.gmtime()) return time.strftime('%Y%m%dT%H:%M:%S', time.gmtime())
def getTimestamp2(self): def getTimestamp2(self):
""" """
Return the timestamp in the 'yyyymmddThhmmss' format Return the timestamp in the 'yyyymmddThhmmss' format
""" """
if self.timestamp: if self.timestamp:
return self.timestamp return self.timestamp
return time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime()) return time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime())
def getID(self): def getID(self):
""" """

View File

@ -77,7 +77,7 @@ class Zeroconf:
log.debug('Found service %s in domain %s on %i.%i.' % (name, domain, log.debug('Found service %s in domain %s on %i.%i.' % (name, domain,
interface, protocol)) interface, protocol))
if not self.connected: if not self.connected:
return return
# synchronous resolving # synchronous resolving
self.server.ResolveService( int(interface), int(protocol), name, stype, 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, log.debug('Service %s in domain %s on %i.%i disappeared.' % (name,
domain, interface, protocol)) domain, interface, protocol))
if not self.connected: if not self.connected:
return return
if name != self.name: if name != self.name:
for key in self.contacts.keys(): for key in self.contacts.keys():
if self.contacts[key][C_BARE_NAME] == name: if self.contacts[key][C_BARE_NAME] == name:

View File

@ -10,11 +10,11 @@
## ##
## Gajim is distributed in the hope that it will be useful, ## Gajim is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of ## 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. ## GNU General Public License for more details.
## ##
## You should have received a copy of the GNU General Public License ## You should have received a copy of the GNU General Public License
## along with Gajim. If not, see <http://www.gnu.org/licenses/>. ## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
## ##
from common import gajim from common import gajim
@ -28,14 +28,14 @@ except ImportError, e:
pass pass
resolve_timeout = 1 resolve_timeout = 1
class Zeroconf: class Zeroconf:
def __init__(self, new_serviceCB, remove_serviceCB, name_conflictCB, def __init__(self, new_serviceCB, remove_serviceCB, name_conflictCB,
disconnected_CB, error_CB, name, host, port): 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.stype = '_presence._tcp'
self.port = port # listening port that gets announced self.port = port # listening port that gets announced
self.username = name self.username = name
self.host = host self.host = host
self.txt = pybonjour.TXTRecord() # service data self.txt = pybonjour.TXTRecord() # service data
@ -48,7 +48,7 @@ class Zeroconf:
self.disconnected_CB = disconnected_CB self.disconnected_CB = disconnected_CB
self.error_CB = error_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.connected = False
self.announced = False self.announced = False
self.invalid_self_contact = {} self.invalid_self_contact = {}
@ -58,7 +58,7 @@ class Zeroconf:
def browse_callback(self, sdRef, flags, interfaceIndex, errorCode, serviceName, regtype, replyDomain): 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)) gajim.log.debug('Found service %s in domain %s on %i(type: %s).' % (serviceName, replyDomain, interfaceIndex, regtype))
if not self.connected: if not self.connected:
return return
if errorCode != pybonjour.kDNSServiceErr_NoError: if errorCode != pybonjour.kDNSServiceErr_NoError:
return return
if not (flags & pybonjour.kDNSServiceFlagsAdd): if not (flags & pybonjour.kDNSServiceFlagsAdd):
@ -83,7 +83,7 @@ class Zeroconf:
def remove_service_callback(self, name): def remove_service_callback(self, name):
gajim.log.debug('Service %s disappeared.' % name) gajim.log.debug('Service %s disappeared.' % name)
if not self.connected: if not self.connected:
return return
if name != self.name: if name != self.name:
for key in self.contacts.keys(): for key in self.contacts.keys():
if self.contacts[key][C_BARE_NAME] == name: if self.contacts[key][C_BARE_NAME] == name:
@ -103,7 +103,7 @@ class Zeroconf:
def service_resolved_callback(self, sdRef, flags, interfaceIndex, errorCode, fullname, def service_resolved_callback(self, sdRef, flags, interfaceIndex, errorCode, fullname,
hosttarget, port, txtRecord): hosttarget, port, txtRecord):
# TODO: do proper decoding... # TODO: do proper decoding...
escaping= { escaping= {
r'\.': '.', r'\.': '.',
r'\032': ' ', r'\032': ' ',
@ -211,7 +211,7 @@ class Zeroconf:
txt['version'] = 1 txt['version'] = 1
txt['txtvers'] = 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: if 'status' in self.txt:
txt['status'] = self.replace_show(self.txt['status']) txt['status'] = self.replace_show(self.txt['status'])
else: else:
@ -221,7 +221,7 @@ class Zeroconf:
try: try:
sdRef = pybonjour.DNSServiceRegister(name = self.name, 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) callBack = self.service_added_callback)
self.service_sdRef = sdRef self.service_sdRef = sdRef
except pybonjour.BonjourError, e: except pybonjour.BonjourError, e:

View File

@ -126,8 +126,8 @@ def tree_cell_data_func(column, renderer, model, iter_, tv=None):
class PrivateChatControl(ChatControl): class PrivateChatControl(ChatControl):
TYPE_ID = message_control.TYPE_PM TYPE_ID = message_control.TYPE_PM
# Set a command host to bound to. Every command given through a private chat # Set a command host to bound to. Every command given through a private chat
# will be processed with this command host. # will be processed with this command host.
COMMAND_HOST = PrivateChatCommands COMMAND_HOST = PrivateChatCommands
def __init__(self, parent_win, gc_contact, contact, account, session): def __init__(self, parent_win, gc_contact, contact, account, session):
@ -193,8 +193,8 @@ class PrivateChatControl(ChatControl):
class GroupchatControl(ChatControlBase): class GroupchatControl(ChatControlBase):
TYPE_ID = message_control.TYPE_GC TYPE_ID = message_control.TYPE_GC
# Set a command host to bound to. Every command given through a group chat # Set a command host to bound to. Every command given through a group chat
# will be processed with this command host. # will be processed with this command host.
COMMAND_HOST = GroupChatCommands COMMAND_HOST = GroupChatCommands
def __init__(self, parent_win, contact, acct, is_continued=False): def __init__(self, parent_win, contact, acct, is_continued=False):

View File

@ -57,23 +57,23 @@ import getopt
from common import i18n from common import i18n
def parseOpts(): def parseOpts():
config_path = None config_path = None
try: try:
shortargs = 'hc:' shortargs = 'hc:'
longargs = 'help config_path=' longargs = 'help config_path='
opts = getopt.getopt(sys.argv[1:], shortargs, longargs.split())[0] opts = getopt.getopt(sys.argv[1:], shortargs, longargs.split())[0]
except getopt.error, msg: except getopt.error, msg:
print str(msg) print str(msg)
print 'for help use --help' print 'for help use --help'
sys.exit(2) sys.exit(2)
for o, a in opts: for o, a in opts:
if o in ('-h', '--help'): if o in ('-h', '--help'):
print 'history_manager [--help] [--config-path]' print 'history_manager [--help] [--config-path]'
sys.exit() sys.exit()
elif o in ('-c', '--config-path'): elif o in ('-c', '--config-path'):
config_path = a config_path = a
return config_path return config_path
config_path = parseOpts() config_path = parseOpts()
del parseOpts del parseOpts

View File

@ -1778,7 +1778,7 @@ class RosterWindow:
""" """
Remove contacts on last events removed 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 pending events
""" """
contact_list = ((event.jid.split('/')[0], event.account) for event in \ contact_list = ((event.jid.split('/')[0], event.account) for event in \
@ -5748,7 +5748,7 @@ class RosterWindow:
self.popups_notification_height = 0 self.popups_notification_height = 0
self.popup_notification_windows = [] self.popup_notification_windows = []
# Remove contact from roster when last event opened # Remove contact from roster when last event opened
# { (contact, account): { backend: boolean } # { (contact, account): { backend: boolean }
self.contacts_to_be_removed = {} self.contacts_to_be_removed = {}
gajim.events.event_removed_subscribe(self.on_event_removed) gajim.events.event_removed_subscribe(self.on_event_removed)