[thorstenp] rename some var to not hide builts-in functions (list -> list_, ...)
This commit is contained in:
parent
7ca3dabbb9
commit
158538b81c
|
@ -102,24 +102,24 @@ class AdvancedConfigurationWindow(object):
|
||||||
self.restart_label.hide()
|
self.restart_label.hide()
|
||||||
gajim.interface.instances['advanced_config'] = self
|
gajim.interface.instances['advanced_config'] = self
|
||||||
|
|
||||||
def cb_value_column_data(self, col, cell, model, iter):
|
def cb_value_column_data(self, col, cell, model, iter_):
|
||||||
'''check if it's boolen or holds password stuff and if yes
|
'''check if it's boolen or holds password stuff and if yes
|
||||||
make the cellrenderertext not editable else it's editable'''
|
make the cellrenderertext not editable else it's editable'''
|
||||||
optname = model[iter][C_PREFNAME]
|
optname = model[iter_][C_PREFNAME]
|
||||||
opttype = model[iter][C_TYPE]
|
opttype = model[iter_][C_TYPE]
|
||||||
if opttype == self.types['boolean'] or optname == 'password':
|
if opttype == self.types['boolean'] or optname == 'password':
|
||||||
cell.set_property('editable', False)
|
cell.set_property('editable', False)
|
||||||
else:
|
else:
|
||||||
cell.set_property('editable', True)
|
cell.set_property('editable', True)
|
||||||
|
|
||||||
def get_option_path(self, model, iter):
|
def get_option_path(self, model, iter_):
|
||||||
# It looks like path made from reversed array
|
# It looks like path made from reversed array
|
||||||
# path[0] is the true one optname
|
# path[0] is the true one optname
|
||||||
# path[1] is the key name
|
# path[1] is the key name
|
||||||
# path[2] is the root of tree
|
# path[2] is the root of tree
|
||||||
# last two is optional
|
# last two is optional
|
||||||
path = [model[iter][0].decode('utf-8')]
|
path = [model[iter_][0].decode('utf-8')]
|
||||||
parent = model.iter_parent(iter)
|
parent = model.iter_parent(iter_)
|
||||||
while parent:
|
while parent:
|
||||||
path.append(model[parent][0].decode('utf-8'))
|
path.append(model[parent][0].decode('utf-8'))
|
||||||
parent = model.iter_parent(parent)
|
parent = model.iter_parent(parent)
|
||||||
|
@ -249,14 +249,14 @@ class AdvancedConfigurationWindow(object):
|
||||||
value = self.right_true_dict[value]
|
value = self.right_true_dict[value]
|
||||||
model.append(iter, [name, value, type])
|
model.append(iter, [name, value, type])
|
||||||
|
|
||||||
def visible_func(self, model, iter):
|
def visible_func(self, model, iter_):
|
||||||
str = self.entry.get_text().decode('utf-8')
|
str = self.entry.get_text().decode('utf-8')
|
||||||
if str in (None, ''):
|
if str in (None, ''):
|
||||||
return True # show all
|
return True # show all
|
||||||
name = model[iter][C_PREFNAME].decode('utf-8')
|
name = model[iter_][C_PREFNAME].decode('utf-8')
|
||||||
# If a child of the iter matches, we return True
|
# If a child of the iter matches, we return True
|
||||||
if model.iter_has_child(iter):
|
if model.iter_has_child(iter_):
|
||||||
iterC = model.iter_children(iter)
|
iterC = model.iter_children(iter_)
|
||||||
while iterC:
|
while iterC:
|
||||||
nameC = model[iterC][C_PREFNAME].decode('utf-8')
|
nameC = model[iterC][C_PREFNAME].decode('utf-8')
|
||||||
if model.iter_has_child(iterC):
|
if model.iter_has_child(iterC):
|
||||||
|
|
|
@ -45,9 +45,9 @@ class CellRendererImage(gtk.GenericCellRenderer):
|
||||||
def do_get_property(self, pspec):
|
def do_get_property(self, pspec):
|
||||||
return getattr(self, pspec.name)
|
return getattr(self, pspec.name)
|
||||||
|
|
||||||
def func(self, model, path, iter, image_tree):
|
def func(self, model, path, iter_, image_tree):
|
||||||
image, tree = image_tree
|
image, tree = image_tree
|
||||||
if model.get_value(iter, self.tv_index) != image:
|
if model.get_value(iter_, self.tv_index) != image:
|
||||||
return
|
return
|
||||||
self.redraw = 1
|
self.redraw = 1
|
||||||
col = tree.get_column(self.col_index)
|
col = tree.get_column(self.col_index)
|
||||||
|
|
|
@ -593,7 +593,7 @@ class ChatControlBase(MessageControl):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def send_message(self, message, keyID = '', type = 'chat', chatstate = None,
|
def send_message(self, message, keyID = '', type_ = 'chat', chatstate = None,
|
||||||
msg_id = None, composing_xep = None, resource = None,
|
msg_id = None, composing_xep = None, resource = None,
|
||||||
process_command = True):
|
process_command = True):
|
||||||
'''Send the given message to the active tab. Doesn't return None if error
|
'''Send the given message to the active tab. Doesn't return None if error
|
||||||
|
@ -604,7 +604,7 @@ class ChatControlBase(MessageControl):
|
||||||
ret = None
|
ret = None
|
||||||
|
|
||||||
if not process_command or not self._process_command(message):
|
if not process_command or not self._process_command(message):
|
||||||
ret = MessageControl.send_message(self, message, keyID, type = type,
|
ret = MessageControl.send_message(self, message, keyID, type_ = type_,
|
||||||
chatstate = chatstate, msg_id = msg_id,
|
chatstate = chatstate, msg_id = msg_id,
|
||||||
composing_xep = composing_xep, resource = resource,
|
composing_xep = composing_xep, resource = resource,
|
||||||
user_nick = self.user_nick)
|
user_nick = self.user_nick)
|
||||||
|
@ -1720,7 +1720,7 @@ class ChatControl(ChatControlBase):
|
||||||
self._schedule_activity_timers()
|
self._schedule_activity_timers()
|
||||||
|
|
||||||
id = ChatControlBase.send_message(self, message, keyID,
|
id = ChatControlBase.send_message(self, message, keyID,
|
||||||
type = 'chat', chatstate = chatstate_to_send,
|
type_ = 'chat', chatstate = chatstate_to_send,
|
||||||
composing_xep = composing_xep,
|
composing_xep = composing_xep,
|
||||||
process_command = process_command)
|
process_command = process_command)
|
||||||
if id:
|
if id:
|
||||||
|
|
|
@ -68,12 +68,12 @@ if gajim.HAVE_GPG:
|
||||||
resp[ keyword ] = ""
|
resp[ keyword ] = ""
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
def encrypt(self, str, recipients):
|
def encrypt(self, str_, recipients):
|
||||||
self.options.recipients = recipients # a list!
|
self.options.recipients = recipients # a list!
|
||||||
|
|
||||||
proc = self.run(['--encrypt'], create_fhs=['stdin', 'stdout', 'status',
|
proc = self.run(['--encrypt'], create_fhs=['stdin', 'stdout', 'status',
|
||||||
'stderr'])
|
'stderr'])
|
||||||
proc.handles['stdin'].write(str)
|
proc.handles['stdin'].write(str_)
|
||||||
try:
|
try:
|
||||||
proc.handles['stdin'].close()
|
proc.handles['stdin'].close()
|
||||||
except IOError:
|
except IOError:
|
||||||
|
@ -103,9 +103,9 @@ if gajim.HAVE_GPG:
|
||||||
error = ''
|
error = ''
|
||||||
return self._stripHeaderFooter(output), error
|
return self._stripHeaderFooter(output), error
|
||||||
|
|
||||||
def decrypt(self, str, keyID):
|
def decrypt(self, str_, keyID):
|
||||||
proc = self.run(['--decrypt', '-q', '-u %s'%keyID], create_fhs=['stdin', 'stdout'])
|
proc = self.run(['--decrypt', '-q', '-u %s'%keyID], create_fhs=['stdin', 'stdout'])
|
||||||
enc = self._addHeaderFooter(str, 'MESSAGE')
|
enc = self._addHeaderFooter(str_, 'MESSAGE')
|
||||||
proc.handles['stdin'].write(enc)
|
proc.handles['stdin'].write(enc)
|
||||||
proc.handles['stdin'].close()
|
proc.handles['stdin'].close()
|
||||||
|
|
||||||
|
@ -116,9 +116,9 @@ if gajim.HAVE_GPG:
|
||||||
except IOError: pass
|
except IOError: pass
|
||||||
return output
|
return output
|
||||||
|
|
||||||
def sign(self, str, keyID):
|
def sign(self, str_, keyID):
|
||||||
proc = self.run(['-b', '-u %s'%keyID], create_fhs=['stdin', 'stdout', 'status', 'stderr'])
|
proc = self.run(['-b', '-u %s'%keyID], create_fhs=['stdin', 'stdout', 'status', 'stderr'])
|
||||||
proc.handles['stdin'].write(str)
|
proc.handles['stdin'].write(str_)
|
||||||
try:
|
try:
|
||||||
proc.handles['stdin'].close()
|
proc.handles['stdin'].close()
|
||||||
except IOError:
|
except IOError:
|
||||||
|
@ -144,12 +144,12 @@ if gajim.HAVE_GPG:
|
||||||
return self._stripHeaderFooter(output)
|
return self._stripHeaderFooter(output)
|
||||||
return 'BAD_PASSPHRASE'
|
return 'BAD_PASSPHRASE'
|
||||||
|
|
||||||
def verify(self, str, sign):
|
def verify(self, str_, sign):
|
||||||
if str is None:
|
if str_ is None:
|
||||||
return ''
|
return ''
|
||||||
f = tmpfile()
|
f = tmpfile()
|
||||||
fd = f.fileno()
|
fd = f.fileno()
|
||||||
f.write(str)
|
f.write(str_)
|
||||||
f.seek(0)
|
f.seek(0)
|
||||||
|
|
||||||
proc = self.run(['--verify', '--enable-special-filenames', '-', '-&%s'%fd], create_fhs=['stdin', 'status', 'stderr'])
|
proc = self.run(['--verify', '--enable-special-filenames', '-', '-&%s'%fd], create_fhs=['stdin', 'status', 'stderr'])
|
||||||
|
@ -215,13 +215,13 @@ if gajim.HAVE_GPG:
|
||||||
line = '\n'.join(lines[0:i])
|
line = '\n'.join(lines[0:i])
|
||||||
return line
|
return line
|
||||||
|
|
||||||
def _addHeaderFooter(self, data, type):
|
def _addHeaderFooter(self, data, type_):
|
||||||
"""Add header and footer from data"""
|
"""Add header and footer from data"""
|
||||||
out = "-----BEGIN PGP %s-----\n" % type
|
out = "-----BEGIN PGP %s-----\n" % type_
|
||||||
out = out + "Version: PGP\n"
|
out = out + "Version: PGP\n"
|
||||||
out = out + "\n"
|
out = out + "\n"
|
||||||
out = out + data + "\n"
|
out = out + data + "\n"
|
||||||
out = out + "-----END PGP %s-----\n" % type
|
out = out + "-----END PGP %s-----\n" % type_
|
||||||
return out
|
return out
|
||||||
|
|
||||||
# vim: se ts=3:
|
# vim: se ts=3:
|
||||||
|
|
|
@ -89,10 +89,10 @@ class CapsCache(object):
|
||||||
# TODO: maybe put all known xmpp namespace strings here
|
# TODO: maybe put all known xmpp namespace strings here
|
||||||
# (strings given in xmpppy)?
|
# (strings given in xmpppy)?
|
||||||
__names = {}
|
__names = {}
|
||||||
def __init__(ciself, hash_method, hash):
|
def __init__(ciself, hash_method, hash_):
|
||||||
# cached into db
|
# cached into db
|
||||||
ciself.hash_method = hash_method
|
ciself.hash_method = hash_method
|
||||||
ciself.hash = hash
|
ciself.hash = hash_
|
||||||
ciself._features = []
|
ciself._features = []
|
||||||
ciself._identities = []
|
ciself._identities = []
|
||||||
|
|
||||||
|
@ -174,14 +174,14 @@ class CapsCache(object):
|
||||||
self.__cache[(hash_method, hash)] = x
|
self.__cache[(hash_method, hash)] = x
|
||||||
return x
|
return x
|
||||||
|
|
||||||
def preload(self, con, jid, node, hash_method, hash):
|
def preload(self, con, jid, node, hash_method, hash_):
|
||||||
''' Preload data about (node, ver, exts) caps using disco
|
''' Preload data about (node, ver, exts) caps using disco
|
||||||
query to jid using proper connection. Don't query if
|
query to jid using proper connection. Don't query if
|
||||||
the data is already in cache. '''
|
the data is already in cache. '''
|
||||||
if hash_method == 'old':
|
if hash_method == 'old':
|
||||||
q = self[(hash_method, node + '#' + hash)]
|
q = self[(hash_method, node + '#' + hash_)]
|
||||||
else:
|
else:
|
||||||
q = self[(hash_method, hash)]
|
q = self[(hash_method, hash_)]
|
||||||
|
|
||||||
if q.queried==0:
|
if q.queried==0:
|
||||||
# do query for bare node+hash pair
|
# do query for bare node+hash pair
|
||||||
|
@ -190,7 +190,7 @@ class CapsCache(object):
|
||||||
if hash_method == 'old':
|
if hash_method == 'old':
|
||||||
con.discoverInfo(jid)
|
con.discoverInfo(jid)
|
||||||
else:
|
else:
|
||||||
con.discoverInfo(jid, '%s#%s' % (node, hash))
|
con.discoverInfo(jid, '%s#%s' % (node, hash_))
|
||||||
|
|
||||||
def is_supported(self, contact, feature):
|
def is_supported(self, contact, feature):
|
||||||
if not contact:
|
if not contact:
|
||||||
|
|
|
@ -271,7 +271,7 @@ class ForwardMessagesCommand(AdHocCommand):
|
||||||
for jid in events:
|
for jid in events:
|
||||||
for event in events[jid]:
|
for event in events[jid]:
|
||||||
self.connection.send_message(j, event.parameters[0], '',
|
self.connection.send_message(j, event.parameters[0], '',
|
||||||
type=event.type_, subject=event.parameters[1],
|
type_=event.type_, subject=event.parameters[1],
|
||||||
resource=resource, forward_from=jid, delayed=event.time_)
|
resource=resource, forward_from=jid, delayed=event.time_)
|
||||||
|
|
||||||
# Inform other client of completion
|
# Inform other client of completion
|
||||||
|
|
|
@ -502,17 +502,17 @@ class Config:
|
||||||
def is_valid_string(self, val):
|
def is_valid_string(self, val):
|
||||||
return val
|
return val
|
||||||
|
|
||||||
def is_valid(self, type, val):
|
def is_valid(self, type_, val):
|
||||||
if not type:
|
if not type_:
|
||||||
return None
|
return None
|
||||||
if type[0] == 'boolean':
|
if type_[0] == 'boolean':
|
||||||
return self.is_valid_bool(val)
|
return self.is_valid_bool(val)
|
||||||
elif type[0] == 'integer':
|
elif type_[0] == 'integer':
|
||||||
return self.is_valid_int(val)
|
return self.is_valid_int(val)
|
||||||
elif type[0] == 'string':
|
elif type_[0] == 'string':
|
||||||
return self.is_valid_string(val)
|
return self.is_valid_string(val)
|
||||||
else:
|
else:
|
||||||
if re.match(type[1], val):
|
if re.match(type_[1], val):
|
||||||
return val
|
return val
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -1071,7 +1071,7 @@ class Connection(ConnectionHandlers):
|
||||||
|
|
||||||
self.connection.send(msg_iq)
|
self.connection.send(msg_iq)
|
||||||
|
|
||||||
def send_message(self, jid, msg, keyID, type='chat', subject='',
|
def send_message(self, jid, msg, keyID, type_='chat', subject='',
|
||||||
chatstate=None, msg_id=None, composing_xep=None, resource=None,
|
chatstate=None, msg_id=None, composing_xep=None, resource=None,
|
||||||
user_nick=None, xhtml=None, session=None, forward_from=None, form_node=None,
|
user_nick=None, xhtml=None, session=None, forward_from=None, form_node=None,
|
||||||
original_message=None, delayed=None):
|
original_message=None, delayed=None):
|
||||||
|
@ -1114,8 +1114,8 @@ class Connection(ConnectionHandlers):
|
||||||
'rst_formatting_outgoing_messages'):
|
'rst_formatting_outgoing_messages'):
|
||||||
# Generate a XHTML part using reStructured text markup
|
# Generate a XHTML part using reStructured text markup
|
||||||
xhtml = create_xhtml(msgtxt)
|
xhtml = create_xhtml(msgtxt)
|
||||||
if type == 'chat':
|
if type_ == 'chat':
|
||||||
msg_iq = common.xmpp.Message(to = fjid, body = msgtxt, typ = type,
|
msg_iq = common.xmpp.Message(to = fjid, body = msgtxt, typ = type_,
|
||||||
xhtml = xhtml)
|
xhtml = xhtml)
|
||||||
else:
|
else:
|
||||||
if subject:
|
if subject:
|
||||||
|
@ -1210,7 +1210,7 @@ class Connection(ConnectionHandlers):
|
||||||
log_msg = _('Subject: %(subject)s\n%(message)s') % \
|
log_msg = _('Subject: %(subject)s\n%(message)s') % \
|
||||||
{'subject': subject, 'message': msg}
|
{'subject': subject, 'message': msg}
|
||||||
if log_msg:
|
if log_msg:
|
||||||
if type == 'chat':
|
if type_ == 'chat':
|
||||||
kind = 'chat_msg_sent'
|
kind = 'chat_msg_sent'
|
||||||
else:
|
else:
|
||||||
kind = 'single_msg_sent'
|
kind = 'single_msg_sent'
|
||||||
|
|
|
@ -1280,7 +1280,7 @@ class ConnectionHandlersBase:
|
||||||
return session
|
return session
|
||||||
|
|
||||||
if pm:
|
if pm:
|
||||||
return self.make_new_session(fjid, thread_id, type='pm')
|
return self.make_new_session(fjid, thread_id, type_='pm')
|
||||||
else:
|
else:
|
||||||
return self.make_new_session(fjid, thread_id)
|
return self.make_new_session(fjid, thread_id)
|
||||||
|
|
||||||
|
@ -1349,15 +1349,15 @@ sent a message to.'''
|
||||||
except (KeyError, IndexError):
|
except (KeyError, IndexError):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def make_new_session(self, jid, thread_id=None, type='chat', cls=None):
|
def make_new_session(self, jid, thread_id=None, type_='chat', cls=None):
|
||||||
if not cls:
|
if not cls:
|
||||||
cls = gajim.default_session_type
|
cls = gajim.default_session_type
|
||||||
|
|
||||||
sess = cls(self, common.xmpp.JID(jid), thread_id, type)
|
sess = cls(self, common.xmpp.JID(jid), thread_id, type_)
|
||||||
|
|
||||||
# determine if this session is a pm session
|
# determine if this session is a pm session
|
||||||
# if not, discard the resource so that all sessions are stored bare
|
# if not, discard the resource so that all sessions are stored bare
|
||||||
if not type == 'pm':
|
if not type_ == 'pm':
|
||||||
jid = gajim.get_jid_without_resource(jid)
|
jid = gajim.get_jid_without_resource(jid)
|
||||||
|
|
||||||
if not jid in self.sessions:
|
if not jid in self.sessions:
|
||||||
|
|
|
@ -75,8 +75,8 @@ def base28(n):
|
||||||
else:
|
else:
|
||||||
return base28_chr[n]
|
return base28_chr[n]
|
||||||
|
|
||||||
def random_bytes(bytes):
|
def random_bytes(bytes_):
|
||||||
return os.urandom(bytes)
|
return os.urandom(bytes_)
|
||||||
|
|
||||||
def generate_nonce():
|
def generate_nonce():
|
||||||
return random_bytes(8)
|
return random_bytes(8)
|
||||||
|
|
|
@ -351,12 +351,12 @@ class DataRecord(ExtendedNode):
|
||||||
return self.vars[item]
|
return self.vars[item]
|
||||||
|
|
||||||
class DataForm(ExtendedNode):
|
class DataForm(ExtendedNode):
|
||||||
def __init__(self, type=None, title=None, instructions=None, extend=None):
|
def __init__(self, type_=None, title=None, instructions=None, extend=None):
|
||||||
if extend is None:
|
if extend is None:
|
||||||
# we have to build form from scratch
|
# we have to build form from scratch
|
||||||
xmpp.Node.__init__(self, 'x', attrs={'xmlns': xmpp.NS_DATA})
|
xmpp.Node.__init__(self, 'x', attrs={'xmlns': xmpp.NS_DATA})
|
||||||
|
|
||||||
if type is not None: self.type=type
|
if type_ is not None: self.type_=type_
|
||||||
if title is not None: self.title=title
|
if title is not None: self.title=title
|
||||||
if instructions is not None: self.instructions=instructions
|
if instructions is not None: self.instructions=instructions
|
||||||
|
|
||||||
|
@ -367,9 +367,9 @@ class DataForm(ExtendedNode):
|
||||||
filledform = DataForm(replyto=thisform)...'''
|
filledform = DataForm(replyto=thisform)...'''
|
||||||
def fget(self):
|
def fget(self):
|
||||||
return self.getAttr('type')
|
return self.getAttr('type')
|
||||||
def fset(self, type):
|
def fset(self, type_):
|
||||||
assert type in ('form', 'submit', 'cancel', 'result')
|
assert type_ in ('form', 'submit', 'cancel', 'result')
|
||||||
self.setAttr('type', type)
|
self.setAttr('type', type_)
|
||||||
return locals()
|
return locals()
|
||||||
|
|
||||||
@nested_property
|
@nested_property
|
||||||
|
@ -406,8 +406,8 @@ class DataForm(ExtendedNode):
|
||||||
return locals()
|
return locals()
|
||||||
|
|
||||||
class SimpleDataForm(DataForm, DataRecord):
|
class SimpleDataForm(DataForm, DataRecord):
|
||||||
def __init__(self, type=None, title=None, instructions=None, fields=None, extend=None):
|
def __init__(self, type_=None, title=None, instructions=None, fields=None, extend=None):
|
||||||
DataForm.__init__(self, type=type, title=title, instructions=instructions, extend=extend)
|
DataForm.__init__(self, type_=type_, title=title, instructions=instructions, extend=extend)
|
||||||
DataRecord.__init__(self, fields=fields, extend=self, associated=self)
|
DataRecord.__init__(self, fields=fields, extend=self, associated=self)
|
||||||
|
|
||||||
def get_purged(self):
|
def get_purged(self):
|
||||||
|
@ -430,8 +430,8 @@ class SimpleDataForm(DataForm, DataRecord):
|
||||||
return c
|
return c
|
||||||
|
|
||||||
class MultipleDataForm(DataForm):
|
class MultipleDataForm(DataForm):
|
||||||
def __init__(self, type=None, title=None, instructions=None, items=None, extend=None):
|
def __init__(self, type_=None, title=None, instructions=None, items=None, extend=None):
|
||||||
DataForm.__init__(self, type=type, title=title, instructions=instructions, extend=extend)
|
DataForm.__init__(self, type_=type_, title=title, instructions=instructions, extend=extend)
|
||||||
# all records, recorded into DataRecords
|
# all records, recorded into DataRecords
|
||||||
if extend is None:
|
if extend is None:
|
||||||
|
|
||||||
|
|
|
@ -852,7 +852,7 @@ def sanitize_filename(filename):
|
||||||
|
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
def allow_showing_notification(account, type = 'notify_on_new_message',
|
def allow_showing_notification(account, type_ = 'notify_on_new_message',
|
||||||
advanced_notif_num = None, is_first_message = True):
|
advanced_notif_num = None, is_first_message = True):
|
||||||
'''is it allowed to show nofication?
|
'''is it allowed to show nofication?
|
||||||
check OUR status and if we allow notifications for that status
|
check OUR status and if we allow notifications for that status
|
||||||
|
@ -865,7 +865,7 @@ advanced_notif_num = None, is_first_message = True):
|
||||||
return True
|
return True
|
||||||
if popup == 'no':
|
if popup == 'no':
|
||||||
return False
|
return False
|
||||||
if type and (not gajim.config.get(type) or not is_first_message):
|
if type_ and (not gajim.config.get(type_) or not is_first_message):
|
||||||
return False
|
return False
|
||||||
if gajim.config.get('autopopupaway'): # always show notification
|
if gajim.config.get('autopopupaway'): # always show notification
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -749,7 +749,7 @@ class Logger:
|
||||||
sql = 'DELETE FROM caps_cache WHERE hash_method = "%s" AND hash = "%s"' % (hash_method, hash)
|
sql = 'DELETE FROM caps_cache WHERE hash_method = "%s" AND hash = "%s"' % (hash_method, hash)
|
||||||
self.simple_commit(sql)
|
self.simple_commit(sql)
|
||||||
|
|
||||||
def add_caps_entry(self, hash_method, hash, identities, features):
|
def add_caps_entry(self, hash_method, hash_, identities, features):
|
||||||
data=[]
|
data=[]
|
||||||
for identity in identities:
|
for identity in identities:
|
||||||
# there is no FEAT category
|
# there is no FEAT category
|
||||||
|
@ -770,7 +770,7 @@ class Logger:
|
||||||
self.cur.execute('''
|
self.cur.execute('''
|
||||||
INSERT INTO caps_cache ( hash_method, hash, data )
|
INSERT INTO caps_cache ( hash_method, hash, data )
|
||||||
VALUES (?, ?, ?);
|
VALUES (?, ?, ?);
|
||||||
''', (hash_method, hash, buffer(data))) # (1) -- note above
|
''', (hash_method, hash_, buffer(data))) # (1) -- note above
|
||||||
try:
|
try:
|
||||||
self.con.commit()
|
self.con.commit()
|
||||||
except sqlite.OperationalError, e:
|
except sqlite.OperationalError, e:
|
||||||
|
|
|
@ -280,11 +280,11 @@ class IdleCommand(IdleObject):
|
||||||
self._return_result()
|
self._return_result()
|
||||||
|
|
||||||
class NsLookup(IdleCommand):
|
class NsLookup(IdleCommand):
|
||||||
def __init__(self, on_result, host='_xmpp-client', type = 'srv'):
|
def __init__(self, on_result, host='_xmpp-client', type_ = 'srv'):
|
||||||
IdleCommand.__init__(self, on_result)
|
IdleCommand.__init__(self, on_result)
|
||||||
self.commandtimeout = 10
|
self.commandtimeout = 10
|
||||||
self.host = host.lower()
|
self.host = host.lower()
|
||||||
self.type = type.lower()
|
self.type = type_.lower()
|
||||||
if not host_pattern.match(self.host):
|
if not host_pattern.match(self.host):
|
||||||
# invalid host name
|
# invalid host name
|
||||||
print >> sys.stderr, 'Invalid host: %s' % self.host
|
print >> sys.stderr, 'Invalid host: %s' % self.host
|
||||||
|
|
|
@ -58,21 +58,21 @@ class ConnectionPubSub:
|
||||||
|
|
||||||
self.__callbacks[id]=(cb, args, kwargs)
|
self.__callbacks[id]=(cb, args, kwargs)
|
||||||
|
|
||||||
def send_pb_publish(self, jid, node, item, id):
|
def send_pb_publish(self, jid, node, item, id_):
|
||||||
'''Publish item to a node.'''
|
'''Publish item to a node.'''
|
||||||
query = xmpp.Iq('set', to=jid)
|
query = xmpp.Iq('set', to=jid)
|
||||||
e = query.addChild('pubsub', namespace=xmpp.NS_PUBSUB)
|
e = query.addChild('pubsub', namespace=xmpp.NS_PUBSUB)
|
||||||
e = e.addChild('publish', {'node': node})
|
e = e.addChild('publish', {'node': node})
|
||||||
e = e.addChild('item', {'id': id}, [item]) # TODO: we should generate id... or we shouldn't?
|
e = e.addChild('item', {'id': id_}, [item]) # TODO: we should generate id... or we shouldn't?
|
||||||
|
|
||||||
self.connection.send(query)
|
self.connection.send(query)
|
||||||
|
|
||||||
def send_pb_retract(self, jid, node, id):
|
def send_pb_retract(self, jid, node, id_):
|
||||||
'''Delete item from a node'''
|
'''Delete item from a node'''
|
||||||
query = xmpp.Iq('set', to=jid)
|
query = xmpp.Iq('set', to=jid)
|
||||||
r = query.addChild('pubsub', namespace=xmpp.NS_PUBSUB)
|
r = query.addChild('pubsub', namespace=xmpp.NS_PUBSUB)
|
||||||
r = r.addChild('retract', {'node': node, 'notify': '1'})
|
r = r.addChild('retract', {'node': node, 'notify': '1'})
|
||||||
r = r.addChild('item', {'id': id})
|
r = r.addChild('item', {'id': id_})
|
||||||
|
|
||||||
self.connection.send(query)
|
self.connection.send(query)
|
||||||
|
|
||||||
|
|
|
@ -41,19 +41,19 @@ import os
|
||||||
XmlDsig = 'http://www.w3.org/2000/09/xmldsig#'
|
XmlDsig = 'http://www.w3.org/2000/09/xmldsig#'
|
||||||
|
|
||||||
class StanzaSession(object):
|
class StanzaSession(object):
|
||||||
def __init__(self, conn, jid, thread_id, type):
|
def __init__(self, conn, jid, thread_id, type_):
|
||||||
self.conn = conn
|
self.conn = conn
|
||||||
|
|
||||||
self.jid = jid
|
self.jid = jid
|
||||||
|
|
||||||
self.type = type
|
self.type = type_
|
||||||
|
|
||||||
if thread_id:
|
if thread_id:
|
||||||
self.received_thread_id = True
|
self.received_thread_id = True
|
||||||
self.thread_id = thread_id
|
self.thread_id = thread_id
|
||||||
else:
|
else:
|
||||||
self.received_thread_id = False
|
self.received_thread_id = False
|
||||||
if type == 'normal':
|
if type_ == 'normal':
|
||||||
self.thread_id = None
|
self.thread_id = None
|
||||||
else:
|
else:
|
||||||
self.thread_id = self.generate_thread_id()
|
self.thread_id = self.generate_thread_id()
|
||||||
|
@ -189,8 +189,8 @@ if gajim.HAVE_PYCRYPTO:
|
||||||
# handle_session_negotiation method.
|
# handle_session_negotiation method.
|
||||||
|
|
||||||
class EncryptedStanzaSession(StanzaSession):
|
class EncryptedStanzaSession(StanzaSession):
|
||||||
def __init__(self, conn, jid, thread_id, type='chat'):
|
def __init__(self, conn, jid, thread_id, type_='chat'):
|
||||||
StanzaSession.__init__(self, conn, jid, thread_id, type='chat')
|
StanzaSession.__init__(self, conn, jid, thread_id, type_='chat')
|
||||||
|
|
||||||
self.xes = {}
|
self.xes = {}
|
||||||
self.es = {}
|
self.es = {}
|
||||||
|
|
|
@ -96,7 +96,7 @@ class Browser(PlugIn):
|
||||||
self._owner.UnregisterHandler('iq',self._DiscoveryHandler,typ='get',ns=NS_DISCO_INFO)
|
self._owner.UnregisterHandler('iq',self._DiscoveryHandler,typ='get',ns=NS_DISCO_INFO)
|
||||||
self._owner.UnregisterHandler('iq',self._DiscoveryHandler,typ='get',ns=NS_DISCO_ITEMS)
|
self._owner.UnregisterHandler('iq',self._DiscoveryHandler,typ='get',ns=NS_DISCO_ITEMS)
|
||||||
|
|
||||||
def _traversePath(self,node,jid,set=0):
|
def _traversePath(self,node,jid,set_=0):
|
||||||
""" Returns dictionary and key or None,None
|
""" Returns dictionary and key or None,None
|
||||||
None - root node (w/o "node" attribute)
|
None - root node (w/o "node" attribute)
|
||||||
/a/b/c - node
|
/a/b/c - node
|
||||||
|
@ -105,7 +105,7 @@ class Browser(PlugIn):
|
||||||
get returns '' or None as the key or None as the dict.
|
get returns '' or None as the key or None as the dict.
|
||||||
Used internally."""
|
Used internally."""
|
||||||
if jid in self._handlers: cur=self._handlers[jid]
|
if jid in self._handlers: cur=self._handlers[jid]
|
||||||
elif set:
|
elif set_:
|
||||||
self._handlers[jid]={}
|
self._handlers[jid]={}
|
||||||
cur=self._handlers[jid]
|
cur=self._handlers[jid]
|
||||||
else: cur=self._handlers['']
|
else: cur=self._handlers['']
|
||||||
|
@ -113,10 +113,10 @@ class Browser(PlugIn):
|
||||||
else: node=node.replace('/',' /').split('/')
|
else: node=node.replace('/',' /').split('/')
|
||||||
for i in node:
|
for i in node:
|
||||||
if i!='' and i in cur: cur=cur[i]
|
if i!='' and i in cur: cur=cur[i]
|
||||||
elif set and i!='': cur[i]={dict:cur,str:i}; cur=cur[i]
|
elif set_ and i!='': cur[i]={dict:cur,str:i}; cur=cur[i]
|
||||||
elif set or '' in cur: return cur,''
|
elif set_ or '' in cur: return cur,''
|
||||||
else: return None,None
|
else: return None,None
|
||||||
if 1 in cur or set: return cur,1
|
if 1 in cur or set_: return cur,1
|
||||||
raise "Corrupted data"
|
raise "Corrupted data"
|
||||||
|
|
||||||
def setDiscoHandler(self,handler,node='',jid=''):
|
def setDiscoHandler(self,handler,node='',jid=''):
|
||||||
|
|
|
@ -251,13 +251,13 @@ class Command_Handler_Prototype(PlugIn):
|
||||||
# New session
|
# New session
|
||||||
self.initial[action](conn,request)
|
self.initial[action](conn,request)
|
||||||
|
|
||||||
def _DiscoHandler(self,conn,request,type):
|
def _DiscoHandler(self,conn,request,type_):
|
||||||
"""The handler for discovery events"""
|
"""The handler for discovery events"""
|
||||||
if type == 'list':
|
if type_ == 'list':
|
||||||
return (request.getTo(),self.name,self.description)
|
return (request.getTo(),self.name,self.description)
|
||||||
elif type == 'items':
|
elif type_ == 'items':
|
||||||
return []
|
return []
|
||||||
elif type == 'info':
|
elif type_ == 'info':
|
||||||
return self.discoinfo
|
return self.discoinfo
|
||||||
|
|
||||||
class TestCommand(Command_Handler_Prototype):
|
class TestCommand(Command_Handler_Prototype):
|
||||||
|
|
|
@ -171,11 +171,11 @@ def setDefaultPrivacyList(disp,listname=None):
|
||||||
""" Sets the default privacy list as 'listname'. Returns true on success."""
|
""" Sets the default privacy list as 'listname'. Returns true on success."""
|
||||||
return setActivePrivacyList(disp,listname,'default')
|
return setActivePrivacyList(disp,listname,'default')
|
||||||
|
|
||||||
def setPrivacyList(disp,list):
|
def setPrivacyList(disp,list_):
|
||||||
""" Set the ruleset. 'list' should be the simpleXML node formatted
|
""" Set the ruleset. 'list' should be the simpleXML node formatted
|
||||||
according to RFC 3921 (XMPP-IM) (I.e. Node('list',{'name':listname},payload=[...]) )
|
according to RFC 3921 (XMPP-IM) (I.e. Node('list',{'name':listname},payload=[...]) )
|
||||||
Returns true on success."""
|
Returns true on success."""
|
||||||
resp=disp.SendAndWaitForResponse(Iq('set',NS_PRIVACY,payload=[list]))
|
resp=disp.SendAndWaitForResponse(Iq('set',NS_PRIVACY,payload=[list_]))
|
||||||
if isResultNode(resp): return 1
|
if isResultNode(resp): return 1
|
||||||
|
|
||||||
def delPrivacyList(disp,listname):
|
def delPrivacyList(disp,listname):
|
||||||
|
|
|
@ -360,7 +360,7 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
|
||||||
def get_status(self):
|
def get_status(self):
|
||||||
return STATUS_LIST[self.connected]
|
return STATUS_LIST[self.connected]
|
||||||
|
|
||||||
def send_message(self, jid, msg, keyID, type = 'chat', subject='',
|
def send_message(self, jid, msg, keyID, type_ = 'chat', subject='',
|
||||||
chatstate = None, msg_id = None, composing_xep = None, resource = None,
|
chatstate = None, msg_id = None, composing_xep = None, resource = None,
|
||||||
user_nick = None, session=None, forward_from=None, form_node=None, original_message=None):
|
user_nick = None, session=None, forward_from=None, form_node=None, original_message=None):
|
||||||
fjid = jid
|
fjid = jid
|
||||||
|
@ -396,8 +396,8 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
|
||||||
self.dispatch('MSGNOTSENT', (jid, error, msgtxt, tim, session))
|
self.dispatch('MSGNOTSENT', (jid, error, msgtxt, tim, session))
|
||||||
return 3
|
return 3
|
||||||
|
|
||||||
if type == 'chat':
|
if type_ == 'chat':
|
||||||
msg_iq = common.xmpp.Message(to = fjid, body = msgtxt, typ = type)
|
msg_iq = common.xmpp.Message(to = fjid, body = msgtxt, typ = type_)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if subject:
|
if subject:
|
||||||
|
@ -445,7 +445,7 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf):
|
||||||
log_msg = _('Subject: %(subject)s\n%(message)s') % \
|
log_msg = _('Subject: %(subject)s\n%(message)s') % \
|
||||||
{'subject': subject, 'message': msg}
|
{'subject': subject, 'message': msg}
|
||||||
if log_msg:
|
if log_msg:
|
||||||
if type == 'chat':
|
if type_ == 'chat':
|
||||||
kind = 'chat_msg_sent'
|
kind = 'chat_msg_sent'
|
||||||
else:
|
else:
|
||||||
kind = 'single_msg_sent'
|
kind = 'single_msg_sent'
|
||||||
|
|
|
@ -759,12 +759,12 @@ class PreferencesWindow:
|
||||||
[self.xml.get_widget('sounds_scrolledwindow'),
|
[self.xml.get_widget('sounds_scrolledwindow'),
|
||||||
self.xml.get_widget('browse_sounds_hbox')])
|
self.xml.get_widget('browse_sounds_hbox')])
|
||||||
|
|
||||||
def on_sounds_treemodel_row_changed(self, model, path, iter):
|
def on_sounds_treemodel_row_changed(self, model, path, iter_):
|
||||||
sound_event = model[iter][3].decode('utf-8')
|
sound_event = model[iter_][3].decode('utf-8')
|
||||||
gajim.config.set_per('soundevents', sound_event, 'enabled',
|
gajim.config.set_per('soundevents', sound_event, 'enabled',
|
||||||
bool(model[path][0]))
|
bool(model[path][0]))
|
||||||
gajim.config.set_per('soundevents', sound_event, 'path',
|
gajim.config.set_per('soundevents', sound_event, 'path',
|
||||||
model[iter][2].decode('utf-8'))
|
model[iter_][2].decode('utf-8'))
|
||||||
gajim.interface.save_config()
|
gajim.interface.save_config()
|
||||||
|
|
||||||
def update_text_tags(self):
|
def update_text_tags(self):
|
||||||
|
@ -891,11 +891,11 @@ class PreferencesWindow:
|
||||||
model = self.default_msg_tree.get_model()
|
model = self.default_msg_tree.get_model()
|
||||||
model[path][3] = not model[path][3]
|
model[path][3] = not model[path][3]
|
||||||
|
|
||||||
def on_default_msg_treemodel_row_changed(self, model, path, iter):
|
def on_default_msg_treemodel_row_changed(self, model, path, iter_):
|
||||||
status = model[iter][0]
|
status = model[iter_][0]
|
||||||
message = model[iter][2].decode('utf-8')
|
message = model[iter_][2].decode('utf-8')
|
||||||
gajim.config.set_per('defaultstatusmsg', status, 'enabled',
|
gajim.config.set_per('defaultstatusmsg', status, 'enabled',
|
||||||
model[iter][3])
|
model[iter_][3])
|
||||||
gajim.config.set_per('defaultstatusmsg', status, 'message', message)
|
gajim.config.set_per('defaultstatusmsg', status, 'message', message)
|
||||||
|
|
||||||
def on_default_status_expander_activate(self, expander):
|
def on_default_status_expander_activate(self, expander):
|
||||||
|
@ -919,7 +919,7 @@ class PreferencesWindow:
|
||||||
iter = model.iter_next(iter)
|
iter = model.iter_next(iter)
|
||||||
gajim.interface.save_config()
|
gajim.interface.save_config()
|
||||||
|
|
||||||
def on_msg_treemodel_row_changed(self, model, path, iter):
|
def on_msg_treemodel_row_changed(self, model, path, iter_):
|
||||||
self.save_status_messages(model)
|
self.save_status_messages(model)
|
||||||
|
|
||||||
def on_msg_treemodel_row_deleted(self, model, path):
|
def on_msg_treemodel_row_deleted(self, model, path):
|
||||||
|
|
|
@ -408,53 +408,53 @@ class ConversationTextview:
|
||||||
self.smooth_id = None
|
self.smooth_id = None
|
||||||
self.smooth_scroll_timer.cancel()
|
self.smooth_scroll_timer.cancel()
|
||||||
|
|
||||||
def show_xep0184_warning(self, id):
|
def show_xep0184_warning(self, id_):
|
||||||
if id in self.xep0184_marks:
|
if id_ in self.xep0184_marks:
|
||||||
return
|
return
|
||||||
|
|
||||||
buffer = self.tv.get_buffer()
|
buffer = self.tv.get_buffer()
|
||||||
buffer.begin_user_action()
|
buffer.begin_user_action()
|
||||||
|
|
||||||
self.xep0184_marks[id] = buffer.create_mark(None,
|
self.xep0184_marks[id_] = buffer.create_mark(None,
|
||||||
buffer.get_end_iter(), left_gravity=True)
|
buffer.get_end_iter(), left_gravity=True)
|
||||||
self.xep0184_shown[id] = NOT_SHOWN
|
self.xep0184_shown[id_] = NOT_SHOWN
|
||||||
|
|
||||||
def show_it():
|
def show_it():
|
||||||
if (not id in self.xep0184_shown) or \
|
if (not id_ in self.xep0184_shown) or \
|
||||||
self.xep0184_shown[id] == ALREADY_RECEIVED:
|
self.xep0184_shown[id_] == ALREADY_RECEIVED:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
end_iter = buffer.get_iter_at_mark(
|
end_iter = buffer.get_iter_at_mark(
|
||||||
self.xep0184_marks[id])
|
self.xep0184_marks[id_])
|
||||||
buffer.insert(end_iter, ' ')
|
buffer.insert(end_iter, ' ')
|
||||||
buffer.insert_pixbuf(end_iter,
|
buffer.insert_pixbuf(end_iter,
|
||||||
ConversationTextview.XEP0184_WARNING_PIXBUF)
|
ConversationTextview.XEP0184_WARNING_PIXBUF)
|
||||||
before_img_iter = buffer.get_iter_at_mark(
|
before_img_iter = buffer.get_iter_at_mark(
|
||||||
self.xep0184_marks[id])
|
self.xep0184_marks[id_])
|
||||||
before_img_iter.forward_char()
|
before_img_iter.forward_char()
|
||||||
post_img_iter = before_img_iter.copy()
|
post_img_iter = before_img_iter.copy()
|
||||||
post_img_iter.forward_char()
|
post_img_iter.forward_char()
|
||||||
buffer.apply_tag_by_name('xep0184-warning', before_img_iter,
|
buffer.apply_tag_by_name('xep0184-warning', before_img_iter,
|
||||||
post_img_iter)
|
post_img_iter)
|
||||||
|
|
||||||
self.xep0184_shown[id] = SHOWN
|
self.xep0184_shown[id_] = SHOWN
|
||||||
return False
|
return False
|
||||||
gobject.timeout_add_seconds(2, show_it)
|
gobject.timeout_add_seconds(2, show_it)
|
||||||
|
|
||||||
buffer.end_user_action()
|
buffer.end_user_action()
|
||||||
|
|
||||||
def hide_xep0184_warning(self, id):
|
def hide_xep0184_warning(self, id_):
|
||||||
if id not in self.xep0184_marks:
|
if id_ not in self.xep0184_marks:
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.xep0184_shown[id] == NOT_SHOWN:
|
if self.xep0184_shown[id_] == NOT_SHOWN:
|
||||||
self.xep0184_shown[id] = ALREADY_RECEIVED
|
self.xep0184_shown[id_] = ALREADY_RECEIVED
|
||||||
return
|
return
|
||||||
|
|
||||||
buffer = self.tv.get_buffer()
|
buffer = self.tv.get_buffer()
|
||||||
buffer.begin_user_action()
|
buffer.begin_user_action()
|
||||||
|
|
||||||
begin_iter = buffer.get_iter_at_mark(self.xep0184_marks[id])
|
begin_iter = buffer.get_iter_at_mark(self.xep0184_marks[id_])
|
||||||
|
|
||||||
end_iter = begin_iter.copy()
|
end_iter = begin_iter.copy()
|
||||||
# XXX: Is there a nicer way?
|
# XXX: Is there a nicer way?
|
||||||
|
@ -462,12 +462,12 @@ class ConversationTextview:
|
||||||
end_iter.forward_char()
|
end_iter.forward_char()
|
||||||
|
|
||||||
buffer.delete(begin_iter, end_iter)
|
buffer.delete(begin_iter, end_iter)
|
||||||
buffer.delete_mark(self.xep0184_marks[id])
|
buffer.delete_mark(self.xep0184_marks[id_])
|
||||||
|
|
||||||
buffer.end_user_action()
|
buffer.end_user_action()
|
||||||
|
|
||||||
del self.xep0184_marks[id]
|
del self.xep0184_marks[id_]
|
||||||
del self.xep0184_shown[id]
|
del self.xep0184_shown[id_]
|
||||||
|
|
||||||
def show_focus_out_line(self):
|
def show_focus_out_line(self):
|
||||||
if not self.allow_focus_out_line:
|
if not self.allow_focus_out_line:
|
||||||
|
@ -859,13 +859,13 @@ class ConversationTextview:
|
||||||
|
|
||||||
menu.popup(None, None, None, event.button, event.time)
|
menu.popup(None, None, None, event.button, event.time)
|
||||||
|
|
||||||
def hyperlink_handler(self, texttag, widget, event, iter, kind):
|
def hyperlink_handler(self, texttag, widget, event, iter_, kind):
|
||||||
if event.type == gtk.gdk.BUTTON_PRESS:
|
if event.type == gtk.gdk.BUTTON_PRESS:
|
||||||
begin_iter = iter.copy()
|
begin_iter = iter_.copy()
|
||||||
# we get the begining of the tag
|
# we get the begining of the tag
|
||||||
while not begin_iter.begins_tag(texttag):
|
while not begin_iter.begins_tag(texttag):
|
||||||
begin_iter.backward_char()
|
begin_iter.backward_char()
|
||||||
end_iter = iter.copy()
|
end_iter = iter_.copy()
|
||||||
# we get the end of the tag
|
# we get the end of the tag
|
||||||
while not end_iter.ends_tag(texttag):
|
while not end_iter.ends_tag(texttag):
|
||||||
end_iter.forward_char()
|
end_iter.forward_char()
|
||||||
|
@ -877,7 +877,7 @@ class ConversationTextview:
|
||||||
# we launch the correct application
|
# we launch the correct application
|
||||||
helpers.launch_browser_mailer(kind, word)
|
helpers.launch_browser_mailer(kind, word)
|
||||||
|
|
||||||
def html_hyperlink_handler(self, texttag, widget, event, iter, kind, href):
|
def html_hyperlink_handler(self, texttag, widget, event, iter_, kind, href):
|
||||||
if event.type == gtk.gdk.BUTTON_PRESS:
|
if event.type == gtk.gdk.BUTTON_PRESS:
|
||||||
if event.button == 3: # right click
|
if event.button == 3: # right click
|
||||||
self.make_link_menu(event, kind, href)
|
self.make_link_menu(event, kind, href)
|
||||||
|
@ -922,7 +922,7 @@ class ConversationTextview:
|
||||||
|
|
||||||
return index # the position after *last* special text
|
return index # the position after *last* special text
|
||||||
|
|
||||||
def latex_to_image(self, str):
|
def latex_to_image(self, str_):
|
||||||
result = None
|
result = None
|
||||||
exitcode = 0
|
exitcode = 0
|
||||||
|
|
||||||
|
@ -938,11 +938,11 @@ class ConversationTextview:
|
||||||
'\\item', '\\section', '\\mbox', '\\DeclareRobustCommand', '\\[',
|
'\\item', '\\section', '\\mbox', '\\DeclareRobustCommand', '\\[',
|
||||||
'\\]']
|
'\\]']
|
||||||
|
|
||||||
str = str[2:len(str)-2]
|
str_ = str_[2:len(str_)-2]
|
||||||
|
|
||||||
# filter latex code with bad commands
|
# filter latex code with bad commands
|
||||||
for word in blacklist:
|
for word in blacklist:
|
||||||
if word in str:
|
if word in str_:
|
||||||
exitcode = 1
|
exitcode = 1
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -956,7 +956,7 @@ class ConversationTextview:
|
||||||
texstr += '\\usepackage{amsmath}\\usepackage{amssymb}'
|
texstr += '\\usepackage{amsmath}\\usepackage{amssymb}'
|
||||||
texstr += '\\pagestyle{empty}'
|
texstr += '\\pagestyle{empty}'
|
||||||
texstr += '\\begin{document}\\begin{large}\\begin{gather*}'
|
texstr += '\\begin{document}\\begin{large}\\begin{gather*}'
|
||||||
texstr += str
|
texstr += str_
|
||||||
texstr += '\\end{gather*}\\end{large}\\end{document}'
|
texstr += '\\end{gather*}\\end{large}\\end{document}'
|
||||||
|
|
||||||
file = open(os.path.join(tmpfile + '.tex'), 'w+')
|
file = open(os.path.join(tmpfile + '.tex'), 'w+')
|
||||||
|
|
|
@ -570,9 +570,9 @@ class SingleForm(gtk.Table, object):
|
||||||
model = treeview.get_model()
|
model = treeview.get_model()
|
||||||
deleted = []
|
deleted = []
|
||||||
|
|
||||||
def remove(model, path, iter, deleted):
|
def remove(model, path, iter_, deleted):
|
||||||
deleted+=model[iter]
|
deleted+=model[iter_]
|
||||||
model.remove(iter)
|
model.remove(iter_)
|
||||||
|
|
||||||
selection.selected_foreach(remove, deleted)
|
selection.selected_foreach(remove, deleted)
|
||||||
field.values = (v for v in field.values if v not in deleted)
|
field.values = (v for v in field.values if v not in deleted)
|
||||||
|
|
|
@ -309,12 +309,12 @@ class ChooseGPGKeyDialog:
|
||||||
self.on_response(keyID)
|
self.on_response(keyID)
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
def fill_tree(self, list, selected):
|
def fill_tree(self, list_, selected):
|
||||||
model = self.keys_treeview.get_model()
|
model = self.keys_treeview.get_model()
|
||||||
for keyID in list.keys():
|
for keyID in list_.keys():
|
||||||
iter = model.append((keyID, list[keyID]))
|
iter_ = model.append((keyID, list_[keyID]))
|
||||||
if keyID == selected:
|
if keyID == selected:
|
||||||
path = model.get_path(iter)
|
path = model.get_path(iter_)
|
||||||
self.keys_treeview.set_cursor(path)
|
self.keys_treeview.set_cursor(path)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1104,12 +1104,12 @@ class Dialog(gtk.Dialog):
|
||||||
|
|
||||||
|
|
||||||
class HigDialog(gtk.MessageDialog):
|
class HigDialog(gtk.MessageDialog):
|
||||||
def __init__(self, parent, type, buttons, pritext, sectext,
|
def __init__(self, parent, type_, buttons, pritext, sectext,
|
||||||
on_response_ok = None, on_response_cancel = None, on_response_yes = None,
|
on_response_ok = None, on_response_cancel = None, on_response_yes = None,
|
||||||
on_response_no = None):
|
on_response_no = None):
|
||||||
gtk.MessageDialog.__init__(self, parent,
|
gtk.MessageDialog.__init__(self, parent,
|
||||||
gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_MODAL,
|
gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_MODAL,
|
||||||
type, buttons, message_format = pritext)
|
type_, buttons, message_format = pritext)
|
||||||
|
|
||||||
self.format_secondary_markup(sectext)
|
self.format_secondary_markup(sectext)
|
||||||
|
|
||||||
|
@ -2364,7 +2364,7 @@ class SingleMessageWindow:
|
||||||
form_node = None
|
form_node = None
|
||||||
# FIXME: allow GPG message some day
|
# FIXME: allow GPG message some day
|
||||||
gajim.connections[self.account].send_message(to_whom_jid, message,
|
gajim.connections[self.account].send_message(to_whom_jid, message,
|
||||||
keyID=None, type='normal', subject=subject, session=session,
|
keyID=None, type_='normal', subject=subject, session=session,
|
||||||
form_node=form_node)
|
form_node=form_node)
|
||||||
|
|
||||||
self.subject_entry.set_text('') # we sent ok, clear the subject
|
self.subject_entry.set_text('') # we sent ok, clear the subject
|
||||||
|
|
78
src/disco.py
78
src/disco.py
|
@ -240,9 +240,9 @@ class ServicesCache:
|
||||||
self._items.cleanup()
|
self._items.cleanup()
|
||||||
self._info.cleanup()
|
self._info.cleanup()
|
||||||
|
|
||||||
def _clean_closure(self, cb, type, addr):
|
def _clean_closure(self, cb, type_, addr):
|
||||||
# A closure died, clean up
|
# A closure died, clean up
|
||||||
cbkey = (type, addr)
|
cbkey = (type_, addr)
|
||||||
try:
|
try:
|
||||||
self._cbs[cbkey].remove(cb)
|
self._cbs[cbkey].remove(cb)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
@ -989,20 +989,20 @@ _('This service does not contain any items to browse.'))
|
||||||
get_agent_address(jid, node)))
|
get_agent_address(jid, node)))
|
||||||
self.cache.get_info(jid, node, self._agent_info, force = force)
|
self.cache.get_info(jid, node, self._agent_info, force = force)
|
||||||
|
|
||||||
def _update_item(self, iter, jid, node, item):
|
def _update_item(self, iter_, jid, node, item):
|
||||||
'''Called when an item should be updated in the model. The result of a
|
'''Called when an item should be updated in the model. The result of a
|
||||||
disco#items query. (seldom)'''
|
disco#items query. (seldom)'''
|
||||||
if 'name' in item:
|
if 'name' in item:
|
||||||
self.model[iter][2] = item['name']
|
self.model[iter_][2] = item['name']
|
||||||
|
|
||||||
def _update_info(self, iter, jid, node, identities, features, data):
|
def _update_info(self, iter_, jid, node, identities, features, data):
|
||||||
'''Called when an item should be updated in the model with further info.
|
'''Called when an item should be updated in the model with further info.
|
||||||
The result of a disco#info query.'''
|
The result of a disco#info query.'''
|
||||||
name = identities[0].get('name', '')
|
name = identities[0].get('name', '')
|
||||||
if name:
|
if name:
|
||||||
self.model[iter][2] = name
|
self.model[iter_][2] = name
|
||||||
|
|
||||||
def _update_error(self, iter, jid, node):
|
def _update_error(self, iter_, jid, node):
|
||||||
'''Called when a disco#info query failed for an item.'''
|
'''Called when a disco#info query failed for an item.'''
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -1024,21 +1024,21 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
self._view_signals = []
|
self._view_signals = []
|
||||||
self._scroll_signal = None
|
self._scroll_signal = None
|
||||||
|
|
||||||
def _pixbuf_renderer_data_func(self, col, cell, model, iter):
|
def _pixbuf_renderer_data_func(self, col, cell, model, iter_):
|
||||||
'''Callback for setting the pixbuf renderer's properties.'''
|
'''Callback for setting the pixbuf renderer's properties.'''
|
||||||
jid = model.get_value(iter, 0)
|
jid = model.get_value(iter_, 0)
|
||||||
if jid:
|
if jid:
|
||||||
pix = model.get_value(iter, 2)
|
pix = model.get_value(iter_, 2)
|
||||||
cell.set_property('visible', True)
|
cell.set_property('visible', True)
|
||||||
cell.set_property('pixbuf', pix)
|
cell.set_property('pixbuf', pix)
|
||||||
else:
|
else:
|
||||||
cell.set_property('visible', False)
|
cell.set_property('visible', False)
|
||||||
|
|
||||||
def _text_renderer_data_func(self, col, cell, model, iter):
|
def _text_renderer_data_func(self, col, cell, model, iter_):
|
||||||
'''Callback for setting the text renderer's properties.'''
|
'''Callback for setting the text renderer's properties.'''
|
||||||
jid = model.get_value(iter, 0)
|
jid = model.get_value(iter_, 0)
|
||||||
markup = model.get_value(iter, 3)
|
markup = model.get_value(iter_, 3)
|
||||||
state = model.get_value(iter, 4)
|
state = model.get_value(iter_, 4)
|
||||||
cell.set_property('markup', markup)
|
cell.set_property('markup', markup)
|
||||||
if jid:
|
if jid:
|
||||||
cell.set_property('cell_background_set', False)
|
cell.set_property('cell_background_set', False)
|
||||||
|
@ -1407,13 +1407,13 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
self.window.progressbar.hide()
|
self.window.progressbar.hide()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _friendly_category(self, category, type=None):
|
def _friendly_category(self, category, type_=None):
|
||||||
'''Get the friendly category name and priority.'''
|
'''Get the friendly category name and priority.'''
|
||||||
cat = None
|
cat = None
|
||||||
if type:
|
if type_:
|
||||||
# Try type-specific override
|
# Try type-specific override
|
||||||
try:
|
try:
|
||||||
cat, prio = _cat_to_descr[(category, type)]
|
cat, prio = _cat_to_descr[(category, type_)]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
if not cat:
|
if not cat:
|
||||||
|
@ -1423,14 +1423,14 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
cat, prio = _cat_to_descr['other']
|
cat, prio = _cat_to_descr['other']
|
||||||
return cat, prio
|
return cat, prio
|
||||||
|
|
||||||
def _create_category(self, cat, type=None):
|
def _create_category(self, cat, type_=None):
|
||||||
'''Creates a category row.'''
|
'''Creates a category row.'''
|
||||||
cat, prio = self._friendly_category(cat, type)
|
cat, prio = self._friendly_category(cat, type_)
|
||||||
return self.model.append(None, ('', '', None, cat, prio))
|
return self.model.append(None, ('', '', None, cat, prio))
|
||||||
|
|
||||||
def _find_category(self, cat, type=None):
|
def _find_category(self, cat, type_=None):
|
||||||
'''Looks up a category row and returns the iterator to it, or None.'''
|
'''Looks up a category row and returns the iterator to it, or None.'''
|
||||||
cat, prio = self._friendly_category(cat, type)
|
cat, prio = self._friendly_category(cat, type_)
|
||||||
iter = self.model.get_iter_root()
|
iter = self.model.get_iter_root()
|
||||||
while iter:
|
while iter:
|
||||||
if self.model.get_value(iter, 3).decode('utf-8') == cat:
|
if self.model.get_value(iter, 3).decode('utf-8') == cat:
|
||||||
|
@ -1486,15 +1486,15 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
self.cache.get_info(jid, node, self._agent_info, force = force)
|
self.cache.get_info(jid, node, self._agent_info, force = force)
|
||||||
self._update_progressbar()
|
self._update_progressbar()
|
||||||
|
|
||||||
def _update_item(self, iter, jid, node, item):
|
def _update_item(self, iter_, jid, node, item):
|
||||||
addr = get_agent_address(jid, node)
|
addr = get_agent_address(jid, node)
|
||||||
if 'name' in item:
|
if 'name' in item:
|
||||||
descr = "<b>%s</b>\n%s" % (item['name'], addr)
|
descr = "<b>%s</b>\n%s" % (item['name'], addr)
|
||||||
else:
|
else:
|
||||||
descr = "<b>%s</b>" % addr
|
descr = "<b>%s</b>" % addr
|
||||||
self.model[iter][3] = descr
|
self.model[iter_][3] = descr
|
||||||
|
|
||||||
def _update_info(self, iter, jid, node, identities, features, data):
|
def _update_info(self, iter_, jid, node, identities, features, data):
|
||||||
addr = get_agent_address(jid, node)
|
addr = get_agent_address(jid, node)
|
||||||
name = identities[0].get('name', '')
|
name = identities[0].get('name', '')
|
||||||
if name:
|
if name:
|
||||||
|
@ -1516,16 +1516,16 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
break
|
break
|
||||||
|
|
||||||
# Check if we have to move categories
|
# Check if we have to move categories
|
||||||
old_cat_iter = self.model.iter_parent(iter)
|
old_cat_iter = self.model.iter_parent(iter_)
|
||||||
old_cat = self.model.get_value(old_cat_iter, 3).decode('utf-8')
|
old_cat = self.model.get_value(old_cat_iter, 3).decode('utf-8')
|
||||||
if self.model.get_value(old_cat_iter, 3) == cat:
|
if self.model.get_value(old_cat_iter, 3) == cat:
|
||||||
# Already in the right category, just update
|
# Already in the right category, just update
|
||||||
self.model[iter][2] = pix
|
self.model[iter_][2] = pix
|
||||||
self.model[iter][3] = descr
|
self.model[iter_][3] = descr
|
||||||
self.model[iter][4] = 0
|
self.model[iter_][4] = 0
|
||||||
return
|
return
|
||||||
# Not in the right category, move it.
|
# Not in the right category, move it.
|
||||||
self.model.remove(iter)
|
self.model.remove(iter_)
|
||||||
|
|
||||||
# Check if the old category is empty
|
# Check if the old category is empty
|
||||||
if not self.model.iter_is_valid(old_cat_iter):
|
if not self.model.iter_is_valid(old_cat_iter):
|
||||||
|
@ -1539,9 +1539,9 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
self.model.append(cat_iter, (jid, node, pix, descr, 0))
|
self.model.append(cat_iter, (jid, node, pix, descr, 0))
|
||||||
self._expand_all()
|
self._expand_all()
|
||||||
|
|
||||||
def _update_error(self, iter, jid, node):
|
def _update_error(self, iter_, jid, node):
|
||||||
addr = get_agent_address(jid, node)
|
addr = get_agent_address(jid, node)
|
||||||
self.model[iter][4] = 2
|
self.model[iter_][4] = 2
|
||||||
self._progress += 1
|
self._progress += 1
|
||||||
self._update_progressbar()
|
self._update_progressbar()
|
||||||
|
|
||||||
|
@ -1738,7 +1738,7 @@ class MucBrowser(AgentBrowser):
|
||||||
if not self._fetch_source:
|
if not self._fetch_source:
|
||||||
self._fetch_source = gobject.idle_add(self._start_info_query)
|
self._fetch_source = gobject.idle_add(self._start_info_query)
|
||||||
|
|
||||||
def _update_info(self, iter, jid, node, identities, features, data):
|
def _update_info(self, iter_, jid, node, identities, features, data):
|
||||||
name = identities[0].get('name', '')
|
name = identities[0].get('name', '')
|
||||||
for form in data:
|
for form in data:
|
||||||
typefield = form.getField('FORM_TYPE')
|
typefield = form.getField('FORM_TYPE')
|
||||||
|
@ -1748,15 +1748,15 @@ class MucBrowser(AgentBrowser):
|
||||||
users = form.getField('muc#roominfo_occupants')
|
users = form.getField('muc#roominfo_occupants')
|
||||||
descr = form.getField('muc#roominfo_description')
|
descr = form.getField('muc#roominfo_description')
|
||||||
if users:
|
if users:
|
||||||
self.model[iter][3] = int(users.getValue())
|
self.model[iter_][3] = int(users.getValue())
|
||||||
self.model[iter][4] = users.getValue()
|
self.model[iter_][4] = users.getValue()
|
||||||
if descr:
|
if descr:
|
||||||
self.model[iter][5] = descr.getValue()
|
self.model[iter_][5] = descr.getValue()
|
||||||
# Only set these when we find a form with additional info
|
# Only set these when we find a form with additional info
|
||||||
# Some servers don't support forms and put extra info in
|
# Some servers don't support forms and put extra info in
|
||||||
# the name attribute, so we preserve it in that case.
|
# the name attribute, so we preserve it in that case.
|
||||||
self.model[iter][2] = name
|
self.model[iter_][2] = name
|
||||||
self.model[iter][6] = True
|
self.model[iter_][6] = True
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
# We didn't find a form, switch to alternate query mode
|
# We didn't find a form, switch to alternate query mode
|
||||||
|
@ -1766,7 +1766,7 @@ class MucBrowser(AgentBrowser):
|
||||||
self._fetch_source = None
|
self._fetch_source = None
|
||||||
self._query_visible()
|
self._query_visible()
|
||||||
|
|
||||||
def _update_error(self, iter, jid, node):
|
def _update_error(self, iter_, jid, node):
|
||||||
# switch to alternate query mode
|
# switch to alternate query mode
|
||||||
self.cache.get_items(jid, node, self._channel_altinfo)
|
self.cache.get_items(jid, node, self._channel_altinfo)
|
||||||
|
|
||||||
|
@ -1836,7 +1836,7 @@ class DiscussionGroupsBrowser(AgentBrowser):
|
||||||
self._total_items += 1
|
self._total_items += 1
|
||||||
self._add_item(jid, node, item, force)
|
self._add_item(jid, node, item, force)
|
||||||
|
|
||||||
def _in_list_foreach(self, model, path, iter, node):
|
def _in_list_foreach(self, model, path, iter_, node):
|
||||||
if model[path][1] == node:
|
if model[path][1] == node:
|
||||||
self.in_list = True
|
self.in_list = True
|
||||||
|
|
||||||
|
|
|
@ -458,8 +458,8 @@ _('Connection with peer cannot be established.'))
|
||||||
eta = remaining_size / speed
|
eta = remaining_size / speed
|
||||||
return eta, speed
|
return eta, speed
|
||||||
|
|
||||||
def _remove_transfer(self, iter, sid, file_props):
|
def _remove_transfer(self, iter_, sid, file_props):
|
||||||
self.model.remove(iter)
|
self.model.remove(iter_)
|
||||||
if 'tt_account' in file_props:
|
if 'tt_account' in file_props:
|
||||||
# file transfer is set
|
# file transfer is set
|
||||||
account = file_props['tt_account']
|
account = file_props['tt_account']
|
||||||
|
@ -484,7 +484,7 @@ _('Connection with peer cannot be established.'))
|
||||||
del(self.files_props[sid[0]][sid[1:]])
|
del(self.files_props[sid[0]][sid[1:]])
|
||||||
del(file_props)
|
del(file_props)
|
||||||
|
|
||||||
def set_progress(self, typ, sid, transfered_size, iter = None):
|
def set_progress(self, typ, sid, transfered_size, iter_ = None):
|
||||||
''' change the progress of a transfer with new transfered size'''
|
''' change the progress of a transfer with new transfered size'''
|
||||||
if sid not in self.files_props[typ]:
|
if sid not in self.files_props[typ]:
|
||||||
return
|
return
|
||||||
|
@ -494,11 +494,11 @@ _('Connection with peer cannot be established.'))
|
||||||
percent = 0
|
percent = 0
|
||||||
else:
|
else:
|
||||||
percent = round(float(transfered_size) / full_size * 100, 1)
|
percent = round(float(transfered_size) / full_size * 100, 1)
|
||||||
if iter is None:
|
if iter_ is None:
|
||||||
iter = self.get_iter_by_sid(typ, sid)
|
iter_ = self.get_iter_by_sid(typ, sid)
|
||||||
if iter is not None:
|
if iter_ is not None:
|
||||||
just_began = False
|
just_began = False
|
||||||
if self.model[iter][C_PERCENT] == 0 and int(percent > 0):
|
if self.model[iter_][C_PERCENT] == 0 and int(percent > 0):
|
||||||
just_began = True
|
just_began = True
|
||||||
text = self._format_percent(percent)
|
text = self._format_percent(percent)
|
||||||
if transfered_size == 0:
|
if transfered_size == 0:
|
||||||
|
@ -520,8 +520,8 @@ _('Connection with peer cannot be established.'))
|
||||||
eta, speed = self._get_eta_and_speed(full_size, transfered_size,
|
eta, speed = self._get_eta_and_speed(full_size, transfered_size,
|
||||||
file_props)
|
file_props)
|
||||||
|
|
||||||
self.model.set(iter, C_PROGRESS, text)
|
self.model.set(iter_, C_PROGRESS, text)
|
||||||
self.model.set(iter, C_PERCENT, int(percent))
|
self.model.set(iter_, C_PERCENT, int(percent))
|
||||||
text = self._format_time(eta)
|
text = self._format_time(eta)
|
||||||
text += '\n'
|
text += '\n'
|
||||||
#This should make the string Kb/s,
|
#This should make the string Kb/s,
|
||||||
|
@ -529,7 +529,7 @@ _('Connection with peer cannot be established.'))
|
||||||
#Only the 's' after / (which means second) should be translated.
|
#Only the 's' after / (which means second) should be translated.
|
||||||
text += _('(%(filesize_unit)s/s)') % {'filesize_unit':
|
text += _('(%(filesize_unit)s/s)') % {'filesize_unit':
|
||||||
helpers.convert_bytes(speed)}
|
helpers.convert_bytes(speed)}
|
||||||
self.model.set(iter, C_TIME, text)
|
self.model.set(iter_, C_TIME, text)
|
||||||
|
|
||||||
# try to guess what should be the status image
|
# try to guess what should be the status image
|
||||||
if file_props['type'] == 'r':
|
if file_props['type'] == 'r':
|
||||||
|
@ -542,11 +542,11 @@ _('Connection with peer cannot be established.'))
|
||||||
status = 'waiting'
|
status = 'waiting'
|
||||||
if 'connected' in file_props and file_props['connected'] == False:
|
if 'connected' in file_props and file_props['connected'] == False:
|
||||||
status = 'stop'
|
status = 'stop'
|
||||||
self.model.set(iter, 0, self.images[status])
|
self.model.set(iter_, 0, self.images[status])
|
||||||
if transfered_size == full_size:
|
if transfered_size == full_size:
|
||||||
self.set_status(typ, sid, 'ok')
|
self.set_status(typ, sid, 'ok')
|
||||||
elif just_began:
|
elif just_began:
|
||||||
path = self.model.get_path(iter)
|
path = self.model.get_path(iter_)
|
||||||
self.select_func(path)
|
self.select_func(path)
|
||||||
|
|
||||||
def get_iter_by_sid(self, typ, sid):
|
def get_iter_by_sid(self, typ, sid):
|
||||||
|
@ -873,11 +873,11 @@ _('Connection with peer cannot be established.'))
|
||||||
def on_close_button_clicked(self, widget):
|
def on_close_button_clicked(self, widget):
|
||||||
self.window.hide()
|
self.window.hide()
|
||||||
|
|
||||||
def show_context_menu(self, event, iter):
|
def show_context_menu(self, event, iter_):
|
||||||
# change the sensitive propery of the buttons and menuitems
|
# change the sensitive propery of the buttons and menuitems
|
||||||
path = None
|
path = None
|
||||||
if iter is not None:
|
if iter_ is not None:
|
||||||
path = self.model.get_path(iter)
|
path = self.model.get_path(iter_)
|
||||||
self.set_buttons_sensitive(path, True)
|
self.set_buttons_sensitive(path, True)
|
||||||
|
|
||||||
event_button = gtkgui_helpers.get_possible_button_event(event)
|
event_button = gtkgui_helpers.get_possible_button_event(event)
|
||||||
|
|
|
@ -2307,7 +2307,8 @@ class Interface:
|
||||||
room_jid = room_jid, name = nick, show = show)
|
room_jid = room_jid, name = nick, show = show)
|
||||||
|
|
||||||
if not session:
|
if not session:
|
||||||
session = gajim.connections[account].make_new_session(fjid, None, type='pm')
|
session = gajim.connections[account].make_new_session(
|
||||||
|
fjid, None, type_='pm')
|
||||||
|
|
||||||
self.new_private_chat(gc_contact, account, session=session)
|
self.new_private_chat(gc_contact, account, session=session)
|
||||||
ctrl = session.control
|
ctrl = session.control
|
||||||
|
|
|
@ -66,19 +66,19 @@ def set_renderer_color(treeview, renderer, set_background = True):
|
||||||
fgcolor = treeview.style.fg[gtk.STATE_PRELIGHT]
|
fgcolor = treeview.style.fg[gtk.STATE_PRELIGHT]
|
||||||
renderer.set_property('foreground-gdk', fgcolor)
|
renderer.set_property('foreground-gdk', fgcolor)
|
||||||
|
|
||||||
def tree_cell_data_func(column, renderer, model, iter, tv=None):
|
def tree_cell_data_func(column, renderer, model, iter_, tv=None):
|
||||||
# cell data func is global, because we don't want it to keep
|
# cell data func is global, because we don't want it to keep
|
||||||
# reference to GroupchatControl instance (self)
|
# reference to GroupchatControl instance (self)
|
||||||
theme = gajim.config.get('roster_theme')
|
theme = gajim.config.get('roster_theme')
|
||||||
# allocate space for avatar only if needed
|
# allocate space for avatar only if needed
|
||||||
parent_iter = model.iter_parent(iter)
|
parent_iter = model.iter_parent(iter_)
|
||||||
if isinstance(renderer, gtk.CellRendererPixbuf):
|
if isinstance(renderer, gtk.CellRendererPixbuf):
|
||||||
avatar_position = gajim.config.get('avatar_position_in_roster')
|
avatar_position = gajim.config.get('avatar_position_in_roster')
|
||||||
if avatar_position == 'right':
|
if avatar_position == 'right':
|
||||||
renderer.set_property('xalign', 1) # align pixbuf to the right
|
renderer.set_property('xalign', 1) # align pixbuf to the right
|
||||||
else:
|
else:
|
||||||
renderer.set_property('xalign', 0.5)
|
renderer.set_property('xalign', 0.5)
|
||||||
if parent_iter and (model[iter][C_AVATAR] or avatar_position == 'left'):
|
if parent_iter and (model[iter_][C_AVATAR] or avatar_position == 'left'):
|
||||||
renderer.set_property('visible', True)
|
renderer.set_property('visible', True)
|
||||||
renderer.set_property('width', gajim.config.get('roster_avatar_width'))
|
renderer.set_property('width', gajim.config.get('roster_avatar_width'))
|
||||||
else:
|
else:
|
||||||
|
@ -541,8 +541,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
for nick in gajim.contacts.get_nick_list(self.account, self.room_jid):
|
for nick in gajim.contacts.get_nick_list(self.account, self.room_jid):
|
||||||
self.draw_contact(nick)
|
self.draw_contact(nick)
|
||||||
|
|
||||||
def _change_style(self, model, path, iter):
|
def _change_style(self, model, path, iter_):
|
||||||
model[iter][C_NICK] = model[iter][C_NICK]
|
model[iter_][C_NICK] = model[iter_][C_NICK]
|
||||||
|
|
||||||
def change_roster_style(self):
|
def change_roster_style(self):
|
||||||
model = self.list_treeview.get_model()
|
model = self.list_treeview.get_model()
|
||||||
|
@ -982,12 +982,12 @@ class GroupchatControl(ChatControlBase):
|
||||||
# Recalculate column width for ellipsizin
|
# Recalculate column width for ellipsizin
|
||||||
self.list_treeview.columns_autosize()
|
self.list_treeview.columns_autosize()
|
||||||
|
|
||||||
def on_send_pm(self, widget=None, model=None, iter=None, nick=None,
|
def on_send_pm(self, widget=None, model=None, iter_=None, nick=None,
|
||||||
msg=None):
|
msg=None):
|
||||||
'''opens a chat window and if msg is not None sends private message to a
|
'''opens a chat window and if msg is not None sends private message to a
|
||||||
contact in a room'''
|
contact in a room'''
|
||||||
if nick is None:
|
if nick is None:
|
||||||
nick = model[iter][C_NICK].decode('utf-8')
|
nick = model[iter_][C_NICK].decode('utf-8')
|
||||||
fjid = gajim.construct_fjid(self.room_jid, nick) # 'fake' jid
|
fjid = gajim.construct_fjid(self.room_jid, nick) # 'fake' jid
|
||||||
|
|
||||||
ctrl = self._start_private_message(nick)
|
ctrl = self._start_private_message(nick)
|
||||||
|
@ -2040,17 +2040,17 @@ class GroupchatControl(ChatControlBase):
|
||||||
widget.get_selection().unselect_all()
|
widget.get_selection().unselect_all()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def on_list_treeview_row_expanded(self, widget, iter, path):
|
def on_list_treeview_row_expanded(self, widget, iter_, path):
|
||||||
'''When a row is expanded: change the icon of the arrow'''
|
'''When a row is expanded: change the icon of the arrow'''
|
||||||
model = widget.get_model()
|
model = widget.get_model()
|
||||||
image = gajim.interface.jabber_state_images['16']['opened']
|
image = gajim.interface.jabber_state_images['16']['opened']
|
||||||
model[iter][C_IMG] = image
|
model[iter_][C_IMG] = image
|
||||||
|
|
||||||
def on_list_treeview_row_collapsed(self, widget, iter, path):
|
def on_list_treeview_row_collapsed(self, widget, iter_, path):
|
||||||
'''When a row is collapsed: change the icon of the arrow'''
|
'''When a row is collapsed: change the icon of the arrow'''
|
||||||
model = widget.get_model()
|
model = widget.get_model()
|
||||||
image = gajim.interface.jabber_state_images['16']['closed']
|
image = gajim.interface.jabber_state_images['16']['closed']
|
||||||
model[iter][C_IMG] = image
|
model[iter_][C_IMG] = image
|
||||||
|
|
||||||
def kick(self, widget, nick):
|
def kick(self, widget, nick):
|
||||||
'''kick a user'''
|
'''kick a user'''
|
||||||
|
@ -2062,10 +2062,10 @@ class GroupchatControl(ChatControlBase):
|
||||||
instance = dialogs.InputDialog(_('Kicking %s') % nick,
|
instance = dialogs.InputDialog(_('Kicking %s') % nick,
|
||||||
_('You may specify a reason below:'), ok_handler=on_ok)
|
_('You may specify a reason below:'), ok_handler=on_ok)
|
||||||
|
|
||||||
def mk_menu(self, event, iter):
|
def mk_menu(self, event, iter_):
|
||||||
'''Make contact's popup menu'''
|
'''Make contact's popup menu'''
|
||||||
model = self.list_treeview.get_model()
|
model = self.list_treeview.get_model()
|
||||||
nick = model[iter][C_NICK].decode('utf-8')
|
nick = model[iter_][C_NICK].decode('utf-8')
|
||||||
c = gajim.contacts.get_gc_contact(self.account, self.room_jid, nick)
|
c = gajim.contacts.get_gc_contact(self.account, self.room_jid, nick)
|
||||||
jid = c.jid
|
jid = c.jid
|
||||||
target_affiliation = c.affiliation
|
target_affiliation = c.affiliation
|
||||||
|
@ -2159,7 +2159,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
self.handlers[id] = item
|
self.handlers[id] = item
|
||||||
|
|
||||||
item = xml.get_widget('send_private_message_menuitem')
|
item = xml.get_widget('send_private_message_menuitem')
|
||||||
id = item.connect('activate', self.on_send_pm, model, iter)
|
id = item.connect('activate', self.on_send_pm, model, iter_)
|
||||||
self.handlers[id] = item
|
self.handlers[id] = item
|
||||||
|
|
||||||
item = xml.get_widget('send_file_menuitem')
|
item = xml.get_widget('send_file_menuitem')
|
||||||
|
|
|
@ -35,11 +35,11 @@ from common import helpers
|
||||||
|
|
||||||
_exception_in_progress = threading.Lock()
|
_exception_in_progress = threading.Lock()
|
||||||
|
|
||||||
def _info(type, value, tb):
|
def _info(type_, value, tb):
|
||||||
if not _exception_in_progress.acquire(False):
|
if not _exception_in_progress.acquire(False):
|
||||||
# Exceptions have piled up, so we use the default exception
|
# Exceptions have piled up, so we use the default exception
|
||||||
# handler for such exceptions
|
# handler for such exceptions
|
||||||
_excepthook_save(type, value, tb)
|
_excepthook_save(type_, value, tb)
|
||||||
return
|
return
|
||||||
|
|
||||||
dialog = dialogs.HigDialog(None, gtk.MESSAGE_WARNING, gtk.BUTTONS_NONE,
|
dialog = dialogs.HigDialog(None, gtk.MESSAGE_WARNING, gtk.BUTTONS_NONE,
|
||||||
|
@ -69,7 +69,7 @@ def _info(type, value, tb):
|
||||||
frame.set_border_width(6)
|
frame.set_border_width(6)
|
||||||
textbuffer = textview.get_buffer()
|
textbuffer = textview.get_buffer()
|
||||||
trace = StringIO()
|
trace = StringIO()
|
||||||
traceback.print_exception(type, value, tb, None, trace)
|
traceback.print_exception(type_, value, tb, None, trace)
|
||||||
textbuffer.set_text(trace.getvalue())
|
textbuffer.set_text(trace.getvalue())
|
||||||
textview.set_size_request(
|
textview.set_size_request(
|
||||||
gtk.gdk.screen_width() / 3,
|
gtk.gdk.screen_width() / 3,
|
||||||
|
|
|
@ -273,10 +273,10 @@ class HashDigest:
|
||||||
self.algo = self.cleanID(algo)
|
self.algo = self.cleanID(algo)
|
||||||
self.digest = self.cleanID(digest)
|
self.digest = self.cleanID(digest)
|
||||||
|
|
||||||
def cleanID(self, id):
|
def cleanID(self, id_):
|
||||||
id = id.strip().lower()
|
id_ = id_.strip().lower()
|
||||||
for strip in (' :.-_'): id = id.replace(strip, '')
|
for strip in (' :.-_'): id_ = id_.replace(strip, '')
|
||||||
return id
|
return id_
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
sa, sd = self.algo, self.digest
|
sa, sd = self.algo, self.digest
|
||||||
|
|
|
@ -728,7 +728,7 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
|
||||||
else:
|
else:
|
||||||
self._insert_text(text.strip('\n'))
|
self._insert_text(text.strip('\n'))
|
||||||
|
|
||||||
def _anchor_event(self, tag, textview, event, iter, href, type_):
|
def _anchor_event(self, tag, textview, event, iter_, href, type_):
|
||||||
if event.type == gtk.gdk.BUTTON_PRESS:
|
if event.type == gtk.gdk.BUTTON_PRESS:
|
||||||
self.textview.emit('url-clicked', href, type_)
|
self.textview.emit('url-clicked', href, type_)
|
||||||
return True
|
return True
|
||||||
|
@ -1068,7 +1068,7 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
htmlview.connect('motion_notify_event', on_textview_motion_notify_event)
|
htmlview.connect('motion_notify_event', on_textview_motion_notify_event)
|
||||||
|
|
||||||
def handler(texttag, widget, event, iter, kind, href):
|
def handler(texttag, widget, event, iter_, kind, href):
|
||||||
if event.type == gtk.gdk.BUTTON_PRESS:
|
if event.type == gtk.gdk.BUTTON_PRESS:
|
||||||
print href
|
print href
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ class MessageControl:
|
||||||
if crypto_changed:
|
if crypto_changed:
|
||||||
self.print_esession_details()
|
self.print_esession_details()
|
||||||
|
|
||||||
def send_message(self, message, keyID = '', type = 'chat',
|
def send_message(self, message, keyID = '', type_ = 'chat',
|
||||||
chatstate = None, msg_id = None, composing_xep = None, resource = None,
|
chatstate = None, msg_id = None, composing_xep = None, resource = None,
|
||||||
user_nick = None):
|
user_nick = None):
|
||||||
# Send the given message to the active tab.
|
# Send the given message to the active tab.
|
||||||
|
@ -184,7 +184,7 @@ class MessageControl:
|
||||||
self.set_session(sess)
|
self.set_session(sess)
|
||||||
|
|
||||||
# Send and update history
|
# Send and update history
|
||||||
return conn.send_message(jid, message, keyID, type = type,
|
return conn.send_message(jid, message, keyID, type_ = type_,
|
||||||
chatstate = chatstate, msg_id = msg_id,
|
chatstate = chatstate, msg_id = msg_id,
|
||||||
composing_xep = composing_xep,
|
composing_xep = composing_xep,
|
||||||
resource = self.resource, user_nick = user_nick,
|
resource = self.resource, user_nick = user_nick,
|
||||||
|
|
|
@ -55,7 +55,7 @@ class MessageWindow(object):
|
||||||
CLOSE_CTRL_KEY
|
CLOSE_CTRL_KEY
|
||||||
) = range(5)
|
) = range(5)
|
||||||
|
|
||||||
def __init__(self, acct, type, parent_window=None, parent_paned=None):
|
def __init__(self, acct, type_, parent_window=None, parent_paned=None):
|
||||||
# A dictionary of dictionaries
|
# A dictionary of dictionaries
|
||||||
# where _contacts[account][jid] == A MessageControl
|
# where _contacts[account][jid] == A MessageControl
|
||||||
self._controls = {}
|
self._controls = {}
|
||||||
|
@ -63,7 +63,7 @@ class MessageWindow(object):
|
||||||
# If None, the window is not tied to any specific account
|
# If None, the window is not tied to any specific account
|
||||||
self.account = acct
|
self.account = acct
|
||||||
# If None, the window is not tied to any specific type
|
# If None, the window is not tied to any specific type
|
||||||
self.type = type
|
self.type_ = type_
|
||||||
# dict { handler id: widget}. Keeps callbacks, which
|
# dict { handler id: widget}. Keeps callbacks, which
|
||||||
# lead to cylcular references
|
# lead to cylcular references
|
||||||
self.handlers = {}
|
self.handlers = {}
|
||||||
|
@ -773,7 +773,7 @@ class MessageWindow(object):
|
||||||
selection.set(selection.target, 8, str(source_page_num))
|
selection.set(selection.target, 8, str(source_page_num))
|
||||||
|
|
||||||
def on_tab_label_drag_data_received_cb(self, widget, drag_context, x, y,
|
def on_tab_label_drag_data_received_cb(self, widget, drag_context, x, y,
|
||||||
selection, type, time):
|
selection, type_, time):
|
||||||
'''Reorder the tabs according to the drop position'''
|
'''Reorder the tabs according to the drop position'''
|
||||||
source_page_num = int(selection.data)
|
source_page_num = int(selection.data)
|
||||||
dest_page_num, to_right = self.get_tab_at_xy(x, y)
|
dest_page_num, to_right = self.get_tab_at_xy(x, y)
|
||||||
|
@ -869,13 +869,13 @@ class MessageWindowMgr(gobject.GObject):
|
||||||
for win in self.windows():
|
for win in self.windows():
|
||||||
win.change_account_name(old_name, new_name)
|
win.change_account_name(old_name, new_name)
|
||||||
|
|
||||||
def _new_window(self, acct, type):
|
def _new_window(self, acct, type_):
|
||||||
parent_win = None
|
parent_win = None
|
||||||
parent_paned = None
|
parent_paned = None
|
||||||
if self.mode == self.ONE_MSG_WINDOW_ALWAYS_WITH_ROSTER:
|
if self.mode == self.ONE_MSG_WINDOW_ALWAYS_WITH_ROSTER:
|
||||||
parent_win = self.parent_win
|
parent_win = self.parent_win
|
||||||
parent_paned = self.parent_paned
|
parent_paned = self.parent_paned
|
||||||
win = MessageWindow(acct, type, parent_win, parent_paned)
|
win = MessageWindow(acct, type_, parent_win, parent_paned)
|
||||||
# we track the lifetime of this window
|
# we track the lifetime of this window
|
||||||
win.window.connect('delete-event', self._on_window_delete)
|
win.window.connect('delete-event', self._on_window_delete)
|
||||||
win.window.connect('destroy', self._on_window_destroy)
|
win.window.connect('destroy', self._on_window_destroy)
|
||||||
|
@ -897,14 +897,14 @@ class MessageWindowMgr(gobject.GObject):
|
||||||
def has_window(self, jid, acct):
|
def has_window(self, jid, acct):
|
||||||
return self.get_window(jid, acct) is not None
|
return self.get_window(jid, acct) is not None
|
||||||
|
|
||||||
def one_window_opened(self, contact=None, acct=None, type=None):
|
def one_window_opened(self, contact=None, acct=None, type_=None):
|
||||||
try:
|
try:
|
||||||
return \
|
return \
|
||||||
self._windows[self._mode_to_key(contact, acct, type)] is not None
|
self._windows[self._mode_to_key(contact, acct, type_)] is not None
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _resize_window(self, win, acct, type):
|
def _resize_window(self, win, acct, type_):
|
||||||
'''Resizes window according to config settings'''
|
'''Resizes window according to config settings'''
|
||||||
if self.mode in (self.ONE_MSG_WINDOW_ALWAYS,
|
if self.mode in (self.ONE_MSG_WINDOW_ALWAYS,
|
||||||
self.ONE_MSG_WINDOW_ALWAYS_WITH_ROSTER):
|
self.ONE_MSG_WINDOW_ALWAYS_WITH_ROSTER):
|
||||||
|
@ -920,10 +920,10 @@ class MessageWindowMgr(gobject.GObject):
|
||||||
size = (gajim.config.get_per('accounts', acct, 'msgwin-width'),
|
size = (gajim.config.get_per('accounts', acct, 'msgwin-width'),
|
||||||
gajim.config.get_per('accounts', acct, 'msgwin-height'))
|
gajim.config.get_per('accounts', acct, 'msgwin-height'))
|
||||||
elif self.mode in (self.ONE_MSG_WINDOW_NEVER, self.ONE_MSG_WINDOW_PERTYPE):
|
elif self.mode in (self.ONE_MSG_WINDOW_NEVER, self.ONE_MSG_WINDOW_PERTYPE):
|
||||||
if type == message_control.TYPE_PM:
|
if type_ == message_control.TYPE_PM:
|
||||||
type = message_control.TYPE_CHAT
|
type_ = message_control.TYPE_CHAT
|
||||||
opt_width = type + '-msgwin-width'
|
opt_width = type_ + '-msgwin-width'
|
||||||
opt_height = type + '-msgwin-height'
|
opt_height = type_ + '-msgwin-height'
|
||||||
size = (gajim.config.get(opt_width), gajim.config.get(opt_height))
|
size = (gajim.config.get(opt_width), gajim.config.get(opt_height))
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
@ -931,7 +931,7 @@ class MessageWindowMgr(gobject.GObject):
|
||||||
if win.parent_paned:
|
if win.parent_paned:
|
||||||
win.parent_paned.set_position(parent_size[0])
|
win.parent_paned.set_position(parent_size[0])
|
||||||
|
|
||||||
def _position_window(self, win, acct, type):
|
def _position_window(self, win, acct, type_):
|
||||||
'''Moves window according to config settings'''
|
'''Moves window according to config settings'''
|
||||||
if (self.mode in [self.ONE_MSG_WINDOW_NEVER,
|
if (self.mode in [self.ONE_MSG_WINDOW_NEVER,
|
||||||
self.ONE_MSG_WINDOW_ALWAYS_WITH_ROSTER]):
|
self.ONE_MSG_WINDOW_ALWAYS_WITH_ROSTER]):
|
||||||
|
@ -944,14 +944,14 @@ class MessageWindowMgr(gobject.GObject):
|
||||||
pos = (gajim.config.get_per('accounts', acct, 'msgwin-x-position'),
|
pos = (gajim.config.get_per('accounts', acct, 'msgwin-x-position'),
|
||||||
gajim.config.get_per('accounts', acct, 'msgwin-y-position'))
|
gajim.config.get_per('accounts', acct, 'msgwin-y-position'))
|
||||||
elif self.mode == self.ONE_MSG_WINDOW_PERTYPE:
|
elif self.mode == self.ONE_MSG_WINDOW_PERTYPE:
|
||||||
pos = (gajim.config.get(type + '-msgwin-x-position'),
|
pos = (gajim.config.get(type_ + '-msgwin-x-position'),
|
||||||
gajim.config.get(type + '-msgwin-y-position'))
|
gajim.config.get(type_ + '-msgwin-y-position'))
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
|
||||||
gtkgui_helpers.move_window(win.window, pos[0], pos[1])
|
gtkgui_helpers.move_window(win.window, pos[0], pos[1])
|
||||||
|
|
||||||
def _mode_to_key(self, contact, acct, type, resource = None):
|
def _mode_to_key(self, contact, acct, type_, resource = None):
|
||||||
if self.mode == self.ONE_MSG_WINDOW_NEVER:
|
if self.mode == self.ONE_MSG_WINDOW_NEVER:
|
||||||
key = acct + contact.jid
|
key = acct + contact.jid
|
||||||
if resource:
|
if resource:
|
||||||
|
@ -964,22 +964,22 @@ class MessageWindowMgr(gobject.GObject):
|
||||||
elif self.mode == self.ONE_MSG_WINDOW_PERACCT:
|
elif self.mode == self.ONE_MSG_WINDOW_PERACCT:
|
||||||
return acct
|
return acct
|
||||||
elif self.mode == self.ONE_MSG_WINDOW_PERTYPE:
|
elif self.mode == self.ONE_MSG_WINDOW_PERTYPE:
|
||||||
return type
|
return type_
|
||||||
|
|
||||||
def create_window(self, contact, acct, type, resource = None):
|
def create_window(self, contact, acct, type_, resource = None):
|
||||||
win_acct = None
|
win_acct = None
|
||||||
win_type = None
|
win_type = None
|
||||||
win_role = None # X11 window role
|
win_role = None # X11 window role
|
||||||
|
|
||||||
win_key = self._mode_to_key(contact, acct, type, resource)
|
win_key = self._mode_to_key(contact, acct, type_, resource)
|
||||||
if self.mode == self.ONE_MSG_WINDOW_PERACCT:
|
if self.mode == self.ONE_MSG_WINDOW_PERACCT:
|
||||||
win_acct = acct
|
win_acct = acct
|
||||||
win_role = acct
|
win_role = acct
|
||||||
elif self.mode == self.ONE_MSG_WINDOW_PERTYPE:
|
elif self.mode == self.ONE_MSG_WINDOW_PERTYPE:
|
||||||
win_type = type
|
win_type = type_
|
||||||
win_role = type
|
win_role = type_
|
||||||
elif self.mode == self.ONE_MSG_WINDOW_NEVER:
|
elif self.mode == self.ONE_MSG_WINDOW_NEVER:
|
||||||
win_type = type
|
win_type = type_
|
||||||
win_role = contact.jid
|
win_role = contact.jid
|
||||||
elif self.mode == self.ONE_MSG_WINDOW_ALWAYS:
|
elif self.mode == self.ONE_MSG_WINDOW_ALWAYS:
|
||||||
win_role = 'messages'
|
win_role = 'messages'
|
||||||
|
@ -994,9 +994,9 @@ class MessageWindowMgr(gobject.GObject):
|
||||||
win.window.set_role(win_role)
|
win.window.set_role(win_role)
|
||||||
|
|
||||||
# Position and size window based on saved state and window mode
|
# Position and size window based on saved state and window mode
|
||||||
if not self.one_window_opened(contact, acct, type):
|
if not self.one_window_opened(contact, acct, type_):
|
||||||
self._resize_window(win, acct, type)
|
self._resize_window(win, acct, type_)
|
||||||
self._position_window(win, acct, type)
|
self._position_window(win, acct, type_)
|
||||||
|
|
||||||
self._windows[win_key] = win
|
self._windows[win_key] = win
|
||||||
return win
|
return win
|
||||||
|
@ -1039,12 +1039,12 @@ May be useful some day in the future?'''
|
||||||
return ctrl
|
return ctrl
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_controls(self, type = None, acct = None):
|
def get_controls(self, type_ = None, acct = None):
|
||||||
ctrls = []
|
ctrls = []
|
||||||
for c in self.controls():
|
for c in self.controls():
|
||||||
if acct and c.account != acct:
|
if acct and c.account != acct:
|
||||||
continue
|
continue
|
||||||
if not type or c.type_id == type:
|
if not type_ or c.type_id == type_:
|
||||||
ctrls.append(c)
|
ctrls.append(c)
|
||||||
return ctrls
|
return ctrls
|
||||||
|
|
||||||
|
|
|
@ -400,12 +400,12 @@ class NotificationResponseManager:
|
||||||
self.interface.connect_to_signal('ActionInvoked', self.on_action_invoked)
|
self.interface.connect_to_signal('ActionInvoked', self.on_action_invoked)
|
||||||
self.interface.connect_to_signal('NotificationClosed', self.on_closed)
|
self.interface.connect_to_signal('NotificationClosed', self.on_closed)
|
||||||
|
|
||||||
def on_action_invoked(self, id, reason):
|
def on_action_invoked(self, id_, reason):
|
||||||
self.received.append((id, time.time(), reason))
|
self.received.append((id_, time.time(), reason))
|
||||||
if id in self.pending:
|
if id_ in self.pending:
|
||||||
notification = self.pending[id]
|
notification = self.pending[id_]
|
||||||
notification.on_action_invoked(id, reason)
|
notification.on_action_invoked(id_, reason)
|
||||||
del self.pending[id]
|
del self.pending[id_]
|
||||||
if len(self.received) > 20:
|
if len(self.received) > 20:
|
||||||
curt = time.time()
|
curt = time.time()
|
||||||
for rec in self.received:
|
for rec in self.received:
|
||||||
|
@ -413,21 +413,21 @@ class NotificationResponseManager:
|
||||||
if diff > 10:
|
if diff > 10:
|
||||||
self.received.remove(rec)
|
self.received.remove(rec)
|
||||||
|
|
||||||
def on_closed(self, id, reason=None):
|
def on_closed(self, id_, reason=None):
|
||||||
if id in self.pending:
|
if id_ in self.pending:
|
||||||
del self.pending[id]
|
del self.pending[id_]
|
||||||
|
|
||||||
def add_pending(self, id, object):
|
def add_pending(self, id_, object_):
|
||||||
# Check to make sure that we handle an event immediately if we're adding
|
# Check to make sure that we handle an event immediately if we're adding
|
||||||
# an id that's already been triggered
|
# an id that's already been triggered
|
||||||
for rec in self.received:
|
for rec in self.received:
|
||||||
if rec[0] == id:
|
if rec[0] == id_:
|
||||||
object.on_action_invoked(id, rec[2])
|
object_.on_action_invoked(id_, rec[2])
|
||||||
self.received.remove(rec)
|
self.received.remove(rec)
|
||||||
return
|
return
|
||||||
if id not in self.pending:
|
if id_ not in self.pending:
|
||||||
# Add it
|
# Add it
|
||||||
self.pending[id] = object
|
self.pending[id_] = object_
|
||||||
else:
|
else:
|
||||||
# We've triggered an event that has a duplicate ID!
|
# We've triggered an event that has a duplicate ID!
|
||||||
gajim.log.debug('Duplicate ID of notification. Can\'t handle this.')
|
gajim.log.debug('Duplicate ID of notification. Can\'t handle this.')
|
||||||
|
@ -553,8 +553,8 @@ class DesktopNotification:
|
||||||
reply_handler=self.attach_by_id,
|
reply_handler=self.attach_by_id,
|
||||||
error_handler=self.notify_another_way)
|
error_handler=self.notify_another_way)
|
||||||
|
|
||||||
def attach_by_id(self, id):
|
def attach_by_id(self, id_):
|
||||||
self.id = id
|
self.id = id_
|
||||||
notification_response_manager.attach_to_interface()
|
notification_response_manager.attach_to_interface()
|
||||||
notification_response_manager.add_pending(self.id, self)
|
notification_response_manager.add_pending(self.id, self)
|
||||||
|
|
||||||
|
@ -562,10 +562,10 @@ class DesktopNotification:
|
||||||
gajim.log.debug(str(e))
|
gajim.log.debug(str(e))
|
||||||
gajim.log.debug('Need to implement a new way of falling back')
|
gajim.log.debug('Need to implement a new way of falling back')
|
||||||
|
|
||||||
def on_action_invoked(self, id, reason):
|
def on_action_invoked(self, id_, reason):
|
||||||
if self.notif is None:
|
if self.notif is None:
|
||||||
return
|
return
|
||||||
self.notif.CloseNotification(dbus.UInt32(id))
|
self.notif.CloseNotification(dbus.UInt32(id_))
|
||||||
self.notif = None
|
self.notif = None
|
||||||
|
|
||||||
gajim.interface.handle_event(self.account, self.jid, self.msg_type)
|
gajim.interface.handle_event(self.account, self.jid, self.msg_type)
|
||||||
|
|
|
@ -279,7 +279,7 @@ class SignalObject(dbus.service.Object):
|
||||||
return DBUS_BOOLEAN(True)
|
return DBUS_BOOLEAN(True)
|
||||||
return DBUS_BOOLEAN(False)
|
return DBUS_BOOLEAN(False)
|
||||||
|
|
||||||
def _send_message(self, jid, message, keyID, account, type = 'chat',
|
def _send_message(self, jid, message, keyID, account, type_ = 'chat',
|
||||||
subject = None):
|
subject = None):
|
||||||
'''can be called from send_chat_message (default when send_message)
|
'''can be called from send_chat_message (default when send_message)
|
||||||
or send_single_message'''
|
or send_single_message'''
|
||||||
|
@ -291,7 +291,7 @@ class SignalObject(dbus.service.Object):
|
||||||
connected_account, contact = self._get_account_and_contact(account, jid)
|
connected_account, contact = self._get_account_and_contact(account, jid)
|
||||||
if connected_account:
|
if connected_account:
|
||||||
connection = gajim.connections[connected_account]
|
connection = gajim.connections[connected_account]
|
||||||
connection.send_message(jid, message, keyID, type, subject)
|
connection.send_message(jid, message, keyID, type_, subject)
|
||||||
return DBUS_BOOLEAN(True)
|
return DBUS_BOOLEAN(True)
|
||||||
return DBUS_BOOLEAN(False)
|
return DBUS_BOOLEAN(False)
|
||||||
|
|
||||||
|
|
|
@ -38,9 +38,9 @@ import dialogs
|
||||||
import negotiation
|
import negotiation
|
||||||
|
|
||||||
class ChatControlSession(stanza_session.EncryptedStanzaSession):
|
class ChatControlSession(stanza_session.EncryptedStanzaSession):
|
||||||
def __init__(self, conn, jid, thread_id, type='chat'):
|
def __init__(self, conn, jid, thread_id, type_='chat'):
|
||||||
stanza_session.EncryptedStanzaSession.__init__(self, conn, jid, thread_id,
|
stanza_session.EncryptedStanzaSession.__init__(self, conn, jid, thread_id,
|
||||||
type='chat')
|
type_='chat')
|
||||||
|
|
||||||
self.control = None
|
self.control = None
|
||||||
|
|
||||||
|
|
|
@ -122,12 +122,12 @@ class MockContact(Mock):
|
||||||
import random
|
import random
|
||||||
|
|
||||||
class MockSession(Mock):
|
class MockSession(Mock):
|
||||||
def __init__(self, conn, jid, thread_id, type):
|
def __init__(self, conn, jid, thread_id, type_):
|
||||||
Mock.__init__(self)
|
Mock.__init__(self)
|
||||||
|
|
||||||
self.conn = conn
|
self.conn = conn
|
||||||
self.jid = jid
|
self.jid = jid
|
||||||
self.type = type
|
self.type = type_
|
||||||
self.thread_id = thread_id
|
self.thread_id = thread_id
|
||||||
|
|
||||||
if not self.thread_id:
|
if not self.thread_id:
|
||||||
|
|
|
@ -15,11 +15,11 @@ Interface()
|
||||||
class TestMiscInterface(unittest.TestCase):
|
class TestMiscInterface(unittest.TestCase):
|
||||||
|
|
||||||
def test_links_regexp_entire(self):
|
def test_links_regexp_entire(self):
|
||||||
def assert_matches_all(str):
|
def assert_matches_all(str_):
|
||||||
m = gajim.interface.basic_pattern_re.match(str)
|
m = gajim.interface.basic_pattern_re.match(str_)
|
||||||
|
|
||||||
# the match should equal the string
|
# the match should equal the string
|
||||||
str_span = (0, len(str))
|
str_span = (0, len(str_))
|
||||||
self.assertEqual(m.span(), str_span)
|
self.assertEqual(m.span(), str_span)
|
||||||
|
|
||||||
# these entire strings should be parsed as links
|
# these entire strings should be parsed as links
|
||||||
|
|
Loading…
Reference in New Issue