python uses unicode internally
This commit is contained in:
parent
e71188a6fa
commit
414e349345
|
@ -452,7 +452,7 @@ class CommandWindow:
|
||||||
|
|
||||||
note = command.getTag('note')
|
note = command.getTag('note')
|
||||||
if note:
|
if note:
|
||||||
self.notes_label.set_text(note.getData().decode('utf-8'))
|
self.notes_label.set_text(note.getData())
|
||||||
self.notes_label.set_no_show_all(False)
|
self.notes_label.set_no_show_all(False)
|
||||||
self.notes_label.show()
|
self.notes_label.show()
|
||||||
else:
|
else:
|
||||||
|
@ -510,7 +510,7 @@ class CommandWindow:
|
||||||
try:
|
try:
|
||||||
errorname = nbxmpp.NS_STANZAS + ' ' + str(errorid)
|
errorname = nbxmpp.NS_STANZAS + ' ' + str(errorid)
|
||||||
errordesc = nbxmpp.ERRORS[errorname][2]
|
errordesc = nbxmpp.ERRORS[errorname][2]
|
||||||
error = errordesc.decode('utf-8')
|
error = errordesc
|
||||||
del errorname, errordesc
|
del errorname, errordesc
|
||||||
except KeyError: # when stanza doesn't have error description
|
except KeyError: # when stanza doesn't have error description
|
||||||
error = _('Service returned an error.')
|
error = _('Service returned an error.')
|
||||||
|
|
|
@ -141,8 +141,7 @@ class AdvancedConfigurationWindow(object):
|
||||||
"""
|
"""
|
||||||
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.decode('utf-8') == 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)
|
||||||
|
@ -153,10 +152,10 @@ class AdvancedConfigurationWindow(object):
|
||||||
# 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]]
|
||||||
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])
|
||||||
parent = model.iter_parent(parent)
|
parent = model.iter_parent(parent)
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
@ -194,17 +193,17 @@ class AdvancedConfigurationWindow(object):
|
||||||
def on_advanced_treeview_row_activated(self, treeview, path, column):
|
def on_advanced_treeview_row_activated(self, treeview, path, column):
|
||||||
modelpath = self.modelfilter.convert_path_to_child_path(path)
|
modelpath = self.modelfilter.convert_path_to_child_path(path)
|
||||||
modelrow = self.model[modelpath]
|
modelrow = self.model[modelpath]
|
||||||
option = modelrow[0].decode('utf-8')
|
option = modelrow[0]
|
||||||
if modelrow[2].decode('utf-8') == self.types['boolean']:
|
if modelrow[2] == self.types['boolean']:
|
||||||
for key in self.right_true_dict.keys():
|
for key in self.right_true_dict.keys():
|
||||||
if self.right_true_dict[key] == modelrow[1].decode('utf-8'):
|
if self.right_true_dict[key] == modelrow[1]:
|
||||||
modelrow[1] = str(key)
|
modelrow[1] = str(key)
|
||||||
newval = {'False': True, 'True': False}[modelrow[1]]
|
newval = {'False': True, 'True': False}[modelrow[1]]
|
||||||
if len(modelpath.get_indices()) > 1:
|
if len(modelpath.get_indices()) > 1:
|
||||||
optnamerow = self.model[modelpath.get_indices()[0]]
|
optnamerow = self.model[modelpath.get_indices()[0]]
|
||||||
optname = optnamerow[0].decode('utf-8')
|
optname = optnamerow[0]
|
||||||
keyrow = self.model[modelpath.get_indices()[:2]]
|
keyrow = self.model[modelpath.get_indices()[:2]]
|
||||||
key = keyrow[0].decode('utf-8')
|
key = keyrow[0]
|
||||||
self.remember_option(option + '\n' + key + '\n' + optname,
|
self.remember_option(option + '\n' + key + '\n' + optname,
|
||||||
modelrow[1], newval)
|
modelrow[1], newval)
|
||||||
gajim.config.set_per(optname, key, option, newval)
|
gajim.config.set_per(optname, key, option, newval)
|
||||||
|
@ -234,13 +233,12 @@ class AdvancedConfigurationWindow(object):
|
||||||
modelpath = self.modelfilter.convert_path_to_child_path(path)
|
modelpath = self.modelfilter.convert_path_to_child_path(path)
|
||||||
modelrow = self.model[modelpath]
|
modelrow = self.model[modelpath]
|
||||||
modelpath = modelpath.get_indices()
|
modelpath = modelpath.get_indices()
|
||||||
option = modelrow[0].decode('utf-8')
|
option = modelrow[0]
|
||||||
text = text.decode('utf-8')
|
|
||||||
if len(modelpath) > 1:
|
if len(modelpath) > 1:
|
||||||
optnamerow = self.model[modelpath[0]]
|
optnamerow = self.model[modelpath[0]]
|
||||||
optname = optnamerow[0].decode('utf-8')
|
optname = optnamerow[0]
|
||||||
keyrow = self.model[modelpath[:2]]
|
keyrow = self.model[modelpath[:2]]
|
||||||
key = keyrow[0].decode('utf-8')
|
key = keyrow[0]
|
||||||
self.remember_option(option + '\n' + key + '\n' + optname, modelrow[1],
|
self.remember_option(option + '\n' + key + '\n' + optname, modelrow[1],
|
||||||
text)
|
text)
|
||||||
gajim.config.set_per(optname, key, option, text)
|
gajim.config.set_per(optname, key, option, text)
|
||||||
|
@ -269,12 +267,12 @@ class AdvancedConfigurationWindow(object):
|
||||||
return
|
return
|
||||||
modelpath = self.modelfilter.convert_path_to_child_path(path)
|
modelpath = self.modelfilter.convert_path_to_child_path(path)
|
||||||
modelrow = self.model[modelpath]
|
modelrow = self.model[modelpath]
|
||||||
option = modelrow[0].decode('utf-8')
|
option = modelrow[0]
|
||||||
if len(modelpath) > 1:
|
if len(modelpath) > 1:
|
||||||
optnamerow = self.model[modelpath[0]]
|
optnamerow = self.model[modelpath[0]]
|
||||||
optname = optnamerow[0].decode('utf-8')
|
optname = optnamerow[0]
|
||||||
keyrow = self.model[modelpath[:2]]
|
keyrow = self.model[modelpath[:2]]
|
||||||
key = keyrow[0].decode('utf-8')
|
key = keyrow[0]
|
||||||
self.remember_option(option + '\n' + key + '\n' + optname,
|
self.remember_option(option + '\n' + key + '\n' + optname,
|
||||||
modelrow[C_VALUE], default)
|
modelrow[C_VALUE], default)
|
||||||
gajim.config.set_per(optname, key, option, default)
|
gajim.config.set_per(optname, key, option, default)
|
||||||
|
@ -317,7 +315,7 @@ class AdvancedConfigurationWindow(object):
|
||||||
self.model.append(parent, [name, value, type_])
|
self.model.append(parent, [name, value, type_])
|
||||||
|
|
||||||
def visible_func(self, model, treeiter, data):
|
def visible_func(self, model, treeiter, data):
|
||||||
search_string = self.entry.get_text().decode('utf-8').lower()
|
search_string = self.entry.get_text().lower()
|
||||||
for it in tree_model_pre_order(model, treeiter):
|
for it in tree_model_pre_order(model, treeiter):
|
||||||
if model[it][C_TYPE] != '':
|
if model[it][C_TYPE] != '':
|
||||||
opt_path = self.get_option_path(model, it)
|
opt_path = self.get_option_path(model, it)
|
||||||
|
|
|
@ -84,20 +84,20 @@ class AtomWindow:
|
||||||
# fill the fields
|
# fill the fields
|
||||||
if newentry.feed_link is not None:
|
if newentry.feed_link is not None:
|
||||||
self.feed_title_label.set_markup(
|
self.feed_title_label.set_markup(
|
||||||
u'<span foreground="blue" underline="single">%s</span>' % \
|
'<span foreground="blue" underline="single">%s</span>' % \
|
||||||
GObject.markup_escape_text(newentry.feed_title))
|
GObject.markup_escape_text(newentry.feed_title))
|
||||||
else:
|
else:
|
||||||
self.feed_title_label.set_markup(
|
self.feed_title_label.set_markup(
|
||||||
GObject.markup_escape_text(newentry.feed_title))
|
GObject.markup_escape_text(newentry.feed_title))
|
||||||
|
|
||||||
self.feed_tagline_label.set_markup(
|
self.feed_tagline_label.set_markup(
|
||||||
u'<small>%s</small>' % \
|
'<small>%s</small>' % \
|
||||||
GObject.markup_escape_text(newentry.feed_tagline))
|
GObject.markup_escape_text(newentry.feed_tagline))
|
||||||
|
|
||||||
if newentry.title:
|
if newentry.title:
|
||||||
if newentry.uri is not None:
|
if newentry.uri is not None:
|
||||||
self.entry_title_label.set_markup(
|
self.entry_title_label.set_markup(
|
||||||
u'<span foreground="blue" underline="single">%s</span>' % \
|
'<span foreground="blue" underline="single">%s</span>' % \
|
||||||
GObject.markup_escape_text(newentry.title))
|
GObject.markup_escape_text(newentry.title))
|
||||||
else:
|
else:
|
||||||
self.entry_title_label.set_markup(
|
self.entry_title_label.set_markup(
|
||||||
|
|
|
@ -620,7 +620,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
message_buffer = self.msg_textview.get_buffer()
|
message_buffer = self.msg_textview.get_buffer()
|
||||||
start_iter = message_buffer.get_start_iter()
|
start_iter = message_buffer.get_start_iter()
|
||||||
end_iter = message_buffer.get_end_iter()
|
end_iter = message_buffer.get_end_iter()
|
||||||
message = message_buffer.get_text(start_iter, end_iter, False).decode('utf-8')
|
message = message_buffer.get_text(start_iter, end_iter, False)
|
||||||
xhtml = self.msg_textview.get_xhtml()
|
xhtml = self.msg_textview.get_xhtml()
|
||||||
|
|
||||||
# send the message
|
# send the message
|
||||||
|
@ -2842,7 +2842,7 @@ class ChatControl(ChatControlBase):
|
||||||
type_ = model[iter_][2]
|
type_ = model[iter_][2]
|
||||||
if type_ != 'contact': # source is not a contact
|
if type_ != 'contact': # source is not a contact
|
||||||
return
|
return
|
||||||
dropped_jid = data.decode('utf-8')
|
dropped_jid = data
|
||||||
|
|
||||||
dropped_transport = gajim.get_transport_name_from_jid(dropped_jid)
|
dropped_transport = gajim.get_transport_name_from_jid(dropped_jid)
|
||||||
c_transport = gajim.get_transport_name_from_jid(c.jid)
|
c_transport = gajim.get_transport_name_from_jid(c.jid)
|
||||||
|
|
|
@ -100,13 +100,13 @@ class OldEntry(nbxmpp.Node, object):
|
||||||
|
|
||||||
|
|
||||||
if main_feed is not None and source_feed is not None:
|
if main_feed is not None and source_feed is not None:
|
||||||
return u'%s: %s' % (main_feed, source_feed)
|
return '%s: %s' % (main_feed, source_feed)
|
||||||
elif main_feed is not None:
|
elif main_feed is not None:
|
||||||
return main_feed
|
return main_feed
|
||||||
elif source_feed is not None:
|
elif source_feed is not None:
|
||||||
return source_feed
|
return source_feed
|
||||||
else:
|
else:
|
||||||
return u''
|
return ''
|
||||||
|
|
||||||
feed_title = property(get_feed_title, None, None,
|
feed_title = property(get_feed_title, None, None,
|
||||||
''' Title of feed. It is built from entry''s original feed title and title of feed
|
''' Title of feed. It is built from entry''s original feed title and title of feed
|
||||||
|
@ -173,4 +173,4 @@ class OldEntry(nbxmpp.Node, object):
|
||||||
updated = property(get_updated, None, None,
|
updated = property(get_updated, None, None,
|
||||||
''' Last significant modification time. ''')
|
''' Last significant modification time. ''')
|
||||||
|
|
||||||
feed_tagline = u''
|
feed_tagline = ''
|
||||||
|
|
|
@ -133,11 +133,11 @@ def split_db():
|
||||||
try:
|
try:
|
||||||
import configpaths
|
import configpaths
|
||||||
OLD_LOG_DB_FOLDER = os.path.join(configpaths.fse(
|
OLD_LOG_DB_FOLDER = os.path.join(configpaths.fse(
|
||||||
os.environ[u'appdata']), u'Gajim')
|
os.environ['appdata']), 'Gajim')
|
||||||
except KeyError:
|
except KeyError:
|
||||||
OLD_LOG_DB_FOLDER = u'.'
|
OLD_LOG_DB_FOLDER = '.'
|
||||||
else:
|
else:
|
||||||
OLD_LOG_DB_FOLDER = os.path.expanduser(u'~/.gajim')
|
OLD_LOG_DB_FOLDER = os.path.expanduser('~/.gajim')
|
||||||
|
|
||||||
tmp = logger.CACHE_DB_PATH
|
tmp = logger.CACHE_DB_PATH
|
||||||
logger.CACHE_DB_PATH = os.path.join(OLD_LOG_DB_FOLDER, 'cache.db')
|
logger.CACHE_DB_PATH = os.path.join(OLD_LOG_DB_FOLDER, 'cache.db')
|
||||||
|
@ -148,7 +148,7 @@ def split_db():
|
||||||
os.chdir(back)
|
os.chdir(back)
|
||||||
cur = con.cursor()
|
cur = con.cursor()
|
||||||
cur.execute('''SELECT name FROM sqlite_master WHERE type = 'table';''')
|
cur.execute('''SELECT name FROM sqlite_master WHERE type = 'table';''')
|
||||||
tables = cur.fetchall() # we get [(u'jids',), (u'unread_messages',), ...
|
tables = cur.fetchall() # we get [('jids',), ('unread_messages',), ...
|
||||||
tables = [t[0] for t in tables]
|
tables = [t[0] for t in tables]
|
||||||
cur.execute("ATTACH DATABASE '%s' AS cache" % logger.CACHE_DB_PATH)
|
cur.execute("ATTACH DATABASE '%s' AS cache" % logger.CACHE_DB_PATH)
|
||||||
for table in ('caps_cache', 'rooms_last_message_time', 'roster_entry',
|
for table in ('caps_cache', 'rooms_last_message_time', 'roster_entry',
|
||||||
|
@ -189,22 +189,22 @@ def check_and_possibly_move_config():
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
try:
|
try:
|
||||||
OLD_LOG_DB_FOLDER = os.path.join(configpaths.fse(
|
OLD_LOG_DB_FOLDER = os.path.join(configpaths.fse(
|
||||||
os.environ[u'appdata']), u'Gajim')
|
os.environ['appdata']), 'Gajim')
|
||||||
except KeyError:
|
except KeyError:
|
||||||
OLD_LOG_DB_FOLDER = u'.'
|
OLD_LOG_DB_FOLDER = '.'
|
||||||
else:
|
else:
|
||||||
OLD_LOG_DB_FOLDER = os.path.expanduser(u'~/.gajim')
|
OLD_LOG_DB_FOLDER = os.path.expanduser('~/.gajim')
|
||||||
if not os.path.exists(OLD_LOG_DB_FOLDER):
|
if not os.path.exists(OLD_LOG_DB_FOLDER):
|
||||||
return
|
return
|
||||||
OLD_LOG_DB_PATH = os.path.join(OLD_LOG_DB_FOLDER, u'logs.db')
|
OLD_LOG_DB_PATH = os.path.join(OLD_LOG_DB_FOLDER, 'logs.db')
|
||||||
OLD_CACHE_DB_PATH = os.path.join(OLD_LOG_DB_FOLDER, u'cache.db')
|
OLD_CACHE_DB_PATH = os.path.join(OLD_LOG_DB_FOLDER, 'cache.db')
|
||||||
vars['OLD_VCARD_PATH'] = os.path.join(OLD_LOG_DB_FOLDER, u'vcards')
|
vars['OLD_VCARD_PATH'] = os.path.join(OLD_LOG_DB_FOLDER, 'vcards')
|
||||||
vars['OLD_AVATAR_PATH'] = os.path.join(OLD_LOG_DB_FOLDER, u'avatars')
|
vars['OLD_AVATAR_PATH'] = os.path.join(OLD_LOG_DB_FOLDER, 'avatars')
|
||||||
vars['OLD_MY_EMOTS_PATH'] = os.path.join(OLD_LOG_DB_FOLDER, u'emoticons')
|
vars['OLD_MY_EMOTS_PATH'] = os.path.join(OLD_LOG_DB_FOLDER, 'emoticons')
|
||||||
vars['OLD_MY_ICONSETS_PATH'] = os.path.join(OLD_LOG_DB_FOLDER, u'iconsets')
|
vars['OLD_MY_ICONSETS_PATH'] = os.path.join(OLD_LOG_DB_FOLDER, 'iconsets')
|
||||||
vars['OLD_MY_MOOD_ICONSETS_PATH'] = os.path.join(OLD_LOG_DB_FOLDER, u'moods')
|
vars['OLD_MY_MOOD_ICONSETS_PATH'] = os.path.join(OLD_LOG_DB_FOLDER, 'moods')
|
||||||
vars['OLD_MY_ACTIVITY_ICONSETS_PATH'] = os.path.join(OLD_LOG_DB_FOLDER,
|
vars['OLD_MY_ACTIVITY_ICONSETS_PATH'] = os.path.join(OLD_LOG_DB_FOLDER,
|
||||||
u'activities')
|
'activities')
|
||||||
OLD_CONFIG_FILES = []
|
OLD_CONFIG_FILES = []
|
||||||
OLD_DATA_FILES = []
|
OLD_DATA_FILES = []
|
||||||
for f in os.listdir(OLD_LOG_DB_FOLDER):
|
for f in os.listdir(OLD_LOG_DB_FOLDER):
|
||||||
|
@ -345,7 +345,7 @@ def check_and_possibly_create_paths():
|
||||||
print(_('%s is a directory but should be a file') % CACHE_DB_PATH)
|
print(_('%s is a directory but should be a file') % CACHE_DB_PATH)
|
||||||
print(_('Gajim will now exit'))
|
print(_('Gajim will now exit'))
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
if not os.path.exists(XTLS_CERTS):
|
if not os.path.exists(XTLS_CERTS):
|
||||||
create_path(XTLS_CERTS)
|
create_path(XTLS_CERTS)
|
||||||
if not os.path.exists(LOCAL_XTLS_CERTS):
|
if not os.path.exists(LOCAL_XTLS_CERTS):
|
||||||
|
|
|
@ -104,12 +104,12 @@ class ChangeStatusCommand(AdHocCommand):
|
||||||
var = 'presence-type',
|
var = 'presence-type',
|
||||||
label = 'Type of presence:',
|
label = 'Type of presence:',
|
||||||
options = [
|
options = [
|
||||||
(u'chat', _('Free for chat')),
|
('chat', _('Free for chat')),
|
||||||
(u'online', _('Online')),
|
('online', _('Online')),
|
||||||
(u'away', _('Away')),
|
('away', _('Away')),
|
||||||
(u'xa', _('Extended away')),
|
('xa', _('Extended away')),
|
||||||
(u'dnd', _('Do not disturb')),
|
('dnd', _('Do not disturb')),
|
||||||
(u'offline', _('Offline - disconnect'))],
|
('offline', _('Offline - disconnect'))],
|
||||||
value = 'online',
|
value = 'online',
|
||||||
required = True),
|
required = True),
|
||||||
dataforms.Field('text-multi',
|
dataforms.Field('text-multi',
|
||||||
|
@ -146,7 +146,7 @@ class ChangeStatusCommand(AdHocCommand):
|
||||||
try:
|
try:
|
||||||
presencedesc = form['presence-desc'].value
|
presencedesc = form['presence-desc'].value
|
||||||
except Exception: # same exceptions as in last comment
|
except Exception: # same exceptions as in last comment
|
||||||
presencedesc = u''
|
presencedesc = ''
|
||||||
|
|
||||||
response, cmd = self.buildResponse(request, status = 'completed')
|
response, cmd = self.buildResponse(request, status = 'completed')
|
||||||
cmd.addChild('note', {}, _('The status has been changed.'))
|
cmd.addChild('note', {}, _('The status has been changed.'))
|
||||||
|
@ -197,7 +197,7 @@ class LeaveGroupchatsCommand(AdHocCommand):
|
||||||
options = []
|
options = []
|
||||||
account = self.connection.name
|
account = self.connection.name
|
||||||
for gc in find_current_groupchats(account):
|
for gc in find_current_groupchats(account):
|
||||||
options.append((u'%s' %(gc[0]), _('%(nickname)s on %(room_jid)s') % \
|
options.append(('%s' %(gc[0]), _('%(nickname)s on %(room_jid)s') % \
|
||||||
{'nickname': gc[1], 'room_jid': gc[0]}))
|
{'nickname': gc[1], 'room_jid': gc[0]}))
|
||||||
if not len(options):
|
if not len(options):
|
||||||
response, cmd = self.buildResponse(request, status = 'completed')
|
response, cmd = self.buildResponse(request, status = 'completed')
|
||||||
|
@ -367,7 +367,7 @@ class ConnectionCommands:
|
||||||
if cmd.isVisibleFor(self.isSameJID(jid)):
|
if cmd.isVisibleFor(self.isSameJID(jid)):
|
||||||
q.addChild('item', {
|
q.addChild('item', {
|
||||||
# TODO: find the jid
|
# TODO: find the jid
|
||||||
'jid': self.getOurBareJID() + u'/' + self.server_resource,
|
'jid': self.getOurBareJID() + '/' + self.server_resource,
|
||||||
'node': node,
|
'node': node,
|
||||||
'name': cmd.commandname})
|
'name': cmd.commandname})
|
||||||
|
|
||||||
|
|
|
@ -82,10 +82,10 @@ class ConfigPaths:
|
||||||
# variable 'appdata' is in? Assuming it to be in filesystem
|
# variable 'appdata' is in? Assuming it to be in filesystem
|
||||||
# encoding.
|
# encoding.
|
||||||
self.config_root = self.cache_root = self.data_root = \
|
self.config_root = self.cache_root = self.data_root = \
|
||||||
os.path.join(fse(os.environ[u'appdata']), u'Gajim')
|
os.path.join(fse(os.environ['appdata']), 'Gajim')
|
||||||
except KeyError:
|
except KeyError:
|
||||||
# win9x, in cwd
|
# win9x, in cwd
|
||||||
self.config_root = self.cache_root = self.data_root = u'.'
|
self.config_root = self.cache_root = self.data_root = '.'
|
||||||
else: # Unices
|
else: # Unices
|
||||||
# Pass in an Unicode string, and hopefully get one back.
|
# Pass in an Unicode string, and hopefully get one back.
|
||||||
if HAVE_XDG:
|
if HAVE_XDG:
|
||||||
|
@ -93,23 +93,23 @@ class ConfigPaths:
|
||||||
if not self.config_root:
|
if not self.config_root:
|
||||||
# Folder doesn't exist yet.
|
# Folder doesn't exist yet.
|
||||||
self.config_root = os.path.join(xdg.BaseDirectory.\
|
self.config_root = os.path.join(xdg.BaseDirectory.\
|
||||||
xdg_config_dirs[0], u'gajim')
|
xdg_config_dirs[0], 'gajim')
|
||||||
|
|
||||||
self.cache_root = os.path.join(xdg.BaseDirectory.xdg_cache_home,
|
self.cache_root = os.path.join(xdg.BaseDirectory.xdg_cache_home,
|
||||||
u'gajim')
|
'gajim')
|
||||||
|
|
||||||
self.data_root = xdg.BaseDirectory.save_data_path('gajim')
|
self.data_root = xdg.BaseDirectory.save_data_path('gajim')
|
||||||
if not self.data_root:
|
if not self.data_root:
|
||||||
self.data_root = os.path.join(xdg.BaseDirectory.\
|
self.data_root = os.path.join(xdg.BaseDirectory.\
|
||||||
xdg_data_dirs[0], u'gajim')
|
xdg_data_dirs[0], 'gajim')
|
||||||
else:
|
else:
|
||||||
expand = os.path.expanduser
|
expand = os.path.expanduser
|
||||||
base = os.getenv('XDG_CONFIG_HOME') or expand(u'~/.config')
|
base = os.getenv('XDG_CONFIG_HOME') or expand('~/.config')
|
||||||
self.config_root = os.path.join(base, u'gajim')
|
self.config_root = os.path.join(base, 'gajim')
|
||||||
base = os.getenv('XDG_CACHE_HOME') or expand(u'~/.cache')
|
base = os.getenv('XDG_CACHE_HOME') or expand('~/.cache')
|
||||||
self.cache_root = os.path.join(base, u'gajim')
|
self.cache_root = os.path.join(base, 'gajim')
|
||||||
base = os.getenv('XDG_DATA_HOME') or expand(u'~/.local/share')
|
base = os.getenv('XDG_DATA_HOME') or expand('~/.local/share')
|
||||||
self.data_root = os.path.join(base, u'gajim')
|
self.data_root = os.path.join(base, 'gajim')
|
||||||
|
|
||||||
def add(self, name, type_, path):
|
def add(self, name, type_, path):
|
||||||
self.paths[name] = (type_, path)
|
self.paths[name] = (type_, path)
|
||||||
|
@ -138,27 +138,27 @@ class ConfigPaths:
|
||||||
if root is not None:
|
if root is not None:
|
||||||
self.config_root = self.cache_root = self.data_root = root
|
self.config_root = self.cache_root = self.data_root = root
|
||||||
|
|
||||||
d = {'MY_DATA': '', 'LOG_DB': u'logs.db', 'MY_CACERTS': u'cacerts.pem',
|
d = {'MY_DATA': '', 'LOG_DB': 'logs.db', 'MY_CACERTS': 'cacerts.pem',
|
||||||
'MY_EMOTS': u'emoticons', 'MY_ICONSETS': u'iconsets',
|
'MY_EMOTS': 'emoticons', 'MY_ICONSETS': 'iconsets',
|
||||||
'MY_MOOD_ICONSETS': u'moods', 'MY_ACTIVITY_ICONSETS': u'activities',
|
'MY_MOOD_ICONSETS': 'moods', 'MY_ACTIVITY_ICONSETS': 'activities',
|
||||||
'PLUGINS_USER': u'plugins', 'MY_PEER_CERTS': u'certs'}
|
'PLUGINS_USER': 'plugins', 'MY_PEER_CERTS': 'certs'}
|
||||||
for name in d:
|
for name in d:
|
||||||
self.add(name, TYPE_DATA, windowsify(d[name]))
|
self.add(name, TYPE_DATA, windowsify(d[name]))
|
||||||
|
|
||||||
d = {'MY_CACHE': '', 'CACHE_DB': u'cache.db', 'VCARD': u'vcards',
|
d = {'MY_CACHE': '', 'CACHE_DB': 'cache.db', 'VCARD': 'vcards',
|
||||||
'AVATAR': u'avatars'}
|
'AVATAR': 'avatars'}
|
||||||
for name in d:
|
for name in d:
|
||||||
self.add(name, TYPE_CACHE, windowsify(d[name]))
|
self.add(name, TYPE_CACHE, windowsify(d[name]))
|
||||||
|
|
||||||
self.add('MY_CONFIG', TYPE_CONFIG, '')
|
self.add('MY_CONFIG', TYPE_CONFIG, '')
|
||||||
self.add('MY_CERT', TYPE_CONFIG, '')
|
self.add('MY_CERT', TYPE_CONFIG, '')
|
||||||
|
|
||||||
basedir = fse(os.environ.get(u'GAJIM_BASEDIR', defs.basedir))
|
basedir = fse(os.environ.get('GAJIM_BASEDIR', defs.basedir))
|
||||||
self.add('DATA', None, os.path.join(basedir, windowsify(u'data')))
|
self.add('DATA', None, os.path.join(basedir, windowsify('data')))
|
||||||
self.add('ICONS', None, os.path.join(basedir, windowsify(u'icons')))
|
self.add('ICONS', None, os.path.join(basedir, windowsify('icons')))
|
||||||
self.add('HOME', None, fse(os.path.expanduser('~')))
|
self.add('HOME', None, fse(os.path.expanduser('~')))
|
||||||
self.add('PLUGINS_BASE', None, os.path.join(basedir,
|
self.add('PLUGINS_BASE', None, os.path.join(basedir,
|
||||||
windowsify(u'plugins')))
|
windowsify('plugins')))
|
||||||
try:
|
try:
|
||||||
self.add('TMP', None, fse(tempfile.gettempdir()))
|
self.add('TMP', None, fse(tempfile.gettempdir()))
|
||||||
except IOError, e:
|
except IOError, e:
|
||||||
|
@ -173,17 +173,17 @@ class ConfigPaths:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def init_profile(self, profile=''):
|
def init_profile(self, profile=''):
|
||||||
conffile = windowsify(u'config')
|
conffile = windowsify('config')
|
||||||
pidfile = windowsify(u'gajim')
|
pidfile = windowsify('gajim')
|
||||||
secretsfile = windowsify(u'secrets')
|
secretsfile = windowsify('secrets')
|
||||||
pluginsconfdir = windowsify(u'pluginsconfig')
|
pluginsconfdir = windowsify('pluginsconfig')
|
||||||
|
|
||||||
if len(profile) > 0:
|
if len(profile) > 0:
|
||||||
conffile += u'.' + profile
|
conffile += '.' + profile
|
||||||
pidfile += u'.' + profile
|
pidfile += '.' + profile
|
||||||
secretsfile += u'.' + profile
|
secretsfile += '.' + profile
|
||||||
pluginsconfdir += u'.' + profile
|
pluginsconfdir += '.' + profile
|
||||||
pidfile += u'.pid'
|
pidfile += '.pid'
|
||||||
self.add('CONFIG_FILE', TYPE_CONFIG, conffile)
|
self.add('CONFIG_FILE', TYPE_CONFIG, conffile)
|
||||||
self.add('PID_FILE', TYPE_CACHE, pidfile)
|
self.add('PID_FILE', TYPE_CACHE, pidfile)
|
||||||
self.add('SECRETS_FILE', TYPE_DATA, secretsfile)
|
self.add('SECRETS_FILE', TYPE_DATA, secretsfile)
|
||||||
|
|
|
@ -1017,7 +1017,7 @@ class ConnectionHandlersBase:
|
||||||
gc_contact = gajim.contacts.get_gc_contact(self.name, obj.jid, nick)
|
gc_contact = gajim.contacts.get_gc_contact(self.name, obj.jid, nick)
|
||||||
if obj.receipt_request_tag and gajim.config.get_per('accounts',
|
if obj.receipt_request_tag and gajim.config.get_per('accounts',
|
||||||
self.name, 'answer_receipts') and ((contact and contact.sub \
|
self.name, 'answer_receipts') and ((contact and contact.sub \
|
||||||
not in (u'to', u'none')) or gc_contact) and obj.mtype != 'error':
|
not in ('to', 'none')) or gc_contact) and obj.mtype != 'error':
|
||||||
receipt = nbxmpp.Message(to=obj.fjid, typ='chat')
|
receipt = nbxmpp.Message(to=obj.fjid, typ='chat')
|
||||||
receipt.setID(obj.id_)
|
receipt.setID(obj.id_)
|
||||||
receipt.setTag('received', namespace='urn:xmpp:receipts',
|
receipt.setTag('received', namespace='urn:xmpp:receipts',
|
||||||
|
|
|
@ -195,7 +195,7 @@ class DataField(ExtendedNode):
|
||||||
Human-readable description of field meaning
|
Human-readable description of field meaning
|
||||||
"""
|
"""
|
||||||
def fget(self):
|
def fget(self):
|
||||||
return self.getTagData('desc') or u''
|
return self.getTagData('desc') or ''
|
||||||
|
|
||||||
def fset(self, value):
|
def fset(self, value):
|
||||||
assert isinstance(value, basestring)
|
assert isinstance(value, basestring)
|
||||||
|
@ -348,7 +348,7 @@ class StringField(DataField):
|
||||||
Value of field. May be any unicode string
|
Value of field. May be any unicode string
|
||||||
"""
|
"""
|
||||||
def fget(self):
|
def fget(self):
|
||||||
return self.getTagData('value') or u''
|
return self.getTagData('value') or ''
|
||||||
|
|
||||||
def fset(self, value):
|
def fset(self, value):
|
||||||
assert isinstance(value, basestring)
|
assert isinstance(value, basestring)
|
||||||
|
@ -494,7 +494,7 @@ class TextMultiField(DataField):
|
||||||
Value held in field
|
Value held in field
|
||||||
"""
|
"""
|
||||||
def fget(self):
|
def fget(self):
|
||||||
value = u''
|
value = ''
|
||||||
for element in self.iterTags('value'):
|
for element in self.iterTags('value'):
|
||||||
value += '\n' + element.getData()
|
value += '\n' + element.getData()
|
||||||
return value[1:]
|
return value[1:]
|
||||||
|
@ -643,7 +643,7 @@ class DataForm(ExtendedNode):
|
||||||
"""
|
"""
|
||||||
# TODO: the same code is in TextMultiField. join them
|
# TODO: the same code is in TextMultiField. join them
|
||||||
def fget(self):
|
def fget(self):
|
||||||
value = u''
|
value = ''
|
||||||
for valuenode in self.getTags('instructions'):
|
for valuenode in self.getTags('instructions'):
|
||||||
value += '\n' + valuenode.getData()
|
value += '\n' + valuenode.getData()
|
||||||
return value[1:]
|
return value[1:]
|
||||||
|
|
|
@ -144,7 +144,7 @@ def parse_resource(resource):
|
||||||
if resource:
|
if resource:
|
||||||
try:
|
try:
|
||||||
from nbxmpp.stringprepare import resourceprep
|
from nbxmpp.stringprepare import resourceprep
|
||||||
return resourceprep.prepare(unicode(resource))
|
return resourceprep.prepare(resource)
|
||||||
except UnicodeError:
|
except UnicodeError:
|
||||||
raise InvalidFormat, 'Invalid character in resource.'
|
raise InvalidFormat, 'Invalid character in resource.'
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ def prep(user, server, resource):
|
||||||
raise InvalidFormat, _('Username must be between 1 and 1023 chars')
|
raise InvalidFormat, _('Username must be between 1 and 1023 chars')
|
||||||
try:
|
try:
|
||||||
from nbxmpp.stringprepare import nodeprep
|
from nbxmpp.stringprepare import nodeprep
|
||||||
user = nodeprep.prepare(unicode(user))
|
user = nodeprep.prepare(unicode(user)).encode('utf-8')
|
||||||
except UnicodeError:
|
except UnicodeError:
|
||||||
raise InvalidFormat, _('Invalid character in username.')
|
raise InvalidFormat, _('Invalid character in username.')
|
||||||
else:
|
else:
|
||||||
|
@ -170,7 +170,7 @@ def prep(user, server, resource):
|
||||||
raise InvalidFormat, _('Server must be between 1 and 1023 chars')
|
raise InvalidFormat, _('Server must be between 1 and 1023 chars')
|
||||||
try:
|
try:
|
||||||
from nbxmpp.stringprepare import nameprep
|
from nbxmpp.stringprepare import nameprep
|
||||||
server = nameprep.prepare(unicode(server))
|
server = nameprep.prepare(unicode(server)).encode('utf-8')
|
||||||
except UnicodeError:
|
except UnicodeError:
|
||||||
raise InvalidFormat, _('Invalid character in hostname.')
|
raise InvalidFormat, _('Invalid character in hostname.')
|
||||||
else:
|
else:
|
||||||
|
@ -181,7 +181,7 @@ def prep(user, server, resource):
|
||||||
raise InvalidFormat, _('Resource must be between 1 and 1023 chars')
|
raise InvalidFormat, _('Resource must be between 1 and 1023 chars')
|
||||||
try:
|
try:
|
||||||
from nbxmpp.stringprepare import resourceprep
|
from nbxmpp.stringprepare import resourceprep
|
||||||
resource = resourceprep.prepare(unicode(resource))
|
resource = resourceprep.prepare(unicode(resource)).encode('utf-8')
|
||||||
except UnicodeError:
|
except UnicodeError:
|
||||||
raise InvalidFormat, _('Invalid character in resource.')
|
raise InvalidFormat, _('Invalid character in resource.')
|
||||||
else:
|
else:
|
||||||
|
@ -264,7 +264,7 @@ def get_uf_show(show, use_mnemonic = False):
|
||||||
uf_show = Q_('?contact has status:Unknown')
|
uf_show = Q_('?contact has status:Unknown')
|
||||||
else:
|
else:
|
||||||
uf_show = Q_('?contact has status:Has errors')
|
uf_show = Q_('?contact has status:Has errors')
|
||||||
return unicode(uf_show)
|
return uf_show
|
||||||
|
|
||||||
def get_uf_sub(sub):
|
def get_uf_sub(sub):
|
||||||
if sub == 'none':
|
if sub == 'none':
|
||||||
|
@ -278,7 +278,7 @@ def get_uf_sub(sub):
|
||||||
else:
|
else:
|
||||||
uf_sub = sub
|
uf_sub = sub
|
||||||
|
|
||||||
return unicode(uf_sub)
|
return uf_sub
|
||||||
|
|
||||||
def get_uf_ask(ask):
|
def get_uf_ask(ask):
|
||||||
if ask is None:
|
if ask is None:
|
||||||
|
@ -288,7 +288,7 @@ def get_uf_ask(ask):
|
||||||
else:
|
else:
|
||||||
uf_ask = ask
|
uf_ask = ask
|
||||||
|
|
||||||
return unicode(uf_ask)
|
return uf_ask
|
||||||
|
|
||||||
def get_uf_role(role, plural = False):
|
def get_uf_role(role, plural = False):
|
||||||
''' plural determines if you get Moderators or Moderator'''
|
''' plural determines if you get Moderators or Moderator'''
|
||||||
|
@ -577,9 +577,6 @@ def reduce_chars_newlines(text, max_chars = 0, max_lines = 0):
|
||||||
string = string[:max_chars - 3] + '...'
|
string = string[:max_chars - 3] + '...'
|
||||||
return string
|
return string
|
||||||
|
|
||||||
if isinstance(text, str):
|
|
||||||
text = text.decode('utf-8')
|
|
||||||
|
|
||||||
if max_lines == 0:
|
if max_lines == 0:
|
||||||
lines = text.split('\n')
|
lines = text.split('\n')
|
||||||
else:
|
else:
|
||||||
|
@ -1431,7 +1428,7 @@ def get_proxy_info(account):
|
||||||
login = ['', '']
|
login = ['', '']
|
||||||
addr = env_http_proxy[0].split(':')
|
addr = env_http_proxy[0].split(':')
|
||||||
|
|
||||||
proxy = {'host': addr[0], 'type' : u'http', 'user':login[0]}
|
proxy = {'host': addr[0], 'type' : 'http', 'user':login[0]}
|
||||||
|
|
||||||
if len(addr) == 2:
|
if len(addr) == 2:
|
||||||
proxy['port'] = addr[1]
|
proxy['port'] = addr[1]
|
||||||
|
@ -1442,7 +1439,7 @@ def get_proxy_info(account):
|
||||||
proxy['pass'] = login[1]
|
proxy['pass'] = login[1]
|
||||||
proxy['useauth'] = True
|
proxy['useauth'] = True
|
||||||
else:
|
else:
|
||||||
proxy['pass'] = u''
|
proxy['pass'] = ''
|
||||||
return proxy
|
return proxy
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
|
@ -37,11 +37,11 @@ def paragraph_direction_mark(text):
|
||||||
for char in text:
|
for char in text:
|
||||||
bidi = unicodedata.bidirectional(char)
|
bidi = unicodedata.bidirectional(char)
|
||||||
if bidi == 'L':
|
if bidi == 'L':
|
||||||
return u'\u200E'
|
return '\u200E'
|
||||||
elif bidi == 'AL' or bidi == 'R':
|
elif bidi == 'AL' or bidi == 'R':
|
||||||
return u'\u200F'
|
return '\u200F'
|
||||||
|
|
||||||
return u'\u200E'
|
return '\u200E'
|
||||||
|
|
||||||
APP = 'gajim'
|
APP = 'gajim'
|
||||||
DIR = defs.localedir
|
DIR = defs.localedir
|
||||||
|
@ -61,7 +61,7 @@ if os.name == 'nt':
|
||||||
if lang:
|
if lang:
|
||||||
os.environ['LANG'] = lang
|
os.environ['LANG'] = lang
|
||||||
|
|
||||||
gettext.install(APP, DIR, unicode = True)
|
gettext.install(APP, DIR, unicode=False)
|
||||||
if gettext._translations:
|
if gettext._translations:
|
||||||
_translation = gettext._translations.values()[0]
|
_translation = gettext._translations.values()[0]
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -53,7 +53,7 @@ def kwallet_get(folder, entry):
|
||||||
"-e", entry.encode('utf-8')], stdout=subprocess.PIPE)
|
"-e", entry.encode('utf-8')], stdout=subprocess.PIPE)
|
||||||
pw = p.communicate()[0]
|
pw = p.communicate()[0]
|
||||||
if p.returncode == 0:
|
if p.returncode == 0:
|
||||||
return unicode(pw.decode('utf-8'))
|
return pw
|
||||||
if p.returncode == 1 or p.returncode == 4:
|
if p.returncode == 1 or p.returncode == 4:
|
||||||
# ENOENT
|
# ENOENT
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -188,7 +188,7 @@ class Logger:
|
||||||
def get_jids_already_in_db(self):
|
def get_jids_already_in_db(self):
|
||||||
try:
|
try:
|
||||||
self.cur.execute('SELECT jid FROM jids')
|
self.cur.execute('SELECT jid FROM jids')
|
||||||
# list of tupples: [(u'aaa@bbb',), (u'cc@dd',)]
|
# list of tupples: [('aaa@bbb',), ('cc@dd',)]
|
||||||
rows = self.cur.fetchall()
|
rows = self.cur.fetchall()
|
||||||
except sqlite.DatabaseError:
|
except sqlite.DatabaseError:
|
||||||
raise exceptions.DatabaseMalformed
|
raise exceptions.DatabaseMalformed
|
||||||
|
@ -1048,6 +1048,8 @@ class Logger:
|
||||||
FROM roster_entry re, jids j
|
FROM roster_entry re, jids j
|
||||||
WHERE re.account_jid_id=? AND j.jid_id=re.jid_id''', (account_jid_id,))
|
WHERE re.account_jid_id=? AND j.jid_id=re.jid_id''', (account_jid_id,))
|
||||||
for jid, jid_id, name, subscription, ask in self.cur:
|
for jid, jid_id, name, subscription, ask in self.cur:
|
||||||
|
jid = jid.encode('utf-8')
|
||||||
|
name = name.encode('utf-8')
|
||||||
data[jid] = {}
|
data[jid] = {}
|
||||||
if name:
|
if name:
|
||||||
data[jid]['name'] = name
|
data[jid]['name'] = name
|
||||||
|
@ -1071,6 +1073,7 @@ class Logger:
|
||||||
WHERE account_jid_id=? AND jid_id=?''',
|
WHERE account_jid_id=? AND jid_id=?''',
|
||||||
(account_jid_id, data[jid]['id']))
|
(account_jid_id, data[jid]['id']))
|
||||||
for (group_name,) in self.cur:
|
for (group_name,) in self.cur:
|
||||||
|
group_name = group_name.encode('utf-8')
|
||||||
data[jid]['groups'].append(group_name)
|
data[jid]['groups'].append(group_name)
|
||||||
del data[jid]['id']
|
del data[jid]['id']
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ class OptionsParser:
|
||||||
|
|
||||||
for line in fd:
|
for line in fd:
|
||||||
try:
|
try:
|
||||||
line = line.decode('utf-8')
|
line = helpers.ensure_utf8_string(line)
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
line = line.decode(locale.getpreferredencoding())
|
line = line.decode(locale.getpreferredencoding())
|
||||||
optname, key, subname, value = regex.match(line).groups()
|
optname, key, subname, value = regex.match(line).groups()
|
||||||
|
@ -715,7 +715,7 @@ class OptionsParser:
|
||||||
"""
|
"""
|
||||||
dirs = ['../data', gajim.gajimpaths.data_root, gajim.DATA_DIR]
|
dirs = ['../data', gajim.gajimpaths.data_root, gajim.DATA_DIR]
|
||||||
if os.name != 'nt':
|
if os.name != 'nt':
|
||||||
dirs.append(os.path.expanduser(u'~/.gajim'))
|
dirs.append(os.path.expanduser('~/.gajim'))
|
||||||
for evt in gajim.config.get_per('soundevents'):
|
for evt in gajim.config.get_per('soundevents'):
|
||||||
path = gajim.config.get_per('soundevents', evt, 'path')
|
path = gajim.config.get_per('soundevents', evt, 'path')
|
||||||
# absolute and relative passes are necessary
|
# absolute and relative passes are necessary
|
||||||
|
|
|
@ -120,7 +120,7 @@ else:
|
||||||
# in the JEP
|
# in the JEP
|
||||||
# == u"\u00a0"
|
# == u"\u00a0"
|
||||||
self.pub.writer.translator_class.attribution_formats['dash'] = (
|
self.pub.writer.translator_class.attribution_formats['dash'] = (
|
||||||
u'\u2014', '')
|
'\u2014', '')
|
||||||
self.pub.process_programmatic_settings(settings_spec,
|
self.pub.process_programmatic_settings(settings_spec,
|
||||||
settings_overrides,
|
settings_overrides,
|
||||||
config_section)
|
config_section)
|
||||||
|
@ -137,7 +137,7 @@ else:
|
||||||
output = self.pub.publish(enable_exit_status=enable_exit_status)
|
output = self.pub.publish(enable_exit_status=enable_exit_status)
|
||||||
# kludge until we can get docutils to stop generating (rare)
|
# kludge until we can get docutils to stop generating (rare)
|
||||||
# entities
|
# entities
|
||||||
return u'\u00a0'.join(self.pub.writer.parts['fragment'].strip().split(
|
return '\u00a0'.join(self.pub.writer.parts['fragment'].strip().split(
|
||||||
' '))
|
' '))
|
||||||
|
|
||||||
Generator = HTMLGenerator()
|
Generator = HTMLGenerator()
|
||||||
|
|
133
src/config.py
133
src/config.py
|
@ -684,7 +684,7 @@ class PreferencesWindow:
|
||||||
def on_emoticons_combobox_changed(self, widget):
|
def on_emoticons_combobox_changed(self, widget):
|
||||||
active = widget.get_active()
|
active = widget.get_active()
|
||||||
model = widget.get_model()
|
model = widget.get_model()
|
||||||
emot_theme = model[active][0].decode('utf-8')
|
emot_theme = model[active][0]
|
||||||
if emot_theme == _('Disabled'):
|
if emot_theme == _('Disabled'):
|
||||||
gajim.config.set('emoticons_theme', '')
|
gajim.config.set('emoticons_theme', '')
|
||||||
else:
|
else:
|
||||||
|
@ -770,7 +770,7 @@ class PreferencesWindow:
|
||||||
def on_theme_combobox_changed(self, widget):
|
def on_theme_combobox_changed(self, widget):
|
||||||
model = widget.get_model()
|
model = widget.get_model()
|
||||||
active = widget.get_active()
|
active = widget.get_active()
|
||||||
config_theme = model[active][0].decode('utf-8').replace(' ', '_')
|
config_theme = model[active][0].replace(' ', '_')
|
||||||
|
|
||||||
gajim.config.set('roster_theme', config_theme)
|
gajim.config.set('roster_theme', config_theme)
|
||||||
|
|
||||||
|
@ -800,7 +800,7 @@ class PreferencesWindow:
|
||||||
def on_iconset_combobox_changed(self, widget):
|
def on_iconset_combobox_changed(self, widget):
|
||||||
model = widget.get_model()
|
model = widget.get_model()
|
||||||
active = widget.get_active()
|
active = widget.get_active()
|
||||||
icon_string = model[active][1].decode('utf-8')
|
icon_string = model[active][1]
|
||||||
gajim.config.set('iconset', icon_string)
|
gajim.config.set('iconset', icon_string)
|
||||||
gtkgui_helpers.reload_jabber_state_images()
|
gtkgui_helpers.reload_jabber_state_images()
|
||||||
|
|
||||||
|
@ -1019,7 +1019,7 @@ class PreferencesWindow:
|
||||||
gajim.config.get('autoxatime') * 60)
|
gajim.config.get('autoxatime') * 60)
|
||||||
|
|
||||||
def on_auto_away_message_entry_changed(self, widget):
|
def on_auto_away_message_entry_changed(self, widget):
|
||||||
gajim.config.set('autoaway_message', widget.get_text().decode('utf-8'))
|
gajim.config.set('autoaway_message', widget.get_text())
|
||||||
|
|
||||||
def on_auto_xa_checkbutton_toggled(self, widget):
|
def on_auto_xa_checkbutton_toggled(self, widget):
|
||||||
self.on_checkbutton_toggled(widget, 'autoxa',
|
self.on_checkbutton_toggled(widget, 'autoxa',
|
||||||
|
@ -1033,7 +1033,7 @@ class PreferencesWindow:
|
||||||
gajim.config.get('autoxatime') * 60)
|
gajim.config.get('autoxatime') * 60)
|
||||||
|
|
||||||
def on_auto_xa_message_entry_changed(self, widget):
|
def on_auto_xa_message_entry_changed(self, widget):
|
||||||
gajim.config.set('autoxa_message', widget.get_text().decode('utf-8'))
|
gajim.config.set('autoxa_message', widget.get_text())
|
||||||
|
|
||||||
def on_prompt_online_status_message_checkbutton_toggled(self, widget):
|
def on_prompt_online_status_message_checkbutton_toggled(self, widget):
|
||||||
self.on_checkbutton_toggled(widget, 'ask_online_status')
|
self.on_checkbutton_toggled(widget, 'ask_online_status')
|
||||||
|
@ -1067,7 +1067,7 @@ class PreferencesWindow:
|
||||||
|
|
||||||
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]
|
||||||
message = helpers.to_one_line(message)
|
message = helpers.to_one_line(message)
|
||||||
gajim.config.set_per('defaultstatusmsg', status, 'enabled',
|
gajim.config.set_per('defaultstatusmsg', status, 'enabled',
|
||||||
model[iter_][3])
|
model[iter_][3])
|
||||||
|
@ -1084,20 +1084,18 @@ class PreferencesWindow:
|
||||||
gajim.config.del_per('statusmsg', msg)
|
gajim.config.del_per('statusmsg', msg)
|
||||||
iter_ = model.get_iter_first()
|
iter_ = model.get_iter_first()
|
||||||
while iter_:
|
while iter_:
|
||||||
val = model[iter_][0].decode('utf-8')
|
val = model[iter_][0]
|
||||||
if model[iter_][1]: # we have a preset message
|
if model[iter_][1]: # we have a preset message
|
||||||
if not val: # no title, use message text for title
|
if not val: # no title, use message text for title
|
||||||
val = model[iter_][1]
|
val = model[iter_][1]
|
||||||
gajim.config.add_per('statusmsg', val)
|
gajim.config.add_per('statusmsg', val)
|
||||||
msg = helpers.to_one_line(model[iter_][1].decode('utf-8'))
|
msg = helpers.to_one_line(model[iter_][1])
|
||||||
gajim.config.set_per('statusmsg', val, 'message', msg)
|
gajim.config.set_per('statusmsg', val, 'message', msg)
|
||||||
i = 2
|
i = 2
|
||||||
# store mood / activity
|
# store mood / activity
|
||||||
for subname in ('activity', 'subactivity', 'activity_text',
|
for subname in ('activity', 'subactivity', 'activity_text',
|
||||||
'mood', 'mood_text'):
|
'mood', 'mood_text'):
|
||||||
val = model[iter_][i]
|
val = model[iter_][i]
|
||||||
if val:
|
|
||||||
val = val.decode('utf-8')
|
|
||||||
gajim.config.set_per('statusmsg', val, subname, val)
|
gajim.config.set_per('statusmsg', val, subname, val)
|
||||||
i += 1
|
i += 1
|
||||||
iter_ = model.iter_next(iter_)
|
iter_ = model.iter_next(iter_)
|
||||||
|
@ -1111,7 +1109,7 @@ class PreferencesWindow:
|
||||||
def on_av_combobox_changed(self, combobox, config_name):
|
def on_av_combobox_changed(self, combobox, config_name):
|
||||||
model = combobox.get_model()
|
model = combobox.get_model()
|
||||||
active = combobox.get_active()
|
active = combobox.get_active()
|
||||||
device = model[active][1].decode('utf-8')
|
device = model[active][1]
|
||||||
gajim.config.set(config_name, device)
|
gajim.config.set(config_name, device)
|
||||||
|
|
||||||
def on_audio_input_combobox_changed(self, widget):
|
def on_audio_input_combobox_changed(self, widget):
|
||||||
|
@ -1137,7 +1135,7 @@ class PreferencesWindow:
|
||||||
[self.xml.get_object('stun_server_entry')])
|
[self.xml.get_object('stun_server_entry')])
|
||||||
|
|
||||||
def stun_server_entry_changed(self, widget):
|
def stun_server_entry_changed(self, widget):
|
||||||
gajim.config.set('stun_server', widget.get_text().decode('utf-8'))
|
gajim.config.set('stun_server', widget.get_text())
|
||||||
|
|
||||||
def on_applications_combobox_changed(self, widget):
|
def on_applications_combobox_changed(self, widget):
|
||||||
if widget.get_active() == 0:
|
if widget.get_active() == 0:
|
||||||
|
@ -1148,13 +1146,13 @@ class PreferencesWindow:
|
||||||
self.xml.get_object('custom_apps_frame').show()
|
self.xml.get_object('custom_apps_frame').show()
|
||||||
|
|
||||||
def on_custom_browser_entry_changed(self, widget):
|
def on_custom_browser_entry_changed(self, widget):
|
||||||
gajim.config.set('custombrowser', widget.get_text().decode('utf-8'))
|
gajim.config.set('custombrowser', widget.get_text())
|
||||||
|
|
||||||
def on_custom_mail_client_entry_changed(self, widget):
|
def on_custom_mail_client_entry_changed(self, widget):
|
||||||
gajim.config.set('custommailapp', widget.get_text().decode('utf-8'))
|
gajim.config.set('custommailapp', widget.get_text())
|
||||||
|
|
||||||
def on_custom_file_manager_entry_changed(self, widget):
|
def on_custom_file_manager_entry_changed(self, widget):
|
||||||
gajim.config.set('custom_file_manager', widget.get_text().decode('utf-8'))
|
gajim.config.set('custom_file_manager', widget.get_text())
|
||||||
|
|
||||||
def on_log_show_changes_checkbutton_toggled(self, widget):
|
def on_log_show_changes_checkbutton_toggled(self, widget):
|
||||||
self.on_checkbutton_toggled(widget, 'log_contact_status_changes')
|
self.on_checkbutton_toggled(widget, 'log_contact_status_changes')
|
||||||
|
@ -1260,7 +1258,7 @@ class PreferencesWindow:
|
||||||
|
|
||||||
def on_proxies_combobox_changed(self, widget):
|
def on_proxies_combobox_changed(self, widget):
|
||||||
active = widget.get_active()
|
active = widget.get_active()
|
||||||
proxy = widget.get_model()[active][0].decode('utf-8')
|
proxy = widget.get_model()[active][0]
|
||||||
if proxy == _('None'):
|
if proxy == _('None'):
|
||||||
proxy = ''
|
proxy = ''
|
||||||
|
|
||||||
|
@ -1371,7 +1369,7 @@ class ManageProxiesWindow:
|
||||||
(model, iter_) = sel.get_selected()
|
(model, iter_) = sel.get_selected()
|
||||||
if not iter_:
|
if not iter_:
|
||||||
return
|
return
|
||||||
proxy = model[iter_][0].decode('utf-8')
|
proxy = model[iter_][0]
|
||||||
model.remove(iter_)
|
model.remove(iter_)
|
||||||
gajim.config.del_per('proxies', proxy)
|
gajim.config.del_per('proxies', proxy)
|
||||||
self.xml.get_object('remove_proxy_button').set_sensitive(False)
|
self.xml.get_object('remove_proxy_button').set_sensitive(False)
|
||||||
|
@ -1386,7 +1384,7 @@ class ManageProxiesWindow:
|
||||||
if self.block_signal:
|
if self.block_signal:
|
||||||
return
|
return
|
||||||
act = widget.get_active()
|
act = widget.get_active()
|
||||||
proxy = self.proxyname_entry.get_text().decode('utf-8')
|
proxy = self.proxyname_entry.get_text()
|
||||||
gajim.config.set_per('proxies', proxy, 'useauth', act)
|
gajim.config.set_per('proxies', proxy, 'useauth', act)
|
||||||
self.xml.get_object('proxyuser_entry').set_sensitive(act)
|
self.xml.get_object('proxyuser_entry').set_sensitive(act)
|
||||||
self.xml.get_object('proxypass_entry').set_sensitive(act)
|
self.xml.get_object('proxypass_entry').set_sensitive(act)
|
||||||
|
@ -1395,7 +1393,7 @@ class ManageProxiesWindow:
|
||||||
if self.block_signal:
|
if self.block_signal:
|
||||||
return
|
return
|
||||||
act = widget.get_active()
|
act = widget.get_active()
|
||||||
proxy = self.proxyname_entry.get_text().decode('utf-8')
|
proxy = self.proxyname_entry.get_text()
|
||||||
gajim.config.set_per('proxies', proxy, 'bosh_useproxy', act)
|
gajim.config.set_per('proxies', proxy, 'bosh_useproxy', act)
|
||||||
self.xml.get_object('proxyhost_entry').set_sensitive(act)
|
self.xml.get_object('proxyhost_entry').set_sensitive(act)
|
||||||
self.xml.get_object('proxyport_entry').set_sensitive(act)
|
self.xml.get_object('proxyport_entry').set_sensitive(act)
|
||||||
|
@ -1484,8 +1482,8 @@ class ManageProxiesWindow:
|
||||||
(model, iter_) = sel.get_selected()
|
(model, iter_) = sel.get_selected()
|
||||||
if not iter_:
|
if not iter_:
|
||||||
return
|
return
|
||||||
old_name = model.get_value(iter_, 0).decode('utf-8')
|
old_name = model.get_value(iter_, 0)
|
||||||
new_name = widget.get_text().decode('utf-8')
|
new_name = widget.get_text()
|
||||||
if new_name == '':
|
if new_name == '':
|
||||||
return
|
return
|
||||||
if new_name == old_name:
|
if new_name == old_name:
|
||||||
|
@ -1503,42 +1501,42 @@ class ManageProxiesWindow:
|
||||||
types = ['http', 'socks5', 'bosh']
|
types = ['http', 'socks5', 'bosh']
|
||||||
type_ = self.proxytype_combobox.get_active()
|
type_ = self.proxytype_combobox.get_active()
|
||||||
self.show_bosh_fields(types[type_]=='bosh')
|
self.show_bosh_fields(types[type_]=='bosh')
|
||||||
proxy = self.proxyname_entry.get_text().decode('utf-8')
|
proxy = self.proxyname_entry.get_text()
|
||||||
gajim.config.set_per('proxies', proxy, 'type', types[type_])
|
gajim.config.set_per('proxies', proxy, 'type', types[type_])
|
||||||
|
|
||||||
def on_proxyhost_entry_changed(self, widget):
|
def on_proxyhost_entry_changed(self, widget):
|
||||||
if self.block_signal:
|
if self.block_signal:
|
||||||
return
|
return
|
||||||
value = widget.get_text().decode('utf-8')
|
value = widget.get_text()
|
||||||
proxy = self.proxyname_entry.get_text().decode('utf-8')
|
proxy = self.proxyname_entry.get_text()
|
||||||
gajim.config.set_per('proxies', proxy, 'host', value)
|
gajim.config.set_per('proxies', proxy, 'host', value)
|
||||||
|
|
||||||
def on_proxyport_entry_changed(self, widget):
|
def on_proxyport_entry_changed(self, widget):
|
||||||
if self.block_signal:
|
if self.block_signal:
|
||||||
return
|
return
|
||||||
value = widget.get_text().decode('utf-8')
|
value = widget.get_text()
|
||||||
proxy = self.proxyname_entry.get_text().decode('utf-8')
|
proxy = self.proxyname_entry.get_text()
|
||||||
gajim.config.set_per('proxies', proxy, 'port', value)
|
gajim.config.set_per('proxies', proxy, 'port', value)
|
||||||
|
|
||||||
def on_proxyuser_entry_changed(self, widget):
|
def on_proxyuser_entry_changed(self, widget):
|
||||||
if self.block_signal:
|
if self.block_signal:
|
||||||
return
|
return
|
||||||
value = widget.get_text().decode('utf-8')
|
value = widget.get_text()
|
||||||
proxy = self.proxyname_entry.get_text().decode('utf-8')
|
proxy = self.proxyname_entry.get_text()
|
||||||
gajim.config.set_per('proxies', proxy, 'user', value)
|
gajim.config.set_per('proxies', proxy, 'user', value)
|
||||||
|
|
||||||
def on_boshuri_entry_changed(self, widget):
|
def on_boshuri_entry_changed(self, widget):
|
||||||
if self.block_signal:
|
if self.block_signal:
|
||||||
return
|
return
|
||||||
value = widget.get_text().decode('utf-8')
|
value = widget.get_text()
|
||||||
proxy = self.proxyname_entry.get_text().decode('utf-8')
|
proxy = self.proxyname_entry.get_text()
|
||||||
gajim.config.set_per('proxies', proxy, 'bosh_uri', value)
|
gajim.config.set_per('proxies', proxy, 'bosh_uri', value)
|
||||||
|
|
||||||
def on_proxypass_entry_changed(self, widget):
|
def on_proxypass_entry_changed(self, widget):
|
||||||
if self.block_signal:
|
if self.block_signal:
|
||||||
return
|
return
|
||||||
value = widget.get_text().decode('utf-8')
|
value = widget.get_text()
|
||||||
proxy = self.proxyname_entry.get_text().decode('utf-8')
|
proxy = self.proxyname_entry.get_text()
|
||||||
gajim.config.set_per('proxies', proxy, 'pass', value)
|
gajim.config.set_per('proxies', proxy, 'pass', value)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1613,7 +1611,7 @@ class AccountsWindow:
|
||||||
model = self.accounts_treeview.get_model()
|
model = self.accounts_treeview.get_model()
|
||||||
iter_ = model.get_iter_first()
|
iter_ = model.get_iter_first()
|
||||||
while iter_:
|
while iter_:
|
||||||
acct = model[iter_][0].decode('utf-8')
|
acct = model[iter_][0]
|
||||||
if account == acct:
|
if account == acct:
|
||||||
self.accounts_treeview.set_cursor(model.get_path(iter_))
|
self.accounts_treeview.set_cursor(model.get_path(iter_))
|
||||||
return
|
return
|
||||||
|
@ -1693,7 +1691,7 @@ class AccountsWindow:
|
||||||
if sel:
|
if sel:
|
||||||
(model, iter_) = sel.get_selected()
|
(model, iter_) = sel.get_selected()
|
||||||
if iter_:
|
if iter_:
|
||||||
account = model[iter_][0].decode('utf-8')
|
account = model[iter_][0]
|
||||||
else:
|
else:
|
||||||
account = None
|
account = None
|
||||||
else:
|
else:
|
||||||
|
@ -2342,7 +2340,7 @@ class AccountsWindow:
|
||||||
|
|
||||||
def on_proxies_combobox1_changed(self, widget):
|
def on_proxies_combobox1_changed(self, widget):
|
||||||
active = widget.get_active()
|
active = widget.get_active()
|
||||||
proxy = widget.get_model()[active][0].decode('utf-8')
|
proxy = widget.get_model()[active][0]
|
||||||
if proxy == _('None'):
|
if proxy == _('None'):
|
||||||
proxy = ''
|
proxy = ''
|
||||||
|
|
||||||
|
@ -2384,7 +2382,7 @@ class AccountsWindow:
|
||||||
def on_custom_host_entry1_changed(self, widget):
|
def on_custom_host_entry1_changed(self, widget):
|
||||||
if self.ignore_events:
|
if self.ignore_events:
|
||||||
return
|
return
|
||||||
host = widget.get_text().decode('utf-8')
|
host = widget.get_text()
|
||||||
if self.option_changed('custom_host', host):
|
if self.option_changed('custom_host', host):
|
||||||
self.need_relogin = True
|
self.need_relogin = True
|
||||||
gajim.config.set_per('accounts', self.current_account, 'custom_host',
|
gajim.config.set_per('accounts', self.current_account, 'custom_host',
|
||||||
|
@ -2655,7 +2653,7 @@ class AccountsWindow:
|
||||||
def on_first_name_entry2_changed(self, widget):
|
def on_first_name_entry2_changed(self, widget):
|
||||||
if self.ignore_events:
|
if self.ignore_events:
|
||||||
return
|
return
|
||||||
name = widget.get_text().decode('utf-8')
|
name = widget.get_text()
|
||||||
if self.option_changed('zeroconf_first_name', name):
|
if self.option_changed('zeroconf_first_name', name):
|
||||||
self.need_relogin = True
|
self.need_relogin = True
|
||||||
gajim.config.set_per('accounts', self.current_account,
|
gajim.config.set_per('accounts', self.current_account,
|
||||||
|
@ -2664,7 +2662,7 @@ class AccountsWindow:
|
||||||
def on_last_name_entry2_changed(self, widget):
|
def on_last_name_entry2_changed(self, widget):
|
||||||
if self.ignore_events:
|
if self.ignore_events:
|
||||||
return
|
return
|
||||||
name = widget.get_text().decode('utf-8')
|
name = widget.get_text()
|
||||||
if self.option_changed('zeroconf_last_name', name):
|
if self.option_changed('zeroconf_last_name', name):
|
||||||
self.need_relogin = True
|
self.need_relogin = True
|
||||||
gajim.config.set_per('accounts', self.current_account,
|
gajim.config.set_per('accounts', self.current_account,
|
||||||
|
@ -2673,7 +2671,7 @@ class AccountsWindow:
|
||||||
def on_jabber_id_entry2_changed(self, widget):
|
def on_jabber_id_entry2_changed(self, widget):
|
||||||
if self.ignore_events:
|
if self.ignore_events:
|
||||||
return
|
return
|
||||||
id_ = widget.get_text().decode('utf-8')
|
id_ = widget.get_text()
|
||||||
if self.option_changed('zeroconf_jabber_id', id_):
|
if self.option_changed('zeroconf_jabber_id', id_):
|
||||||
self.need_relogin = True
|
self.need_relogin = True
|
||||||
gajim.config.set_per('accounts', self.current_account,
|
gajim.config.set_per('accounts', self.current_account,
|
||||||
|
@ -2682,7 +2680,7 @@ class AccountsWindow:
|
||||||
def on_email_entry2_changed(self, widget):
|
def on_email_entry2_changed(self, widget):
|
||||||
if self.ignore_events:
|
if self.ignore_events:
|
||||||
return
|
return
|
||||||
email = widget.get_text().decode('utf-8')
|
email = widget.get_text()
|
||||||
if self.option_changed('zeroconf_email', email):
|
if self.option_changed('zeroconf_email', email):
|
||||||
self.need_relogin = True
|
self.need_relogin = True
|
||||||
gajim.config.set_per('accounts', self.current_account,
|
gajim.config.set_per('accounts', self.current_account,
|
||||||
|
@ -2733,7 +2731,7 @@ class FakeDataForm(Gtk.Table, object):
|
||||||
|
|
||||||
def get_infos(self):
|
def get_infos(self):
|
||||||
for name in self.entries.keys():
|
for name in self.entries.keys():
|
||||||
self.infos[name] = self.entries[name].get_text().decode('utf-8')
|
self.infos[name] = self.entries[name].get_text()
|
||||||
return self.infos
|
return self.infos
|
||||||
|
|
||||||
class ServiceRegistrationWindow:
|
class ServiceRegistrationWindow:
|
||||||
|
@ -2906,7 +2904,7 @@ class GroupchatConfigWindow:
|
||||||
|
|
||||||
def on_cell_edited(self, cell, path, new_text):
|
def on_cell_edited(self, cell, path, new_text):
|
||||||
model = self.affiliation_treeview['outcast'].get_model()
|
model = self.affiliation_treeview['outcast'].get_model()
|
||||||
new_text = new_text.decode('utf-8')
|
new_text = new_text
|
||||||
iter_ = model.get_iter(path)
|
iter_ = model.get_iter(path)
|
||||||
model[iter_][1] = new_text
|
model[iter_][1] = new_text
|
||||||
|
|
||||||
|
@ -2984,12 +2982,12 @@ class GroupchatConfigWindow:
|
||||||
iter_ = model.get_iter_first()
|
iter_ = model.get_iter_first()
|
||||||
# add new jid
|
# add new jid
|
||||||
while iter_:
|
while iter_:
|
||||||
jid = model[iter_][0].decode('utf-8')
|
jid = model[iter_][0]
|
||||||
actual_jid_list.append(jid)
|
actual_jid_list.append(jid)
|
||||||
if jid not in self.start_users_dict[affiliation] or \
|
if jid not in self.start_users_dict[affiliation] or \
|
||||||
(affiliation == 'outcast' and 'reason' in self.start_users_dict[
|
(affiliation == 'outcast' and 'reason' in self.start_users_dict[
|
||||||
affiliation][jid] and self.start_users_dict[affiliation][jid]\
|
affiliation][jid] and self.start_users_dict[affiliation][jid]\
|
||||||
['reason'] != model[iter_][1].decode('utf-8')):
|
['reason'] != model[iter_][1]):
|
||||||
users_dict[jid] = {'affiliation': affiliation}
|
users_dict[jid] = {'affiliation': affiliation}
|
||||||
if affiliation == 'outcast':
|
if affiliation == 'outcast':
|
||||||
users_dict[jid]['reason'] = model[iter_][1].decode(
|
users_dict[jid]['reason'] = model[iter_][1].decode(
|
||||||
|
@ -3236,7 +3234,7 @@ class ManageBookmarksWindow:
|
||||||
# No parent, so we got an account -> add to this.
|
# No parent, so we got an account -> add to this.
|
||||||
add_to = iter_
|
add_to = iter_
|
||||||
|
|
||||||
account = model[add_to][1].decode('utf-8')
|
account = model[add_to][1]
|
||||||
nick = gajim.nicks[account]
|
nick = gajim.nicks[account]
|
||||||
iter_ = self.treestore.append(add_to, [account, _('New Group Chat'),
|
iter_ = self.treestore.append(add_to, [account, _('New Group Chat'),
|
||||||
'@', False, False, '', nick, 'in_and_out'])
|
'@', False, False, '', nick, 'in_and_out'])
|
||||||
|
@ -3269,8 +3267,8 @@ class ManageBookmarksWindow:
|
||||||
#Account data can't be changed
|
#Account data can't be changed
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.server_entry.get_text().decode('utf-8') == '' or \
|
if self.server_entry.get_text() == '' or \
|
||||||
self.room_entry.get_text().decode('utf-8') == '':
|
self.room_entry.get_text() == '':
|
||||||
dialogs.ErrorDialog(_('This bookmark has invalid data'),
|
dialogs.ErrorDialog(_('This bookmark has invalid data'),
|
||||||
_('Please be sure to fill out server and room fields or remove this'
|
_('Please be sure to fill out server and room fields or remove this'
|
||||||
' bookmark.'))
|
' bookmark.'))
|
||||||
|
@ -3290,7 +3288,7 @@ class ManageBookmarksWindow:
|
||||||
return
|
return
|
||||||
|
|
||||||
for account in self.treestore:
|
for account in self.treestore:
|
||||||
account_unicode = account[1].decode('utf-8')
|
account_unicode = account[1]
|
||||||
gajim.connections[account_unicode].bookmarks = []
|
gajim.connections[account_unicode].bookmarks = []
|
||||||
|
|
||||||
for bm in account.iterchildren():
|
for bm in account.iterchildren():
|
||||||
|
@ -3298,17 +3296,9 @@ class ManageBookmarksWindow:
|
||||||
autojoin = unicode(int(bm[3]))
|
autojoin = unicode(int(bm[3]))
|
||||||
minimize = unicode(int(bm[4]))
|
minimize = unicode(int(bm[4]))
|
||||||
name = bm[1]
|
name = bm[1]
|
||||||
if name:
|
|
||||||
name = name.decode('utf-8')
|
|
||||||
jid = bm[2]
|
jid = bm[2]
|
||||||
if jid:
|
|
||||||
jid = jid.decode('utf-8')
|
|
||||||
pw = bm[5]
|
pw = bm[5]
|
||||||
if pw:
|
|
||||||
pw = pw.decode('utf-8')
|
|
||||||
nick = bm[6]
|
nick = bm[6]
|
||||||
if nick:
|
|
||||||
nick = nick.decode('utf-8')
|
|
||||||
|
|
||||||
# create the bookmark-dict
|
# create the bookmark-dict
|
||||||
bmdict = { 'name': name, 'jid': jid, 'autojoin': autojoin,
|
bmdict = { 'name': name, 'jid': jid, 'autojoin': autojoin,
|
||||||
|
@ -3353,7 +3343,7 @@ class ManageBookmarksWindow:
|
||||||
|
|
||||||
# Fill in the data for childs
|
# Fill in the data for childs
|
||||||
self.title_entry.set_text(model[iter_][1])
|
self.title_entry.set_text(model[iter_][1])
|
||||||
room_jid = model[iter_][2].decode('utf-8')
|
room_jid = model[iter_][2]
|
||||||
(room, server) = room_jid.split('@')
|
(room, server) = room_jid.split('@')
|
||||||
self.room_entry.set_text(room)
|
self.room_entry.set_text(room)
|
||||||
self.server_entry.set_text(server)
|
self.server_entry.set_text(server)
|
||||||
|
@ -3364,7 +3354,7 @@ class ManageBookmarksWindow:
|
||||||
self.minimize_checkbutton.set_sensitive(model[iter_][3])
|
self.minimize_checkbutton.set_sensitive(model[iter_][3])
|
||||||
|
|
||||||
if model[iter_][5] is not None:
|
if model[iter_][5] is not None:
|
||||||
password = model[iter_][5].decode('utf-8')
|
password = model[iter_][5]
|
||||||
else:
|
else:
|
||||||
password = None
|
password = None
|
||||||
|
|
||||||
|
@ -3374,7 +3364,6 @@ class ManageBookmarksWindow:
|
||||||
self.pass_entry.set_text('')
|
self.pass_entry.set_text('')
|
||||||
nick = model[iter_][6]
|
nick = model[iter_][6]
|
||||||
if nick:
|
if nick:
|
||||||
nick = nick.decode('utf-8')
|
|
||||||
self.nick_entry.set_text(nick)
|
self.nick_entry.set_text(nick)
|
||||||
else:
|
else:
|
||||||
self.nick_entry.set_text('')
|
self.nick_entry.set_text('')
|
||||||
|
@ -3393,7 +3382,7 @@ class ManageBookmarksWindow:
|
||||||
def on_nick_entry_changed(self, widget):
|
def on_nick_entry_changed(self, widget):
|
||||||
(model, iter_) = self.selection.get_selected()
|
(model, iter_) = self.selection.get_selected()
|
||||||
if iter_:
|
if iter_:
|
||||||
nick = self.nick_entry.get_text().decode('utf-8')
|
nick = self.nick_entry.get_text()
|
||||||
try:
|
try:
|
||||||
nick = helpers.parse_resource(nick)
|
nick = helpers.parse_resource(nick)
|
||||||
except helpers.InvalidFormat, e:
|
except helpers.InvalidFormat, e:
|
||||||
|
@ -3407,12 +3396,12 @@ class ManageBookmarksWindow:
|
||||||
(model, iter_) = self.selection.get_selected()
|
(model, iter_) = self.selection.get_selected()
|
||||||
if not iter_:
|
if not iter_:
|
||||||
return
|
return
|
||||||
server = widget.get_text().decode('utf-8')
|
server = widget.get_text()
|
||||||
if '@' in server:
|
if '@' in server:
|
||||||
dialogs.ErrorDialog(_('Invalid server'), _('Character not allowed'))
|
dialogs.ErrorDialog(_('Invalid server'), _('Character not allowed'))
|
||||||
widget.set_text(server.replace('@', ''))
|
widget.set_text(server.replace('@', ''))
|
||||||
|
|
||||||
room_jid = self.room_entry.get_text().decode('utf-8').strip() + '@' + \
|
room_jid = self.room_entry.get_text().strip() + '@' + \
|
||||||
server.strip()
|
server.strip()
|
||||||
try:
|
try:
|
||||||
room_jid = helpers.parse_resource(room_jid)
|
room_jid = helpers.parse_resource(room_jid)
|
||||||
|
@ -3427,12 +3416,12 @@ class ManageBookmarksWindow:
|
||||||
(model, iter_) = self.selection.get_selected()
|
(model, iter_) = self.selection.get_selected()
|
||||||
if not iter_:
|
if not iter_:
|
||||||
return
|
return
|
||||||
room = widget.get_text().decode('utf-8')
|
room = widget.get_text()
|
||||||
if '@' in room:
|
if '@' in room:
|
||||||
dialogs.ErrorDialog(_('Invalid server'), _('Character not allowed'))
|
dialogs.ErrorDialog(_('Invalid server'), _('Character not allowed'))
|
||||||
widget.set_text(room.replace('@', ''))
|
widget.set_text(room.replace('@', ''))
|
||||||
room_jid = room.strip() + '@' + \
|
room_jid = room.strip() + '@' + \
|
||||||
self.server_entry.get_text().decode('utf-8').strip()
|
self.server_entry.get_text().strip()
|
||||||
try:
|
try:
|
||||||
room_jid = helpers.parse_resource(room_jid)
|
room_jid = helpers.parse_resource(room_jid)
|
||||||
except helpers.InvalidFormat, e:
|
except helpers.InvalidFormat, e:
|
||||||
|
@ -3641,7 +3630,7 @@ class AccountCreationWizardWindow:
|
||||||
dialogs.ErrorDialog(pritext, sectext)
|
dialogs.ErrorDialog(pritext, sectext)
|
||||||
return
|
return
|
||||||
server = self.xml.get_object('server_comboboxentry').get_child().\
|
server = self.xml.get_object('server_comboboxentry').get_child().\
|
||||||
get_text().decode('utf-8').strip()
|
get_text().strip()
|
||||||
savepass = self.xml.get_object('save_password_checkbutton').\
|
savepass = self.xml.get_object('save_password_checkbutton').\
|
||||||
get_active()
|
get_active()
|
||||||
password = self.xml.get_object('password_entry').get_text().decode(
|
password = self.xml.get_object('password_entry').get_text().decode(
|
||||||
|
@ -3675,7 +3664,7 @@ class AccountCreationWizardWindow:
|
||||||
elif cur_page == 2:
|
elif cur_page == 2:
|
||||||
# We are creating a new account
|
# We are creating a new account
|
||||||
server = self.xml.get_object('server_comboboxentry1').get_child().\
|
server = self.xml.get_object('server_comboboxentry1').get_child().\
|
||||||
get_text().decode('utf-8')
|
get_text()
|
||||||
|
|
||||||
if not server:
|
if not server:
|
||||||
dialogs.ErrorDialog(_('Invalid server'),
|
dialogs.ErrorDialog(_('Invalid server'),
|
||||||
|
@ -3691,7 +3680,7 @@ class AccountCreationWizardWindow:
|
||||||
# Get advanced options
|
# Get advanced options
|
||||||
proxies_combobox = self.xml.get_object('proxies_combobox')
|
proxies_combobox = self.xml.get_object('proxies_combobox')
|
||||||
active = proxies_combobox.get_active()
|
active = proxies_combobox.get_active()
|
||||||
proxy = proxies_combobox.get_model()[active][0].decode('utf-8')
|
proxy = proxies_combobox.get_model()[active][0]
|
||||||
if proxy == _('None'):
|
if proxy == _('None'):
|
||||||
proxy = ''
|
proxy = ''
|
||||||
config['proxy'] = proxy
|
config['proxy'] = proxy
|
||||||
|
@ -3707,7 +3696,7 @@ class AccountCreationWizardWindow:
|
||||||
return
|
return
|
||||||
config['custom_port'] = custom_port
|
config['custom_port'] = custom_port
|
||||||
config['custom_host'] = self.xml.get_object(
|
config['custom_host'] = self.xml.get_object(
|
||||||
'custom_host_entry').get_text().decode('utf-8')
|
'custom_host_entry').get_text()
|
||||||
|
|
||||||
if self.xml.get_object('anonymous_checkbutton2').get_active():
|
if self.xml.get_object('anonymous_checkbutton2').get_active():
|
||||||
self.modify = True
|
self.modify = True
|
||||||
|
@ -4161,11 +4150,11 @@ class ManageSoundsWindow:
|
||||||
self.window.show_all()
|
self.window.show_all()
|
||||||
|
|
||||||
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]
|
||||||
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])
|
||||||
|
|
||||||
def sound_toggled_cb(self, cell, path):
|
def sound_toggled_cb(self, cell, path):
|
||||||
model = self.sound_tree.get_model()
|
model = self.sound_tree.get_model()
|
||||||
|
@ -4238,7 +4227,7 @@ class ManageSoundsWindow:
|
||||||
def on_cancel(widget):
|
def on_cancel(widget):
|
||||||
self.dialog.destroy()
|
self.dialog.destroy()
|
||||||
|
|
||||||
path_to_snd_file = model[iter_][2].decode('utf-8')
|
path_to_snd_file = model[iter_][2]
|
||||||
self.dialog = dialogs.SoundChooserDialog(path_to_snd_file, on_ok,
|
self.dialog = dialogs.SoundChooserDialog(path_to_snd_file, on_ok,
|
||||||
on_cancel)
|
on_cancel)
|
||||||
|
|
||||||
|
|
|
@ -114,12 +114,12 @@ class DataFormWidget(Gtk.Alignment, object):
|
||||||
def get_title(self):
|
def get_title(self):
|
||||||
"""
|
"""
|
||||||
Get the title of data form, as a unicode object. If no title or no form,
|
Get the title of data form, as a unicode object. If no title or no form,
|
||||||
returns u''. Useful for setting window title
|
returns ''. Useful for setting window title
|
||||||
"""
|
"""
|
||||||
if self._data_form is not None:
|
if self._data_form is not None:
|
||||||
if self._data_form.title is not None:
|
if self._data_form.title is not None:
|
||||||
return self._data_form.title
|
return self._data_form.title
|
||||||
return u''
|
return ''
|
||||||
|
|
||||||
title = property(get_title, None, None, 'Data form title')
|
title = property(get_title, None, None, 'Data form title')
|
||||||
|
|
||||||
|
@ -540,7 +540,7 @@ class SingleForm(Gtk.Table, object):
|
||||||
field)
|
field)
|
||||||
widget.set_sensitive(readwrite)
|
widget.set_sensitive(readwrite)
|
||||||
if field.value is None:
|
if field.value is None:
|
||||||
field.value = u''
|
field.value = ''
|
||||||
widget.set_text(field.value)
|
widget.set_text(field.value)
|
||||||
else:
|
else:
|
||||||
commonwidget=False
|
commonwidget=False
|
||||||
|
|
|
@ -127,7 +127,7 @@ class EditGroupsDialog:
|
||||||
gajim.interface.roster.draw_group(_('General'), account)
|
gajim.interface.roster.draw_group(_('General'), account)
|
||||||
|
|
||||||
def on_add_button_clicked(self, widget):
|
def on_add_button_clicked(self, widget):
|
||||||
group = self.xml.get_object('group_entry').get_text().decode('utf-8')
|
group = self.xml.get_object('group_entry').get_text()
|
||||||
if not group:
|
if not group:
|
||||||
return
|
return
|
||||||
# Do not allow special groups
|
# Do not allow special groups
|
||||||
|
@ -137,7 +137,7 @@ class EditGroupsDialog:
|
||||||
model = self.treeview.get_model()
|
model = self.treeview.get_model()
|
||||||
iter_ = model.get_iter_first()
|
iter_ = model.get_iter_first()
|
||||||
while iter_:
|
while iter_:
|
||||||
if model.get_value(iter_, 0).decode('utf-8') == group:
|
if model.get_value(iter_, 0) == group:
|
||||||
return
|
return
|
||||||
iter_ = model.iter_next(iter_)
|
iter_ = model.iter_next(iter_)
|
||||||
self.changes_made = True
|
self.changes_made = True
|
||||||
|
@ -153,7 +153,7 @@ class EditGroupsDialog:
|
||||||
model[path][1] = True
|
model[path][1] = True
|
||||||
else:
|
else:
|
||||||
model[path][1] = not model[path][1]
|
model[path][1] = not model[path][1]
|
||||||
group = model[path][0].decode('utf-8')
|
group = model[path][0]
|
||||||
if model[path][1]:
|
if model[path][1]:
|
||||||
self.add_group(group)
|
self.add_group(group)
|
||||||
else:
|
else:
|
||||||
|
@ -251,7 +251,7 @@ class PassphraseDialog:
|
||||||
if not self.ok_handler:
|
if not self.ok_handler:
|
||||||
return
|
return
|
||||||
|
|
||||||
passph = self.passphrase_entry.get_text().decode('utf-8')
|
passph = self.passphrase_entry.get_text()
|
||||||
|
|
||||||
if self.check:
|
if self.check:
|
||||||
checked = self.xml.get_object('save_passphrase_checkbutton').\
|
checked = self.xml.get_object('save_passphrase_checkbutton').\
|
||||||
|
@ -325,8 +325,7 @@ class ChooseGPGKeyDialog:
|
||||||
selection = self.keys_treeview.get_selection()
|
selection = self.keys_treeview.get_selection()
|
||||||
(model, iter_) = selection.get_selected()
|
(model, iter_) = selection.get_selected()
|
||||||
if iter_ and response == Gtk.ResponseType.OK:
|
if iter_ and response == Gtk.ResponseType.OK:
|
||||||
keyID = [ model[iter_][0].decode('utf-8'),
|
keyID = [ model[iter_][0], model[iter_][1] ]
|
||||||
model[iter_][1].decode('utf-8') ]
|
|
||||||
else:
|
else:
|
||||||
keyID = None
|
keyID = None
|
||||||
self.on_response(keyID)
|
self.on_response(keyID)
|
||||||
|
@ -458,7 +457,7 @@ class ChangeActivityDialog:
|
||||||
"""
|
"""
|
||||||
if self.checkbutton.get_active():
|
if self.checkbutton.get_active():
|
||||||
self.on_response(self.activity, self.subactivity,
|
self.on_response(self.activity, self.subactivity,
|
||||||
self.entry.get_text().decode('utf-8'))
|
self.entry.get_text())
|
||||||
else:
|
else:
|
||||||
self.on_response(None, None, '')
|
self.on_response(None, None, '')
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
@ -541,7 +540,7 @@ class ChangeMoodDialog:
|
||||||
|
|
||||||
def on_ok_button_clicked(self, widget):
|
def on_ok_button_clicked(self, widget):
|
||||||
'''Return mood and messsage (None if no mood selected)'''
|
'''Return mood and messsage (None if no mood selected)'''
|
||||||
message = self.entry.get_text().decode('utf-8')
|
message = self.entry.get_text()
|
||||||
self.on_response(self.mood, message)
|
self.on_response(self.mood, message)
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
|
@ -713,8 +712,7 @@ class ChangeStatusMessageDialog(TimeoutDialog):
|
||||||
def on_dialog_response(self, dialog, response):
|
def on_dialog_response(self, dialog, response):
|
||||||
if response == Gtk.ResponseType.OK:
|
if response == Gtk.ResponseType.OK:
|
||||||
beg, end = self.message_buffer.get_bounds()
|
beg, end = self.message_buffer.get_bounds()
|
||||||
message = self.message_buffer.get_text(beg, end, True).decode('utf-8')\
|
message = self.message_buffer.get_text(beg, end, True).strip()
|
||||||
.strip()
|
|
||||||
message = helpers.remove_invalid_xml_chars(message)
|
message = helpers.remove_invalid_xml_chars(message)
|
||||||
msg = helpers.to_one_line(message)
|
msg = helpers.to_one_line(message)
|
||||||
if self.show:
|
if self.show:
|
||||||
|
@ -742,7 +740,7 @@ class ChangeStatusMessageDialog(TimeoutDialog):
|
||||||
active = widget.get_active()
|
active = widget.get_active()
|
||||||
if active < 0:
|
if active < 0:
|
||||||
return None
|
return None
|
||||||
name = model[active][0].decode('utf-8')
|
name = model[active][0]
|
||||||
self.message_buffer.set_text(self.preset_messages_dict[name][0])
|
self.message_buffer.set_text(self.preset_messages_dict[name][0])
|
||||||
self.pep_dict['activity'] = self.preset_messages_dict[name][1]
|
self.pep_dict['activity'] = self.preset_messages_dict[name][1]
|
||||||
self.pep_dict['subactivity'] = self.preset_messages_dict[name][2]
|
self.pep_dict['subactivity'] = self.preset_messages_dict[name][2]
|
||||||
|
@ -778,10 +776,10 @@ class ChangeStatusMessageDialog(TimeoutDialog):
|
||||||
status_message_to_save_as_preset = self.message_buffer.get_text(
|
status_message_to_save_as_preset = self.message_buffer.get_text(
|
||||||
start_iter, finish_iter, True)
|
start_iter, finish_iter, True)
|
||||||
def on_ok(msg_name):
|
def on_ok(msg_name):
|
||||||
msg_text = status_message_to_save_as_preset.decode('utf-8')
|
msg_text = status_message_to_save_as_preset
|
||||||
msg_text_1l = helpers.to_one_line(msg_text)
|
msg_text_1l = helpers.to_one_line(msg_text)
|
||||||
if not msg_name: # msg_name was ''
|
if not msg_name: # msg_name was ''
|
||||||
msg_name = msg_text_1l.decode('utf-8')
|
msg_name = msg_text_1l
|
||||||
|
|
||||||
def on_ok2():
|
def on_ok2():
|
||||||
self.preset_messages_dict[msg_name] = [
|
self.preset_messages_dict[msg_name] = [
|
||||||
|
@ -1034,7 +1032,7 @@ class AddNewContactWindow:
|
||||||
self._nec_gateway_prompt_received)
|
self._nec_gateway_prompt_received)
|
||||||
|
|
||||||
def on_register_button_clicked(self, widget):
|
def on_register_button_clicked(self, widget):
|
||||||
jid = self.protocol_jid_combobox.get_active_text().decode('utf-8')
|
jid = self.protocol_jid_combobox.get_active_text()
|
||||||
gajim.connections[self.account].request_register_agent_info(jid)
|
gajim.connections[self.account].request_register_agent_info(jid)
|
||||||
|
|
||||||
def on_add_new_contact_window_key_press_event(self, widget, event):
|
def on_add_new_contact_window_key_press_event(self, widget, event):
|
||||||
|
@ -1051,7 +1049,7 @@ class AddNewContactWindow:
|
||||||
"""
|
"""
|
||||||
When Subscribe button is clicked
|
When Subscribe button is clicked
|
||||||
"""
|
"""
|
||||||
jid = self.uid_entry.get_text().decode('utf-8').strip()
|
jid = self.uid_entry.get_text().strip()
|
||||||
if not jid:
|
if not jid:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -1091,7 +1089,7 @@ class AddNewContactWindow:
|
||||||
ErrorDialog(pritext, _('You cannot add yourself to your roster.'))
|
ErrorDialog(pritext, _('You cannot add yourself to your roster.'))
|
||||||
return
|
return
|
||||||
|
|
||||||
nickname = self.nickname_entry.get_text().decode('utf-8') or ''
|
nickname = self.nickname_entry.get_text() or ''
|
||||||
# get value of account combobox, if account was not specified
|
# get value of account combobox, if account was not specified
|
||||||
if not self.account:
|
if not self.account:
|
||||||
model = self.account_combobox.get_model()
|
model = self.account_combobox.get_model()
|
||||||
|
@ -1110,14 +1108,14 @@ class AddNewContactWindow:
|
||||||
message_buffer = self.message_textview.get_buffer()
|
message_buffer = self.message_textview.get_buffer()
|
||||||
start_iter = message_buffer.get_start_iter()
|
start_iter = message_buffer.get_start_iter()
|
||||||
end_iter = message_buffer.get_end_iter()
|
end_iter = message_buffer.get_end_iter()
|
||||||
message = message_buffer.get_text(start_iter, end_iter, True).decode('utf-8')
|
message = message_buffer.get_text(start_iter, end_iter, True)
|
||||||
if self.save_message_checkbutton.get_active():
|
if self.save_message_checkbutton.get_active():
|
||||||
msg = helpers.to_one_line(message)
|
msg = helpers.to_one_line(message)
|
||||||
gajim.config.set_per('accounts', self.account,
|
gajim.config.set_per('accounts', self.account,
|
||||||
'subscription_request_msg', msg)
|
'subscription_request_msg', msg)
|
||||||
else:
|
else:
|
||||||
message= ''
|
message= ''
|
||||||
group = self.group_comboboxentry.get_child().get_text().decode('utf-8')
|
group = self.group_comboboxentry.get_child().get_text()
|
||||||
groups = []
|
groups = []
|
||||||
if group:
|
if group:
|
||||||
groups = [group]
|
groups = [group]
|
||||||
|
@ -1268,7 +1266,7 @@ class AboutDialog:
|
||||||
dlg.set_transient_for(gajim.interface.roster.window)
|
dlg.set_transient_for(gajim.interface.roster.window)
|
||||||
dlg.set_name('Gajim')
|
dlg.set_name('Gajim')
|
||||||
dlg.set_version(gajim.version)
|
dlg.set_version(gajim.version)
|
||||||
s = u'Copyright © 2003-2012 Gajim Team'
|
s = 'Copyright © 2003-2012 Gajim Team'
|
||||||
dlg.set_copyright(s)
|
dlg.set_copyright(s)
|
||||||
copying_file_path = self.get_path('COPYING')
|
copying_file_path = self.get_path('COPYING')
|
||||||
if copying_file_path:
|
if copying_file_path:
|
||||||
|
@ -2006,7 +2004,7 @@ class InputDialog(CommonInputDialog):
|
||||||
self.input_entry.select_region(0, -1) # select all
|
self.input_entry.select_region(0, -1) # select all
|
||||||
|
|
||||||
def get_text(self):
|
def get_text(self):
|
||||||
return self.input_entry.get_text().decode('utf-8')
|
return self.input_entry.get_text()
|
||||||
|
|
||||||
class InputDialogCheck(InputDialog):
|
class InputDialogCheck(InputDialog):
|
||||||
"""
|
"""
|
||||||
|
@ -2032,7 +2030,7 @@ class InputDialogCheck(InputDialog):
|
||||||
def on_okbutton_clicked(self, widget):
|
def on_okbutton_clicked(self, widget):
|
||||||
user_input = self.get_text()
|
user_input = self.get_text()
|
||||||
if user_input:
|
if user_input:
|
||||||
user_input = user_input.decode('utf-8')
|
user_input = user_input
|
||||||
self.cancel_handler = None
|
self.cancel_handler = None
|
||||||
self.dialog.destroy()
|
self.dialog.destroy()
|
||||||
if isinstance(self.ok_handler, tuple):
|
if isinstance(self.ok_handler, tuple):
|
||||||
|
@ -2041,7 +2039,7 @@ class InputDialogCheck(InputDialog):
|
||||||
self.ok_handler(user_input, self.is_checked())
|
self.ok_handler(user_input, self.is_checked())
|
||||||
|
|
||||||
def get_text(self):
|
def get_text(self):
|
||||||
return self.input_entry.get_text().decode('utf-8')
|
return self.input_entry.get_text()
|
||||||
|
|
||||||
def is_checked(self):
|
def is_checked(self):
|
||||||
"""
|
"""
|
||||||
|
@ -2110,7 +2108,7 @@ class ChangeNickDialog(InputDialogCheck):
|
||||||
def on_okbutton_clicked(self, widget):
|
def on_okbutton_clicked(self, widget):
|
||||||
nick = self.get_text()
|
nick = self.get_text()
|
||||||
if nick:
|
if nick:
|
||||||
nick = nick.decode('utf-8')
|
nick = nick
|
||||||
# send presence to room
|
# send presence to room
|
||||||
try:
|
try:
|
||||||
nick = helpers.parse_resource(nick)
|
nick = helpers.parse_resource(nick)
|
||||||
|
@ -2162,7 +2160,7 @@ class InputTextDialog(CommonInputDialog):
|
||||||
|
|
||||||
def get_text(self):
|
def get_text(self):
|
||||||
start_iter, end_iter = self.input_buffer.get_bounds()
|
start_iter, end_iter = self.input_buffer.get_bounds()
|
||||||
return self.input_buffer.get_text(start_iter, end_iter, True).decode('utf-8')
|
return self.input_buffer.get_text(start_iter, end_iter, True)
|
||||||
|
|
||||||
class DoubleInputDialog:
|
class DoubleInputDialog:
|
||||||
"""
|
"""
|
||||||
|
@ -2207,8 +2205,8 @@ class DoubleInputDialog:
|
||||||
self.cancel_handler()
|
self.cancel_handler()
|
||||||
|
|
||||||
def on_okbutton_clicked(self, widget):
|
def on_okbutton_clicked(self, widget):
|
||||||
user_input1 = self.input_entry1.get_text().decode('utf-8')
|
user_input1 = self.input_entry1.get_text()
|
||||||
user_input2 = self.input_entry2.get_text().decode('utf-8')
|
user_input2 = self.input_entry2.get_text()
|
||||||
self.cancel_handler = None
|
self.cancel_handler = None
|
||||||
self.dialog.destroy()
|
self.dialog.destroy()
|
||||||
if not self.ok_handler:
|
if not self.ok_handler:
|
||||||
|
@ -2457,7 +2455,7 @@ class JoinGroupchatWindow:
|
||||||
def on_account_combobox_changed(self, widget):
|
def on_account_combobox_changed(self, widget):
|
||||||
model = widget.get_model()
|
model = widget.get_model()
|
||||||
iter_ = widget.get_active_iter()
|
iter_ = widget.get_active_iter()
|
||||||
self.account = model[iter_][0].decode('utf-8')
|
self.account = model[iter_][0]
|
||||||
self.on_required_entry_changed(self._nickname_entry)
|
self.on_required_entry_changed(self._nickname_entry)
|
||||||
|
|
||||||
def _set_room_jid(self, room_jid):
|
def _set_room_jid(self, room_jid):
|
||||||
|
@ -2468,11 +2466,11 @@ class JoinGroupchatWindow:
|
||||||
def on_recently_combobox_changed(self, widget):
|
def on_recently_combobox_changed(self, widget):
|
||||||
model = widget.get_model()
|
model = widget.get_model()
|
||||||
iter_ = widget.get_active_iter()
|
iter_ = widget.get_active_iter()
|
||||||
room_jid = model[iter_][0].decode('utf-8')
|
room_jid = model[iter_][0]
|
||||||
self._set_room_jid(room_jid)
|
self._set_room_jid(room_jid)
|
||||||
|
|
||||||
def on_browse_rooms_button_clicked(self, widget):
|
def on_browse_rooms_button_clicked(self, widget):
|
||||||
server = self.server_comboboxentry.get_child().get_text().decode('utf-8')
|
server = self.server_comboboxentry.get_child().get_text()
|
||||||
if server in gajim.interface.instances[self.account]['disco']:
|
if server in gajim.interface.instances[self.account]['disco']:
|
||||||
gajim.interface.instances[self.account]['disco'][server].window.\
|
gajim.interface.instances[self.account]['disco'][server].window.\
|
||||||
present()
|
present()
|
||||||
|
@ -2508,12 +2506,11 @@ class JoinGroupchatWindow:
|
||||||
_('You have to choose an account from which you want to join the '
|
_('You have to choose an account from which you want to join the '
|
||||||
'groupchat.'))
|
'groupchat.'))
|
||||||
return
|
return
|
||||||
nickname = self._nickname_entry.get_text().decode('utf-8')
|
nickname = self._nickname_entry.get_text()
|
||||||
server = self.server_comboboxentry.get_child().get_text().decode('utf-8').\
|
server = self.server_comboboxentry.get_child().get_text().strip()
|
||||||
strip()
|
room = self._room_jid_entry.get_text().strip()
|
||||||
room = self._room_jid_entry.get_text().decode('utf-8').strip()
|
|
||||||
room_jid = room + '@' + server
|
room_jid = room + '@' + server
|
||||||
password = self._password_entry.get_text().decode('utf-8')
|
password = self._password_entry.get_text()
|
||||||
try:
|
try:
|
||||||
nickname = helpers.parse_resource(nickname)
|
nickname = helpers.parse_resource(nickname)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
@ -2613,7 +2610,7 @@ class SynchroniseSelectAccountDialog:
|
||||||
(model, iter_) = sel.get_selected()
|
(model, iter_) = sel.get_selected()
|
||||||
if not iter_:
|
if not iter_:
|
||||||
return
|
return
|
||||||
remote_account = model.get_value(iter_, 0).decode('utf-8')
|
remote_account = model.get_value(iter_, 0)
|
||||||
|
|
||||||
if gajim.connections[remote_account].connected < 2:
|
if gajim.connections[remote_account].connected < 2:
|
||||||
ErrorDialog(_('This account is not connected to the server'),
|
ErrorDialog(_('This account is not connected to the server'),
|
||||||
|
@ -2686,7 +2683,7 @@ class SynchroniseSelectContactsDialog:
|
||||||
while iter_:
|
while iter_:
|
||||||
if model[iter_][0]:
|
if model[iter_][0]:
|
||||||
# it is selected
|
# it is selected
|
||||||
remote_jid = model[iter_][1].decode('utf-8')
|
remote_jid = model[iter_][1]
|
||||||
message = 'I\'m synchronizing my contacts from my %s account, could you please add this address to your contact list?' % \
|
message = 'I\'m synchronizing my contacts from my %s account, could you please add this address to your contact list?' % \
|
||||||
gajim.get_hostname_from_account(self.remote_account)
|
gajim.get_hostname_from_account(self.remote_account)
|
||||||
remote_contact = gajim.contacts.get_first_contact_from_jid(
|
remote_contact = gajim.contacts.get_first_contact_from_jid(
|
||||||
|
@ -2773,11 +2770,11 @@ class ChangePasswordDialog:
|
||||||
dialog.destroy()
|
dialog.destroy()
|
||||||
self.on_response(None)
|
self.on_response(None)
|
||||||
return
|
return
|
||||||
password1 = self.password1_entry.get_text().decode('utf-8')
|
password1 = self.password1_entry.get_text()
|
||||||
if not password1:
|
if not password1:
|
||||||
ErrorDialog(_('Invalid password'), _('You must enter a password.'))
|
ErrorDialog(_('Invalid password'), _('You must enter a password.'))
|
||||||
return
|
return
|
||||||
password2 = self.password2_entry.get_text().decode('utf-8')
|
password2 = self.password2_entry.get_text()
|
||||||
if password1 != password2:
|
if password1 != password2:
|
||||||
ErrorDialog(_('Passwords do not match'),
|
ErrorDialog(_('Passwords do not match'),
|
||||||
_('The passwords typed in both fields must be identical.'))
|
_('The passwords typed in both fields must be identical.'))
|
||||||
|
@ -3129,7 +3126,7 @@ class SingleMessageWindow:
|
||||||
else:
|
else:
|
||||||
sender_list.append(i[0].jid)
|
sender_list.append(i[0].jid)
|
||||||
else:
|
else:
|
||||||
sender_list = [self.to_entry.get_text().decode('utf-8')]
|
sender_list = [self.to_entry.get_text()]
|
||||||
|
|
||||||
for to_whom_jid in sender_list:
|
for to_whom_jid in sender_list:
|
||||||
if to_whom_jid in self.completion_dict:
|
if to_whom_jid in self.completion_dict:
|
||||||
|
@ -3142,9 +3139,9 @@ class SingleMessageWindow:
|
||||||
'valid.') % to_whom_jid)
|
'valid.') % to_whom_jid)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
subject = self.subject_entry.get_text().decode('utf-8')
|
subject = self.subject_entry.get_text()
|
||||||
begin, end = self.message_tv_buffer.get_bounds()
|
begin, end = self.message_tv_buffer.get_bounds()
|
||||||
message = self.message_tv_buffer.get_text(begin, end, True).decode('utf-8')
|
message = self.message_tv_buffer.get_text(begin, end, True)
|
||||||
|
|
||||||
if '/announce/' in to_whom_jid:
|
if '/announce/' in to_whom_jid:
|
||||||
gajim.connections[self.account].send_motd(to_whom_jid, subject,
|
gajim.connections[self.account].send_motd(to_whom_jid, subject,
|
||||||
|
@ -3551,14 +3548,14 @@ class RosterItemExchangeWindow:
|
||||||
if model[iter_][0]:
|
if model[iter_][0]:
|
||||||
a+=1
|
a+=1
|
||||||
# it is selected
|
# it is selected
|
||||||
#remote_jid = model[iter_][1].decode('utf-8')
|
#remote_jid = model[iter_][1]
|
||||||
message = _('%s suggested me to add you in my roster.'
|
message = _('%s suggested me to add you in my roster.'
|
||||||
% self.jid_from)
|
% self.jid_from)
|
||||||
# keep same groups and same nickname
|
# keep same groups and same nickname
|
||||||
groups = model[iter_][3].split(', ')
|
groups = model[iter_][3].split(', ')
|
||||||
if groups == ['']:
|
if groups == ['']:
|
||||||
groups = []
|
groups = []
|
||||||
jid = model[iter_][1].decode('utf-8')
|
jid = model[iter_][1]
|
||||||
if gajim.jid_is_transport(self.jid_from):
|
if gajim.jid_is_transport(self.jid_from):
|
||||||
gajim.connections[self.account].automatically_added.append(
|
gajim.connections[self.account].automatically_added.append(
|
||||||
jid)
|
jid)
|
||||||
|
@ -3574,7 +3571,7 @@ class RosterItemExchangeWindow:
|
||||||
if model[iter_][0]:
|
if model[iter_][0]:
|
||||||
a+=1
|
a+=1
|
||||||
# it is selected
|
# it is selected
|
||||||
jid = model[iter_][1].decode('utf-8')
|
jid = model[iter_][1]
|
||||||
# keep same groups and same nickname
|
# keep same groups and same nickname
|
||||||
groups = model[iter_][3].split(', ')
|
groups = model[iter_][3].split(', ')
|
||||||
if groups == ['']:
|
if groups == ['']:
|
||||||
|
@ -3599,7 +3596,7 @@ class RosterItemExchangeWindow:
|
||||||
if model[iter_][0]:
|
if model[iter_][0]:
|
||||||
a+=1
|
a+=1
|
||||||
# it is selected
|
# it is selected
|
||||||
jid = model[iter_][1].decode('utf-8')
|
jid = model[iter_][1]
|
||||||
gajim.connections[self.account].unsubscribe(jid)
|
gajim.connections[self.account].unsubscribe(jid)
|
||||||
gajim.interface.roster.remove_contact(jid, self.account)
|
gajim.interface.roster.remove_contact(jid, self.account)
|
||||||
gajim.contacts.remove_jid(self.account, jid)
|
gajim.contacts.remove_jid(self.account, jid)
|
||||||
|
@ -4154,7 +4151,7 @@ class PrivacyListWindow:
|
||||||
self.active_rule = ''
|
self.active_rule = ''
|
||||||
else:
|
else:
|
||||||
self.active_rule = \
|
self.active_rule = \
|
||||||
self.list_of_rules_combobox.get_active_text().decode('utf-8')
|
self.list_of_rules_combobox.get_active_text()
|
||||||
if self.active_rule != '':
|
if self.active_rule != '':
|
||||||
rule_info = self.global_rules[self.active_rule]
|
rule_info = self.global_rules[self.active_rule]
|
||||||
self.edit_order_spinbutton.set_value(int(rule_info['order']))
|
self.edit_order_spinbutton.set_value(int(rule_info['order']))
|
||||||
|
@ -4952,7 +4949,7 @@ class TransformChatToMUC:
|
||||||
guests = self.guests_treeview.get_selection().get_selected_rows()
|
guests = self.guests_treeview.get_selection().get_selected_rows()
|
||||||
for guest in guests[1]:
|
for guest in guests[1]:
|
||||||
iter_ = self.store.get_iter(guest)
|
iter_ = self.store.get_iter(guest)
|
||||||
guest_list.append(self.store[iter_][2].decode('utf-8'))
|
guest_list.append(self.store[iter_][2])
|
||||||
for guest in self.auto_jids:
|
for guest in self.auto_jids:
|
||||||
guest_list.append(guest)
|
guest_list.append(guest)
|
||||||
room_jid = obj.room_id + '@' + obj.server
|
room_jid = obj.room_id + '@' + obj.server
|
||||||
|
|
52
src/disco.py
52
src/disco.py
|
@ -800,7 +800,7 @@ _('This type of service does not contain any items to browse.'))
|
||||||
def on_address_comboboxentry_changed(self, widget):
|
def on_address_comboboxentry_changed(self, widget):
|
||||||
if self.address_comboboxentry.get_active() != -1:
|
if self.address_comboboxentry.get_active() != -1:
|
||||||
# user selected one of the entries so do auto-visit
|
# user selected one of the entries so do auto-visit
|
||||||
jid = self.address_comboboxentry.get_child().get_text().decode('utf-8')
|
jid = self.address_comboboxentry.get_child().get_text()
|
||||||
try:
|
try:
|
||||||
jid = helpers.parse_jid(jid)
|
jid = helpers.parse_jid(jid)
|
||||||
except helpers.InvalidFormat, s:
|
except helpers.InvalidFormat, s:
|
||||||
|
@ -810,7 +810,7 @@ _('This type of service does not contain any items to browse.'))
|
||||||
self.travel(jid, '')
|
self.travel(jid, '')
|
||||||
|
|
||||||
def on_go_button_clicked(self, widget):
|
def on_go_button_clicked(self, widget):
|
||||||
jid = self.address_comboboxentry.get_child().get_text().decode('utf-8')
|
jid = self.address_comboboxentry.get_child().get_text()
|
||||||
try:
|
try:
|
||||||
jid = helpers.parse_jid(jid)
|
jid = helpers.parse_jid(jid)
|
||||||
except helpers.InvalidFormat, s:
|
except helpers.InvalidFormat, s:
|
||||||
|
@ -998,9 +998,9 @@ class AgentBrowser:
|
||||||
model, iter_ = self.window.services_treeview.get_selection().get_selected()
|
model, iter_ = self.window.services_treeview.get_selection().get_selected()
|
||||||
if not iter_:
|
if not iter_:
|
||||||
return
|
return
|
||||||
jid = model[iter_][0].decode('utf-8')
|
jid = model[iter_][0]
|
||||||
if jid:
|
if jid:
|
||||||
node = model[iter_][1].decode('utf-8')
|
node = model[iter_][1]
|
||||||
self.window.open(jid, node)
|
self.window.open(jid, node)
|
||||||
|
|
||||||
def update_actions(self):
|
def update_actions(self):
|
||||||
|
@ -1012,8 +1012,8 @@ class AgentBrowser:
|
||||||
model, iter_ = self.window.services_treeview.get_selection().get_selected()
|
model, iter_ = self.window.services_treeview.get_selection().get_selected()
|
||||||
if not iter_:
|
if not iter_:
|
||||||
return
|
return
|
||||||
jid = model[iter_][0].decode('utf-8')
|
jid = model[iter_][0]
|
||||||
node = model[iter_][1].decode('utf-8')
|
node = model[iter_][1]
|
||||||
if jid:
|
if jid:
|
||||||
self.cache.get_info(jid, node, self._update_actions, nofetch = True)
|
self.cache.get_info(jid, node, self._update_actions, nofetch = True)
|
||||||
|
|
||||||
|
@ -1035,8 +1035,8 @@ class AgentBrowser:
|
||||||
model, iter_ = self.window.services_treeview.get_selection().get_selected()
|
model, iter_ = self.window.services_treeview.get_selection().get_selected()
|
||||||
if not iter_:
|
if not iter_:
|
||||||
return
|
return
|
||||||
jid = model[iter_][0].decode('utf-8')
|
jid = model[iter_][0]
|
||||||
node = model[iter_][1].decode('utf-8')
|
node = model[iter_][1]
|
||||||
if jid:
|
if jid:
|
||||||
self.cache.get_info(jid, node, self._default_action, nofetch = True)
|
self.cache.get_info(jid, node, self._default_action, nofetch = True)
|
||||||
|
|
||||||
|
@ -1077,8 +1077,8 @@ class AgentBrowser:
|
||||||
"""
|
"""
|
||||||
iter_ = self.model.get_iter_first()
|
iter_ = self.model.get_iter_first()
|
||||||
while iter_:
|
while iter_:
|
||||||
cjid = self.model.get_value(iter_, 0).decode('utf-8')
|
cjid = self.model.get_value(iter_, 0)
|
||||||
cnode = self.model.get_value(iter_, 1).decode('utf-8')
|
cnode = self.model.get_value(iter_, 1)
|
||||||
if jid == cjid and node == cnode:
|
if jid == cjid and node == cnode:
|
||||||
break
|
break
|
||||||
iter_ = self.model.iter_next(iter_)
|
iter_ = self.model.iter_next(iter_)
|
||||||
|
@ -1226,10 +1226,10 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
# These can be None, apparently
|
# These can be None, apparently
|
||||||
descr1 = model.get_value(iter1, 3)
|
descr1 = model.get_value(iter1, 3)
|
||||||
if descr1:
|
if descr1:
|
||||||
descr1 = descr1.decode('utf-8')
|
descr1 = descr1
|
||||||
descr2 = model.get_value(iter2, 3)
|
descr2 = model.get_value(iter2, 3)
|
||||||
if descr2:
|
if descr2:
|
||||||
descr2 = descr2.decode('utf-8')
|
descr2 = descr2
|
||||||
# Compare strings
|
# Compare strings
|
||||||
return cmp(descr1, descr2)
|
return cmp(descr1, descr2)
|
||||||
return statecmp
|
return statecmp
|
||||||
|
@ -1402,7 +1402,7 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
model, iter_ = self.window.services_treeview.get_selection().get_selected()
|
model, iter_ = self.window.services_treeview.get_selection().get_selected()
|
||||||
if not iter_:
|
if not iter_:
|
||||||
return
|
return
|
||||||
service = model[iter_][0].decode('utf-8')
|
service = model[iter_][0]
|
||||||
if service in gajim.interface.instances[self.account]['search']:
|
if service in gajim.interface.instances[self.account]['search']:
|
||||||
gajim.interface.instances[self.account]['search'][service].window.\
|
gajim.interface.instances[self.account]['search'][service].window.\
|
||||||
present()
|
present()
|
||||||
|
@ -1428,8 +1428,8 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
model, iter_ = self.window.services_treeview.get_selection().get_selected()
|
model, iter_ = self.window.services_treeview.get_selection().get_selected()
|
||||||
if not iter_:
|
if not iter_:
|
||||||
return
|
return
|
||||||
service = model[iter_][0].decode('utf-8')
|
service = model[iter_][0]
|
||||||
node = model[iter_][1].decode('utf-8')
|
node = model[iter_][1]
|
||||||
adhoc_commands.CommandWindow(self.account, service, commandnode=node)
|
adhoc_commands.CommandWindow(self.account, service, commandnode=node)
|
||||||
|
|
||||||
def on_register_button_clicked(self, widget = None):
|
def on_register_button_clicked(self, widget = None):
|
||||||
|
@ -1440,7 +1440,7 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
model, iter_ = self.window.services_treeview.get_selection().get_selected()
|
model, iter_ = self.window.services_treeview.get_selection().get_selected()
|
||||||
if not iter_:
|
if not iter_:
|
||||||
return
|
return
|
||||||
jid = model[iter_][0].decode('utf-8')
|
jid = model[iter_][0]
|
||||||
if jid:
|
if jid:
|
||||||
gajim.connections[self.account].request_register_agent_info(jid)
|
gajim.connections[self.account].request_register_agent_info(jid)
|
||||||
self.window.destroy(chain = True)
|
self.window.destroy(chain = True)
|
||||||
|
@ -1453,7 +1453,7 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
model, iter_ = self.window.services_treeview.get_selection().get_selected()
|
model, iter_ = self.window.services_treeview.get_selection().get_selected()
|
||||||
if not iter_:
|
if not iter_:
|
||||||
return
|
return
|
||||||
service = model[iter_][0].decode('utf-8')
|
service = model[iter_][0]
|
||||||
if 'join_gc' not in gajim.interface.instances[self.account]:
|
if 'join_gc' not in gajim.interface.instances[self.account]:
|
||||||
try:
|
try:
|
||||||
dialogs.JoinGroupchatWindow(self.account, service)
|
dialogs.JoinGroupchatWindow(self.account, service)
|
||||||
|
@ -1486,7 +1486,7 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
self.register_button.set_sensitive(True)
|
self.register_button.set_sensitive(True)
|
||||||
# Guess what kind of service we're dealing with
|
# Guess what kind of service we're dealing with
|
||||||
if self.browse_button:
|
if self.browse_button:
|
||||||
jid = model[iter_][0].decode('utf-8')
|
jid = model[iter_][0]
|
||||||
type_ = gajim.get_transport_name_from_jid(jid,
|
type_ = gajim.get_transport_name_from_jid(jid,
|
||||||
use_config_setting = False)
|
use_config_setting = False)
|
||||||
if type_:
|
if type_:
|
||||||
|
@ -1614,7 +1614,7 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
cat = self._friendly_category(cat, type_)[0]
|
cat = self._friendly_category(cat, type_)[0]
|
||||||
iter_ = self.model.get_iter_first()
|
iter_ = self.model.get_iter_first()
|
||||||
while iter_:
|
while iter_:
|
||||||
if self.model.get_value(iter_, 3).decode('utf-8') == cat:
|
if self.model.get_value(iter_, 3) == cat:
|
||||||
break
|
break
|
||||||
iter_ = self.model.iter_next(iter_)
|
iter_ = self.model.iter_next(iter_)
|
||||||
if iter_:
|
if iter_:
|
||||||
|
@ -1627,8 +1627,8 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
while cat_iter and not iter_:
|
while cat_iter and not iter_:
|
||||||
iter_ = self.model.iter_children(cat_iter)
|
iter_ = self.model.iter_children(cat_iter)
|
||||||
while iter_:
|
while iter_:
|
||||||
cjid = self.model.get_value(iter_, 0).decode('utf-8')
|
cjid = self.model.get_value(iter_, 0)
|
||||||
cnode = self.model.get_value(iter_, 1).decode('utf-8')
|
cnode = self.model.get_value(iter_, 1)
|
||||||
if jid == cjid and node == cnode:
|
if jid == cjid and node == cnode:
|
||||||
break
|
break
|
||||||
iter_ = self.model.iter_next(iter_)
|
iter_ = self.model.iter_next(iter_)
|
||||||
|
@ -1699,7 +1699,7 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
|
|
||||||
# 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)
|
||||||
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
|
||||||
|
@ -1819,7 +1819,7 @@ class MucBrowser(AgentBrowser):
|
||||||
if not iter:
|
if not iter:
|
||||||
return
|
return
|
||||||
name = gajim.config.get_per('accounts', self.account, 'name')
|
name = gajim.config.get_per('accounts', self.account, 'name')
|
||||||
room_jid = model[iter][0].decode('utf-8')
|
room_jid = model[iter][0]
|
||||||
bm = {
|
bm = {
|
||||||
'name': room_jid.split('@')[0],
|
'name': room_jid.split('@')[0],
|
||||||
'jid': room_jid,
|
'jid': room_jid,
|
||||||
|
@ -1853,7 +1853,7 @@ class MucBrowser(AgentBrowser):
|
||||||
model, iter_ = self.window.services_treeview.get_selection().get_selected()
|
model, iter_ = self.window.services_treeview.get_selection().get_selected()
|
||||||
if not iter_:
|
if not iter_:
|
||||||
return
|
return
|
||||||
service = model[iter_][0].decode('utf-8')
|
service = model[iter_][0]
|
||||||
if 'join_gc' not in gajim.interface.instances[self.account]:
|
if 'join_gc' not in gajim.interface.instances[self.account]:
|
||||||
try:
|
try:
|
||||||
dialogs.JoinGroupchatWindow(self.account, service)
|
dialogs.JoinGroupchatWindow(self.account, service)
|
||||||
|
@ -1926,8 +1926,8 @@ class MucBrowser(AgentBrowser):
|
||||||
pass
|
pass
|
||||||
while iter_ and self.model.get_path(iter_) != end:
|
while iter_ and self.model.get_path(iter_) != end:
|
||||||
if not self.model.get_value(iter_, 6):
|
if not self.model.get_value(iter_, 6):
|
||||||
jid = self.model.get_value(iter_, 0).decode('utf-8')
|
jid = self.model.get_value(iter_, 0)
|
||||||
node = self.model.get_value(iter_, 1).decode('utf-8')
|
node = self.model.get_value(iter_, 1)
|
||||||
self.cache.get_info(jid, node, self._agent_info)
|
self.cache.get_info(jid, node, self._agent_info)
|
||||||
self._fetch_source = True
|
self._fetch_source = True
|
||||||
return
|
return
|
||||||
|
|
|
@ -149,7 +149,7 @@ class FeaturesWindow:
|
||||||
if not rows:
|
if not rows:
|
||||||
return
|
return
|
||||||
path = rows[0]
|
path = rows[0]
|
||||||
feature = self.model[path][0].decode('utf-8')
|
feature = self.model[path][0]
|
||||||
text = self.features[feature][1] + '\n'
|
text = self.features[feature][1] + '\n'
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
text = text + self.features[feature][3]
|
text = text + self.features[feature][3]
|
||||||
|
|
|
@ -484,7 +484,7 @@ class FileTransfersWindow:
|
||||||
iter_ = self.get_iter_by_sid(file_props.type_, file_props.sid)
|
iter_ = self.get_iter_by_sid(file_props.type_, file_props.sid)
|
||||||
if iter_ is None:
|
if iter_ is None:
|
||||||
return
|
return
|
||||||
self.model[iter_][C_SID].decode('utf-8')
|
self.model[iter_][C_SID]
|
||||||
if status == 'stop':
|
if status == 'stop':
|
||||||
file_props.stopped = True
|
file_props.stopped = True
|
||||||
elif status == 'ok':
|
elif status == 'ok':
|
||||||
|
@ -677,7 +677,7 @@ class FileTransfersWindow:
|
||||||
"""
|
"""
|
||||||
iter_ = self.model.get_iter_first()
|
iter_ = self.model.get_iter_first()
|
||||||
while iter_:
|
while iter_:
|
||||||
if typ + sid == self.model[iter_][C_SID].decode('utf-8'):
|
if typ + sid == self.model[iter_][C_SID]:
|
||||||
return iter_
|
return iter_
|
||||||
iter_ = self.model.iter_next(iter_)
|
iter_ = self.model.iter_next(iter_)
|
||||||
|
|
||||||
|
@ -769,7 +769,7 @@ class FileTransfersWindow:
|
||||||
except Exception:
|
except Exception:
|
||||||
self.tooltip.hide_tooltip()
|
self.tooltip.hide_tooltip()
|
||||||
return
|
return
|
||||||
sid = self.model[iter_][C_SID].decode('utf-8')
|
sid = self.model[iter_][C_SID]
|
||||||
file_props = FilesProp.getFilePropByType(sid[0], sid[1:])
|
file_props = FilesProp.getFilePropByType(sid[0], sid[1:])
|
||||||
if file_props is not None:
|
if file_props is not None:
|
||||||
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
||||||
|
@ -824,7 +824,7 @@ class FileTransfersWindow:
|
||||||
self.set_all_insensitive()
|
self.set_all_insensitive()
|
||||||
return
|
return
|
||||||
current_iter = self.model.get_iter(path)
|
current_iter = self.model.get_iter(path)
|
||||||
sid = self.model[current_iter][C_SID].decode('utf-8')
|
sid = self.model[current_iter][C_SID]
|
||||||
file_props = FilesProp.getFilePropByType(sid[0], sid[1:])
|
file_props = FilesProp.getFilePropByType(sid[0], sid[1:])
|
||||||
self.remove_menuitem.set_sensitive(is_row_selected)
|
self.remove_menuitem.set_sensitive(is_row_selected)
|
||||||
self.open_folder_menuitem.set_sensitive(is_row_selected)
|
self.open_folder_menuitem.set_sensitive(is_row_selected)
|
||||||
|
@ -882,7 +882,7 @@ class FileTransfersWindow:
|
||||||
i = len(self.model) - 1
|
i = len(self.model) - 1
|
||||||
while i >= 0:
|
while i >= 0:
|
||||||
iter_ = self.model.get_iter((i))
|
iter_ = self.model.get_iter((i))
|
||||||
sid = self.model[iter_][C_SID].decode('utf-8')
|
sid = self.model[iter_][C_SID]
|
||||||
file_props = FilesProp.getFilePropByType(sid[0], sid[1:])
|
file_props = FilesProp.getFilePropByType(sid[0], sid[1:])
|
||||||
if is_transfer_stopped(file_props):
|
if is_transfer_stopped(file_props):
|
||||||
self._remove_transfer(iter_, sid, file_props)
|
self._remove_transfer(iter_, sid, file_props)
|
||||||
|
@ -917,7 +917,7 @@ class FileTransfersWindow:
|
||||||
if selected is None or selected[1] is None:
|
if selected is None or selected[1] is None:
|
||||||
return
|
return
|
||||||
s_iter = selected[1]
|
s_iter = selected[1]
|
||||||
sid = self.model[s_iter][C_SID].decode('utf-8')
|
sid = self.model[s_iter][C_SID]
|
||||||
file_props = FilesProp.getFilePropByType(sid[0], sid[1:])
|
file_props = FilesProp.getFilePropByType(sid[0], sid[1:])
|
||||||
if is_transfer_paused(file_props):
|
if is_transfer_paused(file_props):
|
||||||
file_props.last_time = time.time()
|
file_props.last_time = time.time()
|
||||||
|
@ -939,7 +939,7 @@ class FileTransfersWindow:
|
||||||
if selected is None or selected[1] is None:
|
if selected is None or selected[1] is None:
|
||||||
return
|
return
|
||||||
s_iter = selected[1]
|
s_iter = selected[1]
|
||||||
sid = self.model[s_iter][C_SID].decode('utf-8')
|
sid = self.model[s_iter][C_SID]
|
||||||
file_props = FilesProp.getFilePropByType(sid[0], sid[1:])
|
file_props = FilesProp.getFilePropByType(sid[0], sid[1:])
|
||||||
account = file_props.tt_account
|
account = file_props.tt_account
|
||||||
if account not in gajim.connections:
|
if account not in gajim.connections:
|
||||||
|
@ -958,7 +958,7 @@ class FileTransfersWindow:
|
||||||
# as it was before setting the timeout
|
# as it was before setting the timeout
|
||||||
if props and self.tooltip.id == props[0]:
|
if props and self.tooltip.id == props[0]:
|
||||||
iter_ = self.model.get_iter(props[0])
|
iter_ = self.model.get_iter(props[0])
|
||||||
sid = self.model[iter_][C_SID].decode('utf-8')
|
sid = self.model[iter_][C_SID]
|
||||||
file_props = FilesProp.getFilePropByType(sid[0], sid[1:])
|
file_props = FilesProp.getFilePropByType(sid[0], sid[1:])
|
||||||
# bounding rectangle of coordinates for the cell within the treeview
|
# bounding rectangle of coordinates for the cell within the treeview
|
||||||
rect = self.tree.get_cell_area(props[0], props[1])
|
rect = self.tree.get_cell_area(props[0], props[1])
|
||||||
|
@ -1046,7 +1046,7 @@ class FileTransfersWindow:
|
||||||
if not selected or not selected[1]:
|
if not selected or not selected[1]:
|
||||||
return
|
return
|
||||||
s_iter = selected[1]
|
s_iter = selected[1]
|
||||||
sid = self.model[s_iter][C_SID].decode('utf-8')
|
sid = self.model[s_iter][C_SID]
|
||||||
file_props = FilesProp.getFilePropByType(sid[0], sid[1:])
|
file_props = FilesProp.getFilePropByType(sid[0], sid[1:])
|
||||||
if not file_props.file_name:
|
if not file_props.file_name:
|
||||||
return
|
return
|
||||||
|
@ -1068,7 +1068,7 @@ class FileTransfersWindow:
|
||||||
if not selected or not selected[1]:
|
if not selected or not selected[1]:
|
||||||
return
|
return
|
||||||
s_iter = selected[1]
|
s_iter = selected[1]
|
||||||
sid = self.model[s_iter][C_SID].decode('utf-8')
|
sid = self.model[s_iter][C_SID]
|
||||||
file_props = FilesProp.getFilePropByType(sid[0], sid[1:])
|
file_props = FilesProp.getFilePropByType(sid[0], sid[1:])
|
||||||
self._remove_transfer(s_iter, sid, file_props)
|
self._remove_transfer(s_iter, sid, file_props)
|
||||||
self.set_all_insensitive()
|
self.set_all_insensitive()
|
||||||
|
|
|
@ -89,8 +89,7 @@ class GajimThemesWindow:
|
||||||
def on_theme_cell_edited(self, cell, row, new_name):
|
def on_theme_cell_edited(self, cell, row, new_name):
|
||||||
model = self.themes_tree.get_model()
|
model = self.themes_tree.get_model()
|
||||||
iter_ = model.get_iter_from_string(row)
|
iter_ = model.get_iter_from_string(row)
|
||||||
old_name = model.get_value(iter_, 0).decode('utf-8')
|
old_name = model.get_value(iter_, 0)
|
||||||
new_name = new_name.decode('utf-8')
|
|
||||||
if old_name == new_name:
|
if old_name == new_name:
|
||||||
return
|
return
|
||||||
if old_name == 'default':
|
if old_name == 'default':
|
||||||
|
@ -150,7 +149,7 @@ class GajimThemesWindow:
|
||||||
self.theme_options_vbox.set_sensitive(False)
|
self.theme_options_vbox.set_sensitive(False)
|
||||||
self.theme_options_table.set_sensitive(False)
|
self.theme_options_table.set_sensitive(False)
|
||||||
return
|
return
|
||||||
self.current_theme = model.get_value(iter_, 0).decode('utf-8')
|
self.current_theme = model.get_value(iter_, 0)
|
||||||
self.current_theme = self.current_theme.replace(' ', '_')
|
self.current_theme = self.current_theme.replace(' ', '_')
|
||||||
self.set_theme_options(self.current_theme)
|
self.set_theme_options(self.current_theme)
|
||||||
if self.current_theme == 'default':
|
if self.current_theme == 'default':
|
||||||
|
|
|
@ -364,7 +364,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
self.handlers[id_] = widget
|
self.handlers[id_] = widget
|
||||||
|
|
||||||
self.room_jid = self.contact.jid
|
self.room_jid = self.contact.jid
|
||||||
self.nick = contact.name.decode('utf-8')
|
self.nick = contact.name
|
||||||
self.new_nick = ''
|
self.new_nick = ''
|
||||||
self.name = ''
|
self.name = ''
|
||||||
for bm in gajim.connections[self.account].bookmarks:
|
for bm in gajim.connections[self.account].bookmarks:
|
||||||
|
@ -528,8 +528,6 @@ class GroupchatControl(ChatControlBase):
|
||||||
nick2 = model[iter2][C_NICK]
|
nick2 = model[iter2][C_NICK]
|
||||||
if not nick1 or not nick2:
|
if not nick1 or not nick2:
|
||||||
return 0
|
return 0
|
||||||
nick1 = nick1.decode('utf-8')
|
|
||||||
nick2 = nick2.decode('utf-8')
|
|
||||||
if type1 == 'role':
|
if type1 == 'role':
|
||||||
return locale.strcoll(nick1, nick2)
|
return locale.strcoll(nick1, nick2)
|
||||||
if type1 == 'contact':
|
if type1 == 'contact':
|
||||||
|
@ -631,7 +629,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
"""
|
"""
|
||||||
# Get the room_jid from treeview
|
# Get the room_jid from treeview
|
||||||
for contact in self.iter_contact_rows():
|
for contact in self.iter_contact_rows():
|
||||||
nick = contact[C_NICK].decode('utf-8')
|
nick = contact[C_NICK]
|
||||||
self.draw_contact(nick)
|
self.draw_contact(nick)
|
||||||
|
|
||||||
def on_list_treeview_selection_changed(self, selection):
|
def on_list_treeview_selection_changed(self, selection):
|
||||||
|
@ -643,7 +641,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
self._last_selected_contact = None
|
self._last_selected_contact = None
|
||||||
return
|
return
|
||||||
contact = model[selected_iter]
|
contact = model[selected_iter]
|
||||||
nick = contact[C_NICK].decode('utf-8')
|
nick = contact[C_NICK]
|
||||||
self._last_selected_contact = nick
|
self._last_selected_contact = nick
|
||||||
if contact[C_TYPE] != 'contact':
|
if contact[C_TYPE] != 'contact':
|
||||||
return
|
return
|
||||||
|
@ -1042,7 +1040,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
while role_iter:
|
while role_iter:
|
||||||
user_iter = self.model.iter_children(role_iter)
|
user_iter = self.model.iter_children(role_iter)
|
||||||
while user_iter:
|
while user_iter:
|
||||||
if nick == self.model[user_iter][C_NICK].decode('utf-8'):
|
if nick == self.model[user_iter][C_NICK]:
|
||||||
return user_iter
|
return user_iter
|
||||||
else:
|
else:
|
||||||
user_iter = self.model.iter_next(user_iter)
|
user_iter = self.model.iter_next(user_iter)
|
||||||
|
@ -1379,7 +1377,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
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]
|
||||||
|
|
||||||
ctrl = self._start_private_message(nick)
|
ctrl = self._start_private_message(nick)
|
||||||
if ctrl and msg:
|
if ctrl and msg:
|
||||||
|
@ -1832,7 +1830,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
def get_role_iter(self, role):
|
def get_role_iter(self, role):
|
||||||
role_iter = self.model.get_iter_first()
|
role_iter = self.model.get_iter_first()
|
||||||
while role_iter:
|
while role_iter:
|
||||||
role_name = self.model[role_iter][C_NICK].decode('utf-8')
|
role_name = self.model[role_iter][C_NICK]
|
||||||
if role == role_name:
|
if role == role_name:
|
||||||
return role_iter
|
return role_iter
|
||||||
role_iter = self.model.iter_next(role_iter)
|
role_iter = self.model.iter_next(role_iter)
|
||||||
|
@ -2137,7 +2135,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
type_ = model[iter_][2]
|
type_ = model[iter_][2]
|
||||||
if type_ != 'contact': # source is not a contact
|
if type_ != 'contact': # source is not a contact
|
||||||
return
|
return
|
||||||
contact_jid = data.decode('utf-8')
|
contact_jid = data
|
||||||
gajim.connections[self.account].send_invite(self.room_jid, contact_jid)
|
gajim.connections[self.account].send_invite(self.room_jid, contact_jid)
|
||||||
self.print_conversation(_('%(jid)s has been invited in this room') % {
|
self.print_conversation(_('%(jid)s has been invited in this room') % {
|
||||||
'jid': contact_jid}, graphics=False)
|
'jid': contact_jid}, graphics=False)
|
||||||
|
@ -2311,7 +2309,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
"""
|
"""
|
||||||
Make contact's popup menu
|
Make contact's popup menu
|
||||||
"""
|
"""
|
||||||
nick = self.model[iter_][C_NICK].decode('utf-8')
|
nick = self.model[iter_][C_NICK]
|
||||||
c = gajim.contacts.get_gc_contact(self.account, self.room_jid, nick)
|
c = gajim.contacts.get_gc_contact(self.account, self.room_jid, nick)
|
||||||
fjid = self.room_jid + '/' + nick
|
fjid = self.room_jid + '/' + nick
|
||||||
jid = c.jid
|
jid = c.jid
|
||||||
|
@ -2478,7 +2476,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
else:
|
else:
|
||||||
widget.expand_row(path, False)
|
widget.expand_row(path, False)
|
||||||
else: # We want to send a private message
|
else: # We want to send a private message
|
||||||
nick = self.model[path][C_NICK].decode('utf-8')
|
nick = self.model[path][C_NICK]
|
||||||
self._start_private_message(nick)
|
self._start_private_message(nick)
|
||||||
|
|
||||||
def on_list_treeview_row_activated(self, widget, path, col=0):
|
def on_list_treeview_row_activated(self, widget, path, col=0):
|
||||||
|
@ -2511,7 +2509,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
widget.get_selection().select_path(path)
|
widget.get_selection().select_path(path)
|
||||||
iter_ = self.model.get_iter(path)
|
iter_ = self.model.get_iter(path)
|
||||||
if len(path) == 2:
|
if len(path) == 2:
|
||||||
nick = self.model[iter_][C_NICK].decode('utf-8')
|
nick = self.model[iter_][C_NICK]
|
||||||
self._start_private_message(nick)
|
self._start_private_message(nick)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -2521,7 +2519,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
iter_ = self.model.get_iter(path)
|
iter_ = self.model.get_iter(path)
|
||||||
nick = self.model[iter_][C_NICK].decode('utf-8')
|
nick = self.model[iter_][C_NICK]
|
||||||
if not nick in gajim.contacts.get_nick_list(self.account,
|
if not nick in gajim.contacts.get_nick_list(self.account,
|
||||||
self.room_jid):
|
self.room_jid):
|
||||||
# it's a group
|
# it's a group
|
||||||
|
@ -2564,13 +2562,13 @@ class GroupchatControl(ChatControlBase):
|
||||||
except Exception:
|
except Exception:
|
||||||
self.tooltip.hide_tooltip()
|
self.tooltip.hide_tooltip()
|
||||||
return
|
return
|
||||||
typ = self.model[iter_][C_TYPE].decode('utf-8')
|
typ = self.model[iter_][C_TYPE]
|
||||||
if typ == 'contact':
|
if typ == 'contact':
|
||||||
account = self.account
|
account = self.account
|
||||||
|
|
||||||
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
||||||
self.tooltip.id = row
|
self.tooltip.id = row
|
||||||
nick = self.model[iter_][C_NICK].decode('utf-8')
|
nick = self.model[iter_][C_NICK]
|
||||||
self.tooltip.timeout = GObject.timeout_add(500,
|
self.tooltip.timeout = GObject.timeout_add(500,
|
||||||
self.show_tooltip, gajim.contacts.get_gc_contact(
|
self.show_tooltip, gajim.contacts.get_gc_contact(
|
||||||
account, self.room_jid, nick))
|
account, self.room_jid, nick))
|
||||||
|
@ -2707,8 +2705,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
connection = gajim.connections[self.account]
|
connection = gajim.connections[self.account]
|
||||||
if fjid in connection.blocked_contacts:
|
if fjid in connection.blocked_contacts:
|
||||||
return
|
return
|
||||||
new_rule = {'order': u'1', 'type': u'jid', 'action': u'deny',
|
new_rule = {'order': '1', 'type': 'jid', 'action': 'deny',
|
||||||
'value' : fjid, 'child': [u'message', u'iq', u'presence-out']}
|
'value' : fjid, 'child': ['message', 'iq', 'presence-out']}
|
||||||
connection.blocked_list.append(new_rule)
|
connection.blocked_list.append(new_rule)
|
||||||
connection.blocked_contacts.append(fjid)
|
connection.blocked_contacts.append(fjid)
|
||||||
self.draw_contact(nick)
|
self.draw_contact(nick)
|
||||||
|
|
|
@ -195,7 +195,7 @@ def get_default_font():
|
||||||
for line in open(xfce_config_file):
|
for line in open(xfce_config_file):
|
||||||
if line.find('name="Gtk/FontName"') != -1:
|
if line.find('name="Gtk/FontName"') != -1:
|
||||||
start = line.find('value="') + 7
|
start = line.find('value="') + 7
|
||||||
return line[start:line.find('"', start)].decode('utf-8')
|
return line[start:line.find('"', start)]
|
||||||
except Exception:
|
except Exception:
|
||||||
#we talk about file
|
#we talk about file
|
||||||
print(_('Error: cannot open %s for reading') % xfce_config_file,
|
print(_('Error: cannot open %s for reading') % xfce_config_file,
|
||||||
|
@ -211,7 +211,7 @@ def get_default_font():
|
||||||
font_name = values[0]
|
font_name = values[0]
|
||||||
font_size = values[1]
|
font_size = values[1]
|
||||||
font_string = '%s %s' % (font_name, font_size) # Verdana 9
|
font_string = '%s %s' % (font_name, font_size) # Verdana 9
|
||||||
return font_string.decode('utf-8')
|
return font_string
|
||||||
except Exception:
|
except Exception:
|
||||||
#we talk about file
|
#we talk about file
|
||||||
print(_('Error: cannot open %s for reading') % kde_config_file,
|
print(_('Error: cannot open %s for reading') % kde_config_file,
|
||||||
|
@ -684,7 +684,7 @@ def decode_filechooser_file_paths(file_paths):
|
||||||
file_path = file_path.decode(sys.getfilesystemencoding())
|
file_path = file_path.decode(sys.getfilesystemencoding())
|
||||||
except Exception:
|
except Exception:
|
||||||
try:
|
try:
|
||||||
file_path = file_path.decode('utf-8')
|
file_path = file_path
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
file_paths_list.append(file_path)
|
file_paths_list.append(file_path)
|
||||||
|
|
|
@ -1906,8 +1906,8 @@ class Interface:
|
||||||
self.sth_at_sth_dot_sth = r'\S+@\S+\.\S*[^\s)?]'
|
self.sth_at_sth_dot_sth = r'\S+@\S+\.\S*[^\s)?]'
|
||||||
|
|
||||||
# Invalid XML chars
|
# Invalid XML chars
|
||||||
self.invalid_XML_chars = u'[\x00-\x08]|[\x0b-\x0c]|[\x0e-\x1f]|'\
|
self.invalid_XML_chars = '[\x00-\x08]|[\x0b-\x0c]|[\x0e-\x1f]|'\
|
||||||
u'[\ud800-\udfff]|[\ufffe-\uffff]'
|
'[\ud800-\udfff]|[\ufffe-\uffff]'
|
||||||
|
|
||||||
def popup_emoticons_under_button(self, button, parent_win):
|
def popup_emoticons_under_button(self, button, parent_win):
|
||||||
"""
|
"""
|
||||||
|
@ -1969,7 +1969,7 @@ class Interface:
|
||||||
if not self.image_is_ok(emot_file):
|
if not self.image_is_ok(emot_file):
|
||||||
continue
|
continue
|
||||||
for emot in emots[emot_filename]:
|
for emot in emots[emot_filename]:
|
||||||
emot = emot.decode('utf-8')
|
emot = emot
|
||||||
# This avoids duplicated emoticons with the same image eg. :)
|
# This avoids duplicated emoticons with the same image eg. :)
|
||||||
# and :-)
|
# and :-)
|
||||||
if not emot_file in self.emoticons.values():
|
if not emot_file in self.emoticons.values():
|
||||||
|
|
|
@ -65,12 +65,12 @@ def parseOpts():
|
||||||
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
|
||||||
|
@ -264,7 +264,7 @@ class HistoryManager:
|
||||||
# get those jids that have at least one entry in logs
|
# get those jids that have at least one entry in logs
|
||||||
self.cur.execute('SELECT jid, jid_id FROM jids WHERE jid_id IN ('
|
self.cur.execute('SELECT jid, jid_id FROM jids WHERE jid_id IN ('
|
||||||
'SELECT distinct logs.jid_id FROM logs) ORDER BY jid')
|
'SELECT distinct logs.jid_id FROM logs) ORDER BY jid')
|
||||||
# list of tupples: [(u'aaa@bbb',), (u'cc@dd',)]
|
# list of tupples: [('aaa@bbb',), ('cc@dd',)]
|
||||||
rows = self.cur.fetchall()
|
rows = self.cur.fetchall()
|
||||||
for row in rows:
|
for row in rows:
|
||||||
self.jids_already_in.append(row[0]) # jid
|
self.jids_already_in.append(row[0]) # jid
|
||||||
|
@ -291,7 +291,7 @@ class HistoryManager:
|
||||||
path = rowref.get_path()
|
path = rowref.get_path()
|
||||||
if path is None:
|
if path is None:
|
||||||
continue
|
continue
|
||||||
jid = liststore[path][0].decode('utf-8') # jid
|
jid = liststore[path][0] # jid
|
||||||
self._fill_logs_listview(jid)
|
self._fill_logs_listview(jid)
|
||||||
|
|
||||||
def _get_jid_id(self, jid):
|
def _get_jid_id(self, jid):
|
||||||
|
@ -642,7 +642,7 @@ class HistoryManager:
|
||||||
dialog.set_transient_for(self.window)
|
dialog.set_transient_for(self.window)
|
||||||
|
|
||||||
def on_search_db_button_clicked(self, widget):
|
def on_search_db_button_clicked(self, widget):
|
||||||
text = self.search_entry.get_text().decode('utf-8')
|
text = self.search_entry.get_text()
|
||||||
if not text:
|
if not text:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -655,7 +655,7 @@ class HistoryManager:
|
||||||
def on_search_results_listview_row_activated(self, widget, path, column):
|
def on_search_results_listview_row_activated(self, widget, path, column):
|
||||||
# get log_line_id, jid_id from row we double clicked
|
# get log_line_id, jid_id from row we double clicked
|
||||||
log_line_id = self.search_results_liststore[path][0]
|
log_line_id = self.search_results_liststore[path][0]
|
||||||
jid = self.search_results_liststore[path][1].decode('utf-8')
|
jid = self.search_results_liststore[path][1]
|
||||||
# make it string as in gtk liststores I have them all as strings
|
# make it string as in gtk liststores I have them all as strings
|
||||||
# as this is what db returns so I don't have to fight with types
|
# as this is what db returns so I don't have to fight with types
|
||||||
jid_id = self._get_jid_id(jid)
|
jid_id = self._get_jid_id(jid)
|
||||||
|
|
|
@ -165,7 +165,7 @@ class HistoryWindow:
|
||||||
|
|
||||||
keys = completion_dict.keys()
|
keys = completion_dict.keys()
|
||||||
# Move the actual jid at first so we load history faster
|
# Move the actual jid at first so we load history faster
|
||||||
actual_jid = self.jid_entry.get_text().decode('utf-8')
|
actual_jid = self.jid_entry.get_text()
|
||||||
if actual_jid in keys:
|
if actual_jid in keys:
|
||||||
keys.remove(actual_jid)
|
keys.remove(actual_jid)
|
||||||
keys.insert(0, actual_jid)
|
keys.insert(0, actual_jid)
|
||||||
|
@ -244,7 +244,7 @@ class HistoryWindow:
|
||||||
# Don't disable querybox when we have changed the combobox
|
# Don't disable querybox when we have changed the combobox
|
||||||
# to GC or All and hit enter
|
# to GC or All and hit enter
|
||||||
return
|
return
|
||||||
jid = self.jid_entry.get_text().decode('utf-8')
|
jid = self.jid_entry.get_text()
|
||||||
account = None # we don't know the account, could be any. Search for it!
|
account = None # we don't know the account, could be any. Search for it!
|
||||||
self._load_history(jid, account)
|
self._load_history(jid, account)
|
||||||
self.results_window.set_property('visible', False)
|
self.results_window.set_property('visible', False)
|
||||||
|
|
|
@ -762,7 +762,7 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
|
||||||
try:
|
try:
|
||||||
self.textbuf.insert_pixbuf(self.iter,
|
self.textbuf.insert_pixbuf(self.iter,
|
||||||
self.textview.focus_out_line_pixbuf)
|
self.textview.focus_out_line_pixbuf)
|
||||||
#self._insert_text(u'\u2550'*40)
|
#self._insert_text('\u2550'*40)
|
||||||
self._jump_line()
|
self._jump_line()
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
log.debug(str('Error in hr'+e))
|
log.debug(str('Error in hr'+e))
|
||||||
|
@ -913,7 +913,7 @@ class HtmlTextView(Gtk.TextView):
|
||||||
|
|
||||||
while (search_iter.compare(end)):
|
while (search_iter.compare(end)):
|
||||||
character = search_iter.get_char()
|
character = search_iter.get_char()
|
||||||
if character == u'\ufffc':
|
if character == '\ufffc':
|
||||||
anchor = search_iter.get_child_anchor()
|
anchor = search_iter.get_child_anchor()
|
||||||
if anchor:
|
if anchor:
|
||||||
text = anchor.get_data('plaintext')
|
text = anchor.get_data('plaintext')
|
||||||
|
|
|
@ -237,7 +237,7 @@ class PluginsWindow(object):
|
||||||
model, iter = selection.get_selected()
|
model, iter = selection.get_selected()
|
||||||
if iter:
|
if iter:
|
||||||
plugin = model.get_value(iter, PLUGIN)
|
plugin = model.get_value(iter, PLUGIN)
|
||||||
plugin_name = model.get_value(iter, NAME).decode('utf-8')
|
plugin_name = model.get_value(iter, NAME)
|
||||||
is_active = model.get_value(iter, ACTIVE)
|
is_active = model.get_value(iter, ACTIVE)
|
||||||
try:
|
try:
|
||||||
gajim.plugin_manager.remove_plugin(plugin)
|
gajim.plugin_manager.remove_plugin(plugin)
|
||||||
|
|
|
@ -40,7 +40,7 @@ class GajimPlugin(object):
|
||||||
'''
|
'''
|
||||||
Base class for implementing Gajim plugins.
|
Base class for implementing Gajim plugins.
|
||||||
'''
|
'''
|
||||||
name = u''
|
name = ''
|
||||||
'''
|
'''
|
||||||
Name of plugin.
|
Name of plugin.
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ class GajimPlugin(object):
|
||||||
|
|
||||||
:type: unicode
|
:type: unicode
|
||||||
'''
|
'''
|
||||||
short_name = u''
|
short_name = ''
|
||||||
'''
|
'''
|
||||||
Short name of plugin.
|
Short name of plugin.
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ class GajimPlugin(object):
|
||||||
:todo: decide whether we really need this one, because class name (with
|
:todo: decide whether we really need this one, because class name (with
|
||||||
module name) can act as such short name
|
module name) can act as such short name
|
||||||
'''
|
'''
|
||||||
version = u''
|
version = ''
|
||||||
'''
|
'''
|
||||||
Version of plugin.
|
Version of plugin.
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ class GajimPlugin(object):
|
||||||
same plugin class but with different version and we want only the newest
|
same plugin class but with different version and we want only the newest
|
||||||
one to be active - is such policy good?
|
one to be active - is such policy good?
|
||||||
'''
|
'''
|
||||||
description = u''
|
description = ''
|
||||||
'''
|
'''
|
||||||
Plugin description.
|
Plugin description.
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ class GajimPlugin(object):
|
||||||
:todo: should we decide on any particular format of author strings?
|
:todo: should we decide on any particular format of author strings?
|
||||||
Especially: should we force format of giving author's e-mail?
|
Especially: should we force format of giving author's e-mail?
|
||||||
'''
|
'''
|
||||||
homepage = u''
|
homepage = ''
|
||||||
'''
|
'''
|
||||||
URL to plug-in's homepage.
|
URL to plug-in's homepage.
|
||||||
|
|
||||||
|
|
|
@ -344,7 +344,7 @@ class ProfileWindow:
|
||||||
'ADR_WORK_REGION', 'ADR_WORK_PCODE', 'ADR_WORK_CTRY']
|
'ADR_WORK_REGION', 'ADR_WORK_PCODE', 'ADR_WORK_CTRY']
|
||||||
vcard_ = {}
|
vcard_ = {}
|
||||||
for e in entries:
|
for e in entries:
|
||||||
txt = self.xml.get_object(e + '_entry').get_text().decode('utf-8')
|
txt = self.xml.get_object(e + '_entry').get_text()
|
||||||
if txt != '':
|
if txt != '':
|
||||||
vcard_ = self.add_to_vcard(vcard_, e, txt)
|
vcard_ = self.add_to_vcard(vcard_, e, txt)
|
||||||
|
|
||||||
|
@ -354,7 +354,7 @@ class ProfileWindow:
|
||||||
end_iter = buff.get_end_iter()
|
end_iter = buff.get_end_iter()
|
||||||
txt = buff.get_text(start_iter, end_iter, False)
|
txt = buff.get_text(start_iter, end_iter, False)
|
||||||
if txt != '':
|
if txt != '':
|
||||||
vcard_['DESC'] = txt.decode('utf-8')
|
vcard_['DESC'] = txt
|
||||||
|
|
||||||
# Avatar
|
# Avatar
|
||||||
if self.avatar_encoded:
|
if self.avatar_encoded:
|
||||||
|
|
|
@ -459,7 +459,7 @@ class RosterWindow:
|
||||||
account_group = 'MERGED'
|
account_group = 'MERGED'
|
||||||
else:
|
else:
|
||||||
account_group = account
|
account_group = account
|
||||||
group = self.model[parent_i][C_JID].decode('utf-8')
|
group = self.model[parent_i][C_JID]
|
||||||
if group in gajim.groups[account]:
|
if group in gajim.groups[account]:
|
||||||
del gajim.groups[account][group]
|
del gajim.groups[account][group]
|
||||||
to_be_removed = parent_i
|
to_be_removed = parent_i
|
||||||
|
@ -1144,8 +1144,8 @@ class RosterWindow:
|
||||||
if self.model[parent_iter][C_TYPE] != 'contact':
|
if self.model[parent_iter][C_TYPE] != 'contact':
|
||||||
# parent is not a contact
|
# parent is not a contact
|
||||||
return
|
return
|
||||||
parent_jid = self.model[parent_iter][C_JID].decode('utf-8')
|
parent_jid = self.model[parent_iter][C_JID]
|
||||||
parent_account = self.model[parent_iter][C_ACCOUNT].decode('utf-8')
|
parent_account = self.model[parent_iter][C_ACCOUNT]
|
||||||
self.draw_contact(parent_jid, parent_account)
|
self.draw_contact(parent_jid, parent_account)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -1203,7 +1203,7 @@ class RosterWindow:
|
||||||
if nb_connected_contact > 1:
|
if nb_connected_contact > 1:
|
||||||
# switch back to default writing direction
|
# switch back to default writing direction
|
||||||
name += i18n.paragraph_direction_mark(unicode(name))
|
name += i18n.paragraph_direction_mark(unicode(name))
|
||||||
name += u' (%d)' % nb_connected_contact
|
name += ' (%d)' % nb_connected_contact
|
||||||
|
|
||||||
# add status msg, if not empty, under contact name in
|
# add status msg, if not empty, under contact name in
|
||||||
# the treeview
|
# the treeview
|
||||||
|
@ -1256,8 +1256,8 @@ class RosterWindow:
|
||||||
iterC = self.model.iter_children(child_iter)
|
iterC = self.model.iter_children(child_iter)
|
||||||
while iterC:
|
while iterC:
|
||||||
# a child has awaiting messages?
|
# a child has awaiting messages?
|
||||||
jidC = self.model[iterC][C_JID].decode('utf-8')
|
jidC = self.model[iterC][C_JID]
|
||||||
accountC = self.model[iterC][C_ACCOUNT].decode('utf-8')
|
accountC = self.model[iterC][C_ACCOUNT]
|
||||||
if len(gajim.events.get_events(accountC, jidC)):
|
if len(gajim.events.get_events(accountC, jidC)):
|
||||||
icon_name = 'event'
|
icon_name = 'event'
|
||||||
break
|
break
|
||||||
|
@ -1350,7 +1350,7 @@ class RosterWindow:
|
||||||
iters = self._get_contact_iter(jid, account, model=self.model)
|
iters = self._get_contact_iter(jid, account, model=self.model)
|
||||||
if not iters or not gajim.config.get('show_avatars_in_roster'):
|
if not iters or not gajim.config.get('show_avatars_in_roster'):
|
||||||
return
|
return
|
||||||
jid = self.model[iters[0]][C_JID].decode('utf-8')
|
jid = self.model[iters[0]][C_JID]
|
||||||
pixbuf = gtkgui_helpers.get_avatar_pixbuf_from_cache(jid)
|
pixbuf = gtkgui_helpers.get_avatar_pixbuf_from_cache(jid)
|
||||||
if pixbuf in (None, 'ask'):
|
if pixbuf in (None, 'ask'):
|
||||||
scaled_pixbuf = empty_pixbuf
|
scaled_pixbuf = empty_pixbuf
|
||||||
|
@ -1496,8 +1496,8 @@ class RosterWindow:
|
||||||
def _readjust_expand_collapse_state(self):
|
def _readjust_expand_collapse_state(self):
|
||||||
def func(model, path, iter_):
|
def func(model, path, iter_):
|
||||||
type_ = model[iter_][C_TYPE]
|
type_ = model[iter_][C_TYPE]
|
||||||
acct = model[iter_][C_ACCOUNT].decode('utf-8')
|
acct = model[iter_][C_ACCOUNT]
|
||||||
jid = model[iter_][C_JID].decode('utf-8')
|
jid = model[iter_][C_JID]
|
||||||
key = None
|
key = None
|
||||||
if type_ == 'account':
|
if type_ == 'account':
|
||||||
key = acct
|
key = acct
|
||||||
|
@ -1507,7 +1507,7 @@ class RosterWindow:
|
||||||
parent_iter = model.iter_parent(iter_)
|
parent_iter = model.iter_parent(iter_)
|
||||||
ptype = model[parent_iter][C_TYPE]
|
ptype = model[parent_iter][C_TYPE]
|
||||||
if ptype == 'group':
|
if ptype == 'group':
|
||||||
grp = model[parent_iter][C_JID].decode('utf-8')
|
grp = model[parent_iter][C_JID]
|
||||||
key = acct + grp + jid
|
key = acct + grp + jid
|
||||||
if key:
|
if key:
|
||||||
if key in self.collapsed_rows:
|
if key in self.collapsed_rows:
|
||||||
|
@ -1611,11 +1611,10 @@ class RosterWindow:
|
||||||
if not account:
|
if not account:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
account = account.decode('utf-8')
|
|
||||||
jid = model[titer][C_JID]
|
jid = model[titer][C_JID]
|
||||||
if not jid:
|
if not jid:
|
||||||
return False
|
return False
|
||||||
jid = jid.decode('utf-8')
|
|
||||||
if type_ == 'group':
|
if type_ == 'group':
|
||||||
group = jid
|
group = jid
|
||||||
if group == _('Transports'):
|
if group == _('Transports'):
|
||||||
|
@ -1713,8 +1712,8 @@ class RosterWindow:
|
||||||
name2 = model[iter2][C_NAME]
|
name2 = model[iter2][C_NAME]
|
||||||
if not name1 or not name2:
|
if not name1 or not name2:
|
||||||
return 0
|
return 0
|
||||||
name1 = name1.decode('utf-8')
|
name1 = name1
|
||||||
name2 = name2.decode('utf-8')
|
name2 = name2
|
||||||
type1 = model[iter1][C_TYPE]
|
type1 = model[iter1][C_TYPE]
|
||||||
type2 = model[iter2][C_TYPE]
|
type2 = model[iter2][C_TYPE]
|
||||||
if type1 == 'self_contact':
|
if type1 == 'self_contact':
|
||||||
|
@ -1724,10 +1723,10 @@ class RosterWindow:
|
||||||
if type1 == 'group':
|
if type1 == 'group':
|
||||||
name1 = model[iter1][C_JID]
|
name1 = model[iter1][C_JID]
|
||||||
if name1:
|
if name1:
|
||||||
name1 = name1.decode('utf-8')
|
name1 = name1
|
||||||
name2 = model[iter2][C_JID]
|
name2 = model[iter2][C_JID]
|
||||||
if name2:
|
if name2:
|
||||||
name2 = name2.decode('utf-8')
|
name2 = name2
|
||||||
if name1 == _('Transports'):
|
if name1 == _('Transports'):
|
||||||
return 1
|
return 1
|
||||||
if name2 == _('Transports'):
|
if name2 == _('Transports'):
|
||||||
|
@ -1744,12 +1743,12 @@ class RosterWindow:
|
||||||
account2 = model[iter2][C_ACCOUNT]
|
account2 = model[iter2][C_ACCOUNT]
|
||||||
if not account1 or not account2:
|
if not account1 or not account2:
|
||||||
return 0
|
return 0
|
||||||
account1 = account1.decode('utf-8')
|
account1 = account1
|
||||||
account2 = account2.decode('utf-8')
|
account2 = account2
|
||||||
if type1 == 'account':
|
if type1 == 'account':
|
||||||
return locale.strcoll(account1, account2)
|
return locale.strcoll(account1, account2)
|
||||||
jid1 = model[iter1][C_JID].decode('utf-8')
|
jid1 = model[iter1][C_JID]
|
||||||
jid2 = model[iter2][C_JID].decode('utf-8')
|
jid2 = model[iter2][C_JID]
|
||||||
if type1 == 'contact':
|
if type1 == 'contact':
|
||||||
lcontact1 = gajim.contacts.get_contacts(account1, jid1)
|
lcontact1 = gajim.contacts.get_contacts(account1, jid1)
|
||||||
contact1 = gajim.contacts.get_first_contact_from_jid(account1, jid1)
|
contact1 = gajim.contacts.get_first_contact_from_jid(account1, jid1)
|
||||||
|
@ -2861,8 +2860,8 @@ class RosterWindow:
|
||||||
if model[titer][C_TYPE] in ('contact', 'self_contact'):
|
if model[titer][C_TYPE] in ('contact', 'self_contact'):
|
||||||
# we're on a contact entry in the roster
|
# we're on a contact entry in the roster
|
||||||
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
||||||
account = model[titer][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT]
|
||||||
jid = model[titer][C_JID].decode('utf-8')
|
jid = model[titer][C_JID]
|
||||||
self.tooltip.id = row
|
self.tooltip.id = row
|
||||||
contacts = gajim.contacts.get_contacts(account, jid)
|
contacts = gajim.contacts.get_contacts(account, jid)
|
||||||
connected_contacts = []
|
connected_contacts = []
|
||||||
|
@ -2877,8 +2876,8 @@ class RosterWindow:
|
||||||
self.show_tooltip, connected_contacts)
|
self.show_tooltip, connected_contacts)
|
||||||
elif model[titer][C_TYPE] == 'groupchat':
|
elif model[titer][C_TYPE] == 'groupchat':
|
||||||
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
||||||
account = model[titer][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT]
|
||||||
jid = model[titer][C_JID].decode('utf-8')
|
jid = model[titer][C_JID]
|
||||||
self.tooltip.id = row
|
self.tooltip.id = row
|
||||||
contact = gajim.contacts.get_contacts(account, jid)
|
contact = gajim.contacts.get_contacts(account, jid)
|
||||||
self.tooltip.account = account
|
self.tooltip.account = account
|
||||||
|
@ -2887,7 +2886,7 @@ class RosterWindow:
|
||||||
elif model[titer][C_TYPE] == 'account':
|
elif model[titer][C_TYPE] == 'account':
|
||||||
# we're on an account entry in the roster
|
# we're on an account entry in the roster
|
||||||
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
||||||
account = model[titer][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT]
|
||||||
if account == 'all':
|
if account == 'all':
|
||||||
self.tooltip.id = row
|
self.tooltip.id = row
|
||||||
self.tooltip.account = None
|
self.tooltip.account = None
|
||||||
|
@ -3025,9 +3024,9 @@ class RosterWindow:
|
||||||
continue
|
continue
|
||||||
accounts.append(account)
|
accounts.append(account)
|
||||||
self.send_status(account, 'offline', msg, to=contact.jid)
|
self.send_status(account, 'offline', msg, to=contact.jid)
|
||||||
new_rule = {'order': u'1', 'type': u'jid',
|
new_rule = {'order': '1', 'type': 'jid',
|
||||||
'action': u'deny', 'value' : contact.jid,
|
'action': 'deny', 'value' : contact.jid,
|
||||||
'child': [u'message', u'iq', u'presence-out']}
|
'child': ['message', 'iq', 'presence-out']}
|
||||||
gajim.connections[account].blocked_list.append(new_rule)
|
gajim.connections[account].blocked_list.append(new_rule)
|
||||||
# needed for draw_contact:
|
# needed for draw_contact:
|
||||||
gajim.connections[account].blocked_contacts.append(
|
gajim.connections[account].blocked_contacts.append(
|
||||||
|
@ -3045,9 +3044,9 @@ class RosterWindow:
|
||||||
self.draw_group(group, account)
|
self.draw_group(group, account)
|
||||||
self.send_status(account, 'offline', msg, to=contact.jid)
|
self.send_status(account, 'offline', msg, to=contact.jid)
|
||||||
self.draw_contact(contact.jid, account)
|
self.draw_contact(contact.jid, account)
|
||||||
new_rule = {'order': u'1', 'type': u'group', 'action': u'deny',
|
new_rule = {'order': '1', 'type': 'group', 'action': 'deny',
|
||||||
'value' : group, 'child': [u'message', u'iq',
|
'value' : group, 'child': ['message', 'iq',
|
||||||
u'presence-out']}
|
'presence-out']}
|
||||||
# account is the same for all when we block a group
|
# account is the same for all when we block a group
|
||||||
gajim.connections[list_[0][1]].blocked_list.append(new_rule)
|
gajim.connections[list_[0][1]].blocked_list.append(new_rule)
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
|
@ -3485,8 +3484,8 @@ class RosterWindow:
|
||||||
path = list_of_paths[0]
|
path = list_of_paths[0]
|
||||||
type_ = model[path][C_TYPE]
|
type_ = model[path][C_TYPE]
|
||||||
if type_ in ('contact', 'group', 'agent'):
|
if type_ in ('contact', 'group', 'agent'):
|
||||||
jid = model[path][C_JID].decode('utf-8')
|
jid = model[path][C_JID]
|
||||||
account = model[path][C_ACCOUNT].decode('utf-8')
|
account = model[path][C_ACCOUNT]
|
||||||
self.on_rename(widget, type_, jid, account)
|
self.on_rename(widget, type_, jid, account)
|
||||||
|
|
||||||
elif event.keyval == Gdk.KEY_Delete:
|
elif event.keyval == Gdk.KEY_Delete:
|
||||||
|
@ -3495,7 +3494,7 @@ class RosterWindow:
|
||||||
if not len(list_of_paths):
|
if not len(list_of_paths):
|
||||||
return
|
return
|
||||||
type_ = model[list_of_paths[0]][C_TYPE]
|
type_ = model[list_of_paths[0]][C_TYPE]
|
||||||
account = model[list_of_paths[0]][C_ACCOUNT].decode('utf-8')
|
account = model[list_of_paths[0]][C_ACCOUNT]
|
||||||
if type_ in ('account', 'group', 'self_contact') or \
|
if type_ in ('account', 'group', 'self_contact') or \
|
||||||
account == gajim.ZEROCONF_ACC_NAME:
|
account == gajim.ZEROCONF_ACC_NAME:
|
||||||
return
|
return
|
||||||
|
@ -3503,8 +3502,8 @@ class RosterWindow:
|
||||||
for path in list_of_paths:
|
for path in list_of_paths:
|
||||||
if model[path][C_TYPE] != type_:
|
if model[path][C_TYPE] != type_:
|
||||||
return
|
return
|
||||||
jid = model[path][C_JID].decode('utf-8')
|
jid = model[path][C_JID]
|
||||||
account = model[path][C_ACCOUNT].decode('utf-8')
|
account = model[path][C_ACCOUNT]
|
||||||
contact = gajim.contacts.get_contact_with_highest_priority(
|
contact = gajim.contacts.get_contact_with_highest_priority(
|
||||||
account, jid)
|
account, jid)
|
||||||
list_.append((contact, account))
|
list_.append((contact, account))
|
||||||
|
@ -3616,7 +3615,7 @@ class RosterWindow:
|
||||||
if type_ in ('agent', 'contact', 'self_contact', 'groupchat'):
|
if type_ in ('agent', 'contact', 'self_contact', 'groupchat'):
|
||||||
self.on_row_activated(widget, path)
|
self.on_row_activated(widget, path)
|
||||||
elif type_ == 'account':
|
elif type_ == 'account':
|
||||||
account = model[path][C_ACCOUNT].decode('utf-8')
|
account = model[path][C_ACCOUNT]
|
||||||
if account != 'all':
|
if account != 'all':
|
||||||
show = gajim.connections[account].connected
|
show = gajim.connections[account].connected
|
||||||
if show > 1: # We are connected
|
if show > 1: # We are connected
|
||||||
|
@ -3830,7 +3829,7 @@ class RosterWindow:
|
||||||
'contacts.'))
|
'contacts.'))
|
||||||
self.update_status_combobox()
|
self.update_status_combobox()
|
||||||
return
|
return
|
||||||
status = model[active][2].decode('utf-8')
|
status = model[active][2]
|
||||||
# status "desync'ed" or not
|
# status "desync'ed" or not
|
||||||
statuses_unified = helpers.statuses_unified()
|
statuses_unified = helpers.statuses_unified()
|
||||||
if (active == 7 and statuses_unified) or (active == 9 and \
|
if (active == 7 and statuses_unified) or (active == 9 and \
|
||||||
|
@ -4047,7 +4046,7 @@ class RosterWindow:
|
||||||
"""
|
"""
|
||||||
jid = contact.jid
|
jid = contact.jid
|
||||||
if resource is not None:
|
if resource is not None:
|
||||||
jid = jid + u'/' + resource
|
jid = jid + '/' + resource
|
||||||
adhoc_commands.CommandWindow(account, jid)
|
adhoc_commands.CommandWindow(account, jid)
|
||||||
|
|
||||||
def on_roster_window_focus_in_event(self, widget, event):
|
def on_roster_window_focus_in_event(self, widget, event):
|
||||||
|
@ -4095,8 +4094,8 @@ class RosterWindow:
|
||||||
for path in list_of_paths:
|
for path in list_of_paths:
|
||||||
type_ = model[path][C_TYPE]
|
type_ = model[path][C_TYPE]
|
||||||
if type_ in ('contact', 'agent'):
|
if type_ in ('contact', 'agent'):
|
||||||
jid = model[path][C_JID].decode('utf-8')
|
jid = model[path][C_JID]
|
||||||
account = model[path][C_ACCOUNT].decode('utf-8')
|
account = model[path][C_ACCOUNT]
|
||||||
contact = gajim.contacts.get_first_contact_from_jid(account,
|
contact = gajim.contacts.get_first_contact_from_jid(account,
|
||||||
jid)
|
jid)
|
||||||
self.on_info(widget, contact, account)
|
self.on_info(widget, contact, account)
|
||||||
|
@ -4109,8 +4108,8 @@ class RosterWindow:
|
||||||
path = list_of_paths[0]
|
path = list_of_paths[0]
|
||||||
type_ = model[path][C_TYPE]
|
type_ = model[path][C_TYPE]
|
||||||
if type_ in ('contact', 'agent'):
|
if type_ in ('contact', 'agent'):
|
||||||
jid = model[path][C_JID].decode('utf-8')
|
jid = model[path][C_JID]
|
||||||
account = model[path][C_ACCOUNT].decode('utf-8')
|
account = model[path][C_ACCOUNT]
|
||||||
contact = gajim.contacts.get_first_contact_from_jid(account,
|
contact = gajim.contacts.get_first_contact_from_jid(account,
|
||||||
jid)
|
jid)
|
||||||
self.on_history(widget, contact, account)
|
self.on_history(widget, contact, account)
|
||||||
|
@ -4125,7 +4124,7 @@ class RosterWindow:
|
||||||
this way)
|
this way)
|
||||||
"""
|
"""
|
||||||
model = self.modelfilter
|
model = self.modelfilter
|
||||||
account = model[path][C_ACCOUNT].decode('utf-8')
|
account = model[path][C_ACCOUNT]
|
||||||
type_ = model[path][C_TYPE]
|
type_ = model[path][C_TYPE]
|
||||||
if type_ in ('group', 'account'):
|
if type_ in ('group', 'account'):
|
||||||
if self.tree.row_expanded(path):
|
if self.tree.row_expanded(path):
|
||||||
|
@ -4133,7 +4132,7 @@ class RosterWindow:
|
||||||
else:
|
else:
|
||||||
self.tree.expand_row(path, False)
|
self.tree.expand_row(path, False)
|
||||||
return
|
return
|
||||||
jid = model[path][C_JID].decode('utf-8')
|
jid = model[path][C_JID]
|
||||||
resource = None
|
resource = None
|
||||||
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
||||||
titer = model.get_iter(path)
|
titer = model.get_iter(path)
|
||||||
|
@ -4160,7 +4159,7 @@ class RosterWindow:
|
||||||
if not first_ev and model.iter_has_child(titer):
|
if not first_ev and model.iter_has_child(titer):
|
||||||
child_iter = model.iter_children(titer)
|
child_iter = model.iter_children(titer)
|
||||||
while not first_ev and child_iter:
|
while not first_ev and child_iter:
|
||||||
child_jid = model[child_iter][C_JID].decode('utf-8')
|
child_jid = model[child_iter][C_JID]
|
||||||
first_ev = gajim.events.get_first_event(account, child_jid)
|
first_ev = gajim.events.get_first_event(account, child_jid)
|
||||||
if first_ev:
|
if first_ev:
|
||||||
jid = child_jid
|
jid = child_jid
|
||||||
|
@ -4205,11 +4204,11 @@ class RosterWindow:
|
||||||
if self.regroup: # merged accounts
|
if self.regroup: # merged accounts
|
||||||
accounts = gajim.connections.keys()
|
accounts = gajim.connections.keys()
|
||||||
else:
|
else:
|
||||||
accounts = [model[titer][C_ACCOUNT].decode('utf-8')]
|
accounts = [model[titer][C_ACCOUNT]]
|
||||||
|
|
||||||
type_ = model[titer][C_TYPE]
|
type_ = model[titer][C_TYPE]
|
||||||
if type_ == 'group':
|
if type_ == 'group':
|
||||||
group = model[titer][C_JID].decode('utf-8')
|
group = model[titer][C_JID]
|
||||||
child_model[child_iter][C_IMG] = \
|
child_model[child_iter][C_IMG] = \
|
||||||
gajim.interface.jabber_state_images['16']['opened']
|
gajim.interface.jabber_state_images['16']['opened']
|
||||||
if self.rfilter_enabled:
|
if self.rfilter_enabled:
|
||||||
|
@ -4242,8 +4241,8 @@ class RosterWindow:
|
||||||
self.tree.expand_row(path, False)
|
self.tree.expand_row(path, False)
|
||||||
elif type_ == 'contact':
|
elif type_ == 'contact':
|
||||||
# Metacontact got toggled, update icon
|
# Metacontact got toggled, update icon
|
||||||
jid = model[titer][C_JID].decode('utf-8')
|
jid = model[titer][C_JID]
|
||||||
account = model[titer][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT]
|
||||||
contact = gajim.contacts.get_contact(account, jid)
|
contact = gajim.contacts.get_contact(account, jid)
|
||||||
for group in contact.groups:
|
for group in contact.groups:
|
||||||
if account + group + jid in self.collapsed_rows:
|
if account + group + jid in self.collapsed_rows:
|
||||||
|
@ -4269,7 +4268,7 @@ class RosterWindow:
|
||||||
if self.regroup: # merged accounts
|
if self.regroup: # merged accounts
|
||||||
accounts = gajim.connections.keys()
|
accounts = gajim.connections.keys()
|
||||||
else:
|
else:
|
||||||
accounts = [model[titer][C_ACCOUNT].decode('utf-8')]
|
accounts = [model[titer][C_ACCOUNT]]
|
||||||
|
|
||||||
type_ = model[titer][C_TYPE]
|
type_ = model[titer][C_TYPE]
|
||||||
if type_ == 'group':
|
if type_ == 'group':
|
||||||
|
@ -4277,7 +4276,7 @@ class RosterWindow:
|
||||||
jabber_state_images['16']['closed']
|
jabber_state_images['16']['closed']
|
||||||
if self.rfilter_enabled:
|
if self.rfilter_enabled:
|
||||||
return
|
return
|
||||||
group = model[titer][C_JID].decode('utf-8')
|
group = model[titer][C_JID]
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
if group in gajim.groups[account]: # This account has this group
|
if group in gajim.groups[account]: # This account has this group
|
||||||
gajim.groups[account][group]['expand'] = False
|
gajim.groups[account][group]['expand'] = False
|
||||||
|
@ -4290,8 +4289,8 @@ class RosterWindow:
|
||||||
self.draw_account(account)
|
self.draw_account(account)
|
||||||
elif type_ == 'contact':
|
elif type_ == 'contact':
|
||||||
# Metacontact got toggled, update icon
|
# Metacontact got toggled, update icon
|
||||||
jid = model[titer][C_JID].decode('utf-8')
|
jid = model[titer][C_JID]
|
||||||
account = model[titer][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT]
|
||||||
contact = gajim.contacts.get_contact(account, jid)
|
contact = gajim.contacts.get_contact(account, jid)
|
||||||
groups = contact.groups
|
groups = contact.groups
|
||||||
if not groups:
|
if not groups:
|
||||||
|
@ -4323,8 +4322,6 @@ class RosterWindow:
|
||||||
if not account:
|
if not account:
|
||||||
return
|
return
|
||||||
|
|
||||||
account = account.decode('utf-8')
|
|
||||||
|
|
||||||
if type_ == 'contact':
|
if type_ == 'contact':
|
||||||
child_iter = model.convert_iter_to_child_iter(titer)
|
child_iter = model.convert_iter_to_child_iter(titer)
|
||||||
if self.model.iter_has_child(child_iter):
|
if self.model.iter_has_child(child_iter):
|
||||||
|
@ -4332,10 +4329,10 @@ class RosterWindow:
|
||||||
# redraw us to show/hide expand icon
|
# redraw us to show/hide expand icon
|
||||||
if self.filtering:
|
if self.filtering:
|
||||||
# Prevent endless loops
|
# Prevent endless loops
|
||||||
jid = model[titer][C_JID].decode('utf-8')
|
jid = model[titer][C_JID]
|
||||||
GObject.idle_add(self.draw_contact, jid, account)
|
GObject.idle_add(self.draw_contact, jid, account)
|
||||||
elif type_ == 'group':
|
elif type_ == 'group':
|
||||||
group = model[titer][C_JID].decode('utf-8')
|
group = model[titer][C_JID]
|
||||||
self._adjust_group_expand_collapse_state(group, account)
|
self._adjust_group_expand_collapse_state(group, account)
|
||||||
elif type_ == 'account':
|
elif type_ == 'account':
|
||||||
self._adjust_account_expand_collapse_state(account)
|
self._adjust_account_expand_collapse_state(account)
|
||||||
|
@ -4365,8 +4362,8 @@ class RosterWindow:
|
||||||
# if row[C_TYPE] != 'contact':
|
# if row[C_TYPE] != 'contact':
|
||||||
# self._last_selected_contact = []
|
# self._last_selected_contact = []
|
||||||
# return
|
# return
|
||||||
# jid = row[C_JID].decode('utf-8')
|
# jid = row[C_JID]
|
||||||
# account = row[C_ACCOUNT].decode('utf-8')
|
# account = row[C_ACCOUNT]
|
||||||
# self._last_selected_contact.append((jid, account))
|
# self._last_selected_contact.append((jid, account))
|
||||||
# GObject.idle_add(self.draw_contact, jid, account, True)
|
# GObject.idle_add(self.draw_contact, jid, account, True)
|
||||||
|
|
||||||
|
@ -4704,9 +4701,9 @@ class RosterWindow:
|
||||||
path_dest = (path_dest[0], path_dest[1]-1)
|
path_dest = (path_dest[0], path_dest[1]-1)
|
||||||
# destination: the row something got dropped on
|
# destination: the row something got dropped on
|
||||||
iter_dest = model.get_iter(path_dest)
|
iter_dest = model.get_iter(path_dest)
|
||||||
type_dest = model[iter_dest][C_TYPE].decode('utf-8')
|
type_dest = model[iter_dest][C_TYPE]
|
||||||
jid_dest = model[iter_dest][C_JID].decode('utf-8')
|
jid_dest = model[iter_dest][C_JID]
|
||||||
account_dest = model[iter_dest][C_ACCOUNT].decode('utf-8')
|
account_dest = model[iter_dest][C_ACCOUNT]
|
||||||
|
|
||||||
# drop on account row in merged mode, we cannot know the desired account
|
# drop on account row in merged mode, we cannot know the desired account
|
||||||
if account_dest == 'all':
|
if account_dest == 'all':
|
||||||
|
@ -4770,7 +4767,7 @@ class RosterWindow:
|
||||||
path_source = treeview.get_selection().get_selected_rows()[1][0]
|
path_source = treeview.get_selection().get_selected_rows()[1][0]
|
||||||
iter_source = model.get_iter(path_source)
|
iter_source = model.get_iter(path_source)
|
||||||
type_source = model[iter_source][C_TYPE]
|
type_source = model[iter_source][C_TYPE]
|
||||||
account_source = model[iter_source][C_ACCOUNT].decode('utf-8')
|
account_source = model[iter_source][C_ACCOUNT]
|
||||||
|
|
||||||
if gajim.config.get_per('accounts', account_source, 'is_zeroconf'):
|
if gajim.config.get_per('accounts', account_source, 'is_zeroconf'):
|
||||||
return
|
return
|
||||||
|
@ -4788,14 +4785,14 @@ class RosterWindow:
|
||||||
if account_source != account_dest:
|
if account_source != account_dest:
|
||||||
# drop on another account
|
# drop on another account
|
||||||
return
|
return
|
||||||
grp_source = model[iter_source][C_JID].decode('utf-8')
|
grp_source = model[iter_source][C_JID]
|
||||||
delimiter = gajim.connections[account_source].nested_group_delimiter
|
delimiter = gajim.connections[account_source].nested_group_delimiter
|
||||||
grp_source_list = grp_source.split(delimiter)
|
grp_source_list = grp_source.split(delimiter)
|
||||||
new_grp = None
|
new_grp = None
|
||||||
if type_dest == 'account':
|
if type_dest == 'account':
|
||||||
new_grp = grp_source_list[-1]
|
new_grp = grp_source_list[-1]
|
||||||
elif type_dest == 'group':
|
elif type_dest == 'group':
|
||||||
new_grp = model[iter_dest][C_JID].decode('utf-8') + delimiter +\
|
new_grp = model[iter_dest][C_JID] + delimiter +\
|
||||||
grp_source_list[-1]
|
grp_source_list[-1]
|
||||||
if new_grp:
|
if new_grp:
|
||||||
self.move_group(grp_source, new_grp, account_source)
|
self.move_group(grp_source, new_grp, account_source)
|
||||||
|
@ -4817,26 +4814,26 @@ class RosterWindow:
|
||||||
it = iter_source
|
it = iter_source
|
||||||
while model[it][C_TYPE] == 'contact':
|
while model[it][C_TYPE] == 'contact':
|
||||||
it = model.iter_parent(it)
|
it = model.iter_parent(it)
|
||||||
grp_source = model[it][C_JID].decode('utf-8')
|
grp_source = model[it][C_JID]
|
||||||
if grp_source in helpers.special_groups and \
|
if grp_source in helpers.special_groups and \
|
||||||
grp_source not in ('Not in Roster', 'Observers'):
|
grp_source not in ('Not in Roster', 'Observers'):
|
||||||
# a transport or a minimized groupchat was dragged
|
# a transport or a minimized groupchat was dragged
|
||||||
# we can add it to other accounts but not move it to another group,
|
# we can add it to other accounts but not move it to another group,
|
||||||
# see below
|
# see below
|
||||||
return
|
return
|
||||||
jid_source = data.decode('utf-8')
|
jid_source = data
|
||||||
c_source = gajim.contacts.get_contact_with_highest_priority(
|
c_source = gajim.contacts.get_contact_with_highest_priority(
|
||||||
account_source, jid_source)
|
account_source, jid_source)
|
||||||
|
|
||||||
# Get destination group
|
# Get destination group
|
||||||
grp_dest = None
|
grp_dest = None
|
||||||
if type_dest == 'group':
|
if type_dest == 'group':
|
||||||
grp_dest = model[iter_dest][C_JID].decode('utf-8')
|
grp_dest = model[iter_dest][C_JID]
|
||||||
elif type_dest in ('contact', 'agent'):
|
elif type_dest in ('contact', 'agent'):
|
||||||
it = iter_dest
|
it = iter_dest
|
||||||
while model[it][C_TYPE] != 'group':
|
while model[it][C_TYPE] != 'group':
|
||||||
it = model.iter_parent(it)
|
it = model.iter_parent(it)
|
||||||
grp_dest = model[it][C_JID].decode('utf-8')
|
grp_dest = model[it][C_JID]
|
||||||
if grp_dest in helpers.special_groups:
|
if grp_dest in helpers.special_groups:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -5092,8 +5089,8 @@ class RosterWindow:
|
||||||
if not model[titer][C_JID] or not model[titer][C_ACCOUNT]:
|
if not model[titer][C_JID] or not model[titer][C_ACCOUNT]:
|
||||||
# This can append when at the moment we add the row
|
# This can append when at the moment we add the row
|
||||||
return
|
return
|
||||||
jid = model[titer][C_JID].decode('utf-8')
|
jid = model[titer][C_JID]
|
||||||
account = model[titer][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT]
|
||||||
self._set_contact_row_background_color(renderer, jid, account)
|
self._set_contact_row_background_color(renderer, jid, account)
|
||||||
parent_iter = model.iter_parent(titer)
|
parent_iter = model.iter_parent(titer)
|
||||||
if model[parent_iter][C_TYPE] == 'contact':
|
if model[parent_iter][C_TYPE] == 'contact':
|
||||||
|
@ -5141,8 +5138,8 @@ class RosterWindow:
|
||||||
if not model[titer][C_JID] or not model[titer][C_ACCOUNT]:
|
if not model[titer][C_JID] or not model[titer][C_ACCOUNT]:
|
||||||
# This can append when at the moment we add the row
|
# This can append when at the moment we add the row
|
||||||
return
|
return
|
||||||
jid = model[titer][C_JID].decode('utf-8')
|
jid = model[titer][C_JID]
|
||||||
account = model[titer][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT]
|
||||||
color = None
|
color = None
|
||||||
if type_ == 'groupchat':
|
if type_ == 'groupchat':
|
||||||
ctrl = gajim.interface.minimized_controls[account].get(jid,
|
ctrl = gajim.interface.minimized_controls[account].get(jid,
|
||||||
|
@ -5190,8 +5187,8 @@ class RosterWindow:
|
||||||
if not model[titer][C_JID] or not model[titer][C_ACCOUNT]:
|
if not model[titer][C_JID] or not model[titer][C_ACCOUNT]:
|
||||||
# This can append at the moment we add the row
|
# This can append at the moment we add the row
|
||||||
return
|
return
|
||||||
jid = model[titer][C_JID].decode('utf-8')
|
jid = model[titer][C_JID]
|
||||||
account = model[titer][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT]
|
||||||
self._set_contact_row_background_color(renderer, jid, account)
|
self._set_contact_row_background_color(renderer, jid, account)
|
||||||
|
|
||||||
def _fill_avatar_pixbuf_renderer(self, column, renderer, model, titer,
|
def _fill_avatar_pixbuf_renderer(self, column, renderer, model, titer,
|
||||||
|
@ -5217,8 +5214,8 @@ class RosterWindow:
|
||||||
if not model[titer][C_JID] or not model[titer][C_ACCOUNT]:
|
if not model[titer][C_JID] or not model[titer][C_ACCOUNT]:
|
||||||
# This can append at the moment we add the row
|
# This can append at the moment we add the row
|
||||||
return
|
return
|
||||||
jid = model[titer][C_JID].decode('utf-8')
|
jid = model[titer][C_JID]
|
||||||
account = model[titer][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT]
|
||||||
self._set_contact_row_background_color(renderer, jid, account)
|
self._set_contact_row_background_color(renderer, jid, account)
|
||||||
else:
|
else:
|
||||||
renderer.set_property('visible', False)
|
renderer.set_property('visible', False)
|
||||||
|
@ -5727,7 +5724,7 @@ class RosterWindow:
|
||||||
Make account's popup menu
|
Make account's popup menu
|
||||||
"""
|
"""
|
||||||
model = self.modelfilter
|
model = self.modelfilter
|
||||||
account = model[titer][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT]
|
||||||
|
|
||||||
if account != 'all': # not in merged mode
|
if account != 'all': # not in merged mode
|
||||||
menu = self.build_account_menu(account)
|
menu = self.build_account_menu(account)
|
||||||
|
@ -5762,8 +5759,8 @@ class RosterWindow:
|
||||||
"""
|
"""
|
||||||
model = self.modelfilter
|
model = self.modelfilter
|
||||||
path = model.get_path(titer)
|
path = model.get_path(titer)
|
||||||
group = model[titer][C_JID].decode('utf-8')
|
group = model[titer][C_JID]
|
||||||
account = model[titer][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT]
|
||||||
|
|
||||||
list_ = [] # list of (jid, account) tuples
|
list_ = [] # list of (jid, account) tuples
|
||||||
list_online = [] # list of (jid, account) tuples
|
list_online = [] # list of (jid, account) tuples
|
||||||
|
@ -5923,8 +5920,8 @@ class RosterWindow:
|
||||||
Make contact's popup menu
|
Make contact's popup menu
|
||||||
"""
|
"""
|
||||||
model = self.modelfilter
|
model = self.modelfilter
|
||||||
jid = model[titer][C_JID].decode('utf-8')
|
jid = model[titer][C_JID]
|
||||||
account = model[titer][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT]
|
||||||
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
||||||
menu = gui_menu_builder.get_contact_menu(contact, account)
|
menu = gui_menu_builder.get_contact_menu(contact, account)
|
||||||
event_button = gtkgui_helpers.get_possible_button_event(event)
|
event_button = gtkgui_helpers.get_possible_button_event(event)
|
||||||
|
@ -5941,8 +5938,8 @@ class RosterWindow:
|
||||||
is_blocked = True
|
is_blocked = True
|
||||||
privacy_rules_supported = True
|
privacy_rules_supported = True
|
||||||
for titer in iters:
|
for titer in iters:
|
||||||
jid = model[titer][C_JID].decode('utf-8')
|
jid = model[titer][C_JID]
|
||||||
account = model[titer][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT]
|
||||||
if gajim.connections[account].connected < 2:
|
if gajim.connections[account].connected < 2:
|
||||||
one_account_offline = True
|
one_account_offline = True
|
||||||
if not gajim.connections[account].privacy_rules_supported:
|
if not gajim.connections[account].privacy_rules_supported:
|
||||||
|
@ -6040,9 +6037,9 @@ class RosterWindow:
|
||||||
Make transport's popup menu
|
Make transport's popup menu
|
||||||
"""
|
"""
|
||||||
model = self.modelfilter
|
model = self.modelfilter
|
||||||
jid = model[titer][C_JID].decode('utf-8')
|
jid = model[titer][C_JID]
|
||||||
path = model.get_path(titer)
|
path = model.get_path(titer)
|
||||||
account = model[titer][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT]
|
||||||
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
||||||
menu = Gtk.Menu()
|
menu = Gtk.Menu()
|
||||||
|
|
||||||
|
@ -6177,8 +6174,8 @@ class RosterWindow:
|
||||||
def make_groupchat_menu(self, event, titer):
|
def make_groupchat_menu(self, event, titer):
|
||||||
model = self.modelfilter
|
model = self.modelfilter
|
||||||
|
|
||||||
jid = model[titer][C_JID].decode('utf-8')
|
jid = model[titer][C_JID]
|
||||||
account = model[titer][C_ACCOUNT].decode('utf-8')
|
account = model[titer][C_ACCOUNT]
|
||||||
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
||||||
menu = Gtk.Menu()
|
menu = Gtk.Menu()
|
||||||
|
|
||||||
|
|
|
@ -477,7 +477,7 @@ class StatusIcon:
|
||||||
def on_change_status_message_activate(self, widget):
|
def on_change_status_message_activate(self, widget):
|
||||||
model = gajim.interface.roster.status_combobox.get_model()
|
model = gajim.interface.roster.status_combobox.get_model()
|
||||||
active = gajim.interface.roster.status_combobox.get_active()
|
active = gajim.interface.roster.status_combobox.get_active()
|
||||||
status = model[active][2].decode('utf-8')
|
status = model[active][2]
|
||||||
def on_response(message, pep_dict):
|
def on_response(message, pep_dict):
|
||||||
if message is None: # None if user press Cancel
|
if message is None: # None if user press Cancel
|
||||||
return
|
return
|
||||||
|
|
|
@ -186,13 +186,13 @@ class TestRosterWindowMetaContacts(TestRosterWindowRegrouped):
|
||||||
def test_connect_new_metacontact(self):
|
def test_connect_new_metacontact(self):
|
||||||
self.test_fill_roster_model()
|
self.test_fill_roster_model()
|
||||||
|
|
||||||
jid = u'coolstuff@gajim.org'
|
jid = 'coolstuff@gajim.org'
|
||||||
contact = gajim.contacts.create_contact(jid, account1)
|
contact = gajim.contacts.create_contact(jid, account1)
|
||||||
gajim.contacts.add_contact(account1, contact)
|
gajim.contacts.add_contact(account1, contact)
|
||||||
self.roster.add_contact(jid, account1)
|
self.roster.add_contact(jid, account1)
|
||||||
self.roster.chg_contact_status(contact, 'offline', '', account1)
|
self.roster.chg_contact_status(contact, 'offline', '', account1)
|
||||||
|
|
||||||
gajim.contacts.add_metacontact(account1, u'samejid@gajim.org',
|
gajim.contacts.add_metacontact(account1, 'samejid@gajim.org',
|
||||||
account1, jid)
|
account1, jid)
|
||||||
self.roster.chg_contact_status(contact, 'online', '', account1)
|
self.roster.chg_contact_status(contact, 'online', '', account1)
|
||||||
|
|
||||||
|
|
|
@ -1,77 +1,77 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
account1 = u'acc1'
|
account1 = 'acc1'
|
||||||
account2 = u'Cool"chârßéµö'
|
account2 = 'Cool"chârßéµö'
|
||||||
account3 = u'dingdong.org'
|
account3 = 'dingdong.org'
|
||||||
|
|
||||||
contacts = {}
|
contacts = {}
|
||||||
contacts[account1] = {
|
contacts[account1] = {
|
||||||
u'myjid@'+account1: {
|
'myjid@'+account1: {
|
||||||
'ask': None, 'groups': [], 'name': None, 'resources': {},
|
'ask': None, 'groups': [], 'name': None, 'resources': {},
|
||||||
'subscription': u'both'},
|
'subscription': 'both'},
|
||||||
u'default1@gajim.org': {
|
'default1@gajim.org': {
|
||||||
'ask': None, 'groups': [], 'name': None, 'resources': {},
|
'ask': None, 'groups': [], 'name': None, 'resources': {},
|
||||||
'subscription': u'both'},
|
'subscription': 'both'},
|
||||||
u'default2@gajim.org': {
|
'default2@gajim.org': {
|
||||||
'ask': None, 'groups': [u'GroupA',], 'name': None, 'resources': {},
|
'ask': None, 'groups': ['GroupA',], 'name': None, 'resources': {},
|
||||||
'subscription': u'both'},
|
'subscription': 'both'},
|
||||||
u'Cool"chârßéµö@gajim.org': {
|
'Cool"chârßéµö@gajim.org': {
|
||||||
'ask': None, 'groups': [u'<Cool"chârßéµö', u'GroupB'],
|
'ask': None, 'groups': ['<Cool"chârßéµö', 'GroupB'],
|
||||||
'name': None, 'resources': {}, 'subscription': u'both'},
|
'name': None, 'resources': {}, 'subscription': 'both'},
|
||||||
u'samejid@gajim.org': {
|
'samejid@gajim.org': {
|
||||||
'ask': None, 'groups': [u'GroupA',], 'name': None, 'resources': {},
|
'ask': None, 'groups': ['GroupA',], 'name': None, 'resources': {},
|
||||||
'subscription': u'both'}
|
'subscription': 'both'}
|
||||||
}
|
}
|
||||||
contacts[account2] = {
|
contacts[account2] = {
|
||||||
u'myjid@'+account2: {
|
'myjid@'+account2: {
|
||||||
'ask': None, 'groups': [], 'name': None, 'resources': {},
|
'ask': None, 'groups': [], 'name': None, 'resources': {},
|
||||||
'subscription': u'both'},
|
'subscription': 'both'},
|
||||||
u'default3@gajim.org': {
|
'default3@gajim.org': {
|
||||||
'ask': None, 'groups': [u'GroupC',], 'name': None, 'resources': {},
|
'ask': None, 'groups': ['GroupC',], 'name': None, 'resources': {},
|
||||||
'subscription': u'both'},
|
'subscription': 'both'},
|
||||||
u'asksubfrom@gajim.org': {
|
'asksubfrom@gajim.org': {
|
||||||
'ask': u'subscribe', 'groups': [u'GroupA',], 'name': None,
|
'ask': 'subscribe', 'groups': ['GroupA',], 'name': None,
|
||||||
'resources': {}, 'subscription': u'from'},
|
'resources': {}, 'subscription': 'from'},
|
||||||
u'subto@gajim.org': {
|
'subto@gajim.org': {
|
||||||
'ask': None, 'groups': [u'GroupB'], 'name': None, 'resources': {},
|
'ask': None, 'groups': ['GroupB'], 'name': None, 'resources': {},
|
||||||
'subscription': u'to'},
|
'subscription': 'to'},
|
||||||
u'samejid@gajim.org': {
|
'samejid@gajim.org': {
|
||||||
'ask': None, 'groups': [u'GroupA', u'GroupB'], 'name': None,
|
'ask': None, 'groups': ['GroupA', 'GroupB'], 'name': None,
|
||||||
'resources': {}, 'subscription': u'both'}
|
'resources': {}, 'subscription': 'both'}
|
||||||
}
|
}
|
||||||
contacts[account3] = {
|
contacts[account3] = {
|
||||||
#u'guypsych0\\40h.com@msn.dingdong.org': {
|
#'guypsych0\\40h.com@msn.dingdong.org': {
|
||||||
# 'ask': None, 'groups': [], 'name': None, 'resources': {},
|
# 'ask': None, 'groups': [], 'name': None, 'resources': {},
|
||||||
# 'subscription': u'both'},
|
# 'subscription': 'both'},
|
||||||
u'guypsych0%h.com@msn.delx.cjb.net': {
|
'guypsych0%h.com@msn.delx.cjb.net': {
|
||||||
'ask': u'subscribe', 'groups': [], 'name': None,
|
'ask': 'subscribe', 'groups': [], 'name': None,
|
||||||
'resources': {}, 'subscription': u'from'},
|
'resources': {}, 'subscription': 'from'},
|
||||||
#u'guypsych0%h.com@msn.jabber.wiretrip.org': {
|
#'guypsych0%h.com@msn.jabber.wiretrip.org': {
|
||||||
# 'ask': None, 'groups': [], 'name': None, 'resources': {},
|
# 'ask': None, 'groups': [], 'name': None, 'resources': {},
|
||||||
# 'subscription': u'to'},
|
# 'subscription': 'to'},
|
||||||
#u'guypsycho\\40g.com@gtalk.dingdong.org': {
|
#'guypsycho\\40g.com@gtalk.dingdong.org': {
|
||||||
# 'ask': None, 'groups': [], 'name': None,
|
# 'ask': None, 'groups': [], 'name': None,
|
||||||
# 'resources': {}, 'subscription': u'both'}
|
# 'resources': {}, 'subscription': 'both'}
|
||||||
}
|
}
|
||||||
|
|
||||||
# We have contacts that are not in roster but only specified in the metadata
|
# We have contacts that are not in roster but only specified in the metadata
|
||||||
metacontact_data = [
|
metacontact_data = [
|
||||||
[{'account': account3,
|
[{'account': account3,
|
||||||
'jid': u'guypsych0\\40h.com@msn.dingdong.org',
|
'jid': 'guypsych0\\40h.com@msn.dingdong.org',
|
||||||
'order': 0},
|
'order': 0},
|
||||||
{'account': account3,
|
{'account': account3,
|
||||||
'jid': u'guypsych0%h.com@msn.delx.cjb.net',
|
'jid': 'guypsych0%h.com@msn.delx.cjb.net',
|
||||||
'order': 0},
|
'order': 0},
|
||||||
{'account': account3,
|
{'account': account3,
|
||||||
'jid': u'guypsych0%h.com@msn.jabber.wiretrip.org',
|
'jid': 'guypsych0%h.com@msn.jabber.wiretrip.org',
|
||||||
'order': 0},
|
'order': 0},
|
||||||
{'account': account3,
|
{'account': account3,
|
||||||
'jid': u'guypsycho\\40g.com@gtalk.dingdong.org',
|
'jid': 'guypsycho\\40g.com@gtalk.dingdong.org',
|
||||||
'order': 0}],
|
'order': 0}],
|
||||||
|
|
||||||
[{'account': account1,
|
[{'account': account1,
|
||||||
'jid': u'samejid@gajim.org',
|
'jid': 'samejid@gajim.org',
|
||||||
'order': 0},
|
'order': 0},
|
||||||
{'account': account2,
|
{'account': account2,
|
||||||
'jid': u'samejid@gajim.org',
|
'jid': 'samejid@gajim.org',
|
||||||
'order': 0}]
|
'order': 0}]
|
||||||
]
|
]
|
||||||
|
|
|
@ -17,7 +17,7 @@ from common.socks5 import SocksQueue
|
||||||
import common
|
import common
|
||||||
|
|
||||||
|
|
||||||
session_init = '''
|
session_init = '''
|
||||||
<iq xmlns="jabber:client" to="jingleft@thiessen.im/Gajim" type="set" id="43">
|
<iq xmlns="jabber:client" to="jingleft@thiessen.im/Gajim" type="set" id="43">
|
||||||
<jingle xmlns="urn:xmpp:jingle:1" action="session-initiate" initiator="jtest@thiessen.im/Gajim" sid="38">
|
<jingle xmlns="urn:xmpp:jingle:1" action="session-initiate" initiator="jtest@thiessen.im/Gajim" sid="38">
|
||||||
<content name="fileWL1Y2JIPTM5RAD68" creator="initiator">
|
<content name="fileWL1Y2JIPTM5RAD68" creator="initiator">
|
||||||
|
@ -38,10 +38,10 @@ session_init = '''
|
||||||
</transport>
|
</transport>
|
||||||
</content>
|
</content>
|
||||||
</jingle>
|
</jingle>
|
||||||
</iq>
|
</iq>
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
transport_info = '''
|
transport_info = '''
|
||||||
<iq from='jtest@thiessen.im/Gajim'
|
<iq from='jtest@thiessen.im/Gajim'
|
||||||
id='hjdi8'
|
id='hjdi8'
|
||||||
|
@ -64,19 +64,19 @@ transport_info = '''
|
||||||
|
|
||||||
class Connection(Mock, ConnectionJingle, ConnectionSocks5Bytestream,
|
class Connection(Mock, ConnectionJingle, ConnectionSocks5Bytestream,
|
||||||
ConnectionIBBytestream):
|
ConnectionIBBytestream):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Mock.__init__(self)
|
Mock.__init__(self)
|
||||||
ConnectionJingle.__init__(self)
|
ConnectionJingle.__init__(self)
|
||||||
ConnectionSocks5Bytestream.__init__(self)
|
ConnectionSocks5Bytestream.__init__(self)
|
||||||
ConnectionIBBytestream.__init__(self)
|
ConnectionIBBytestream.__init__(self)
|
||||||
self.connected = 2 # This tells gajim we are connected
|
self.connected = 2 # This tells gajim we are connected
|
||||||
|
|
||||||
|
|
||||||
def send(self, stanza=None, when=None):
|
def send(self, stanza=None, when=None):
|
||||||
# Called when gajim wants to send something
|
# Called when gajim wants to send something
|
||||||
print str(stanza)
|
print(str(stanza))
|
||||||
|
|
||||||
class TestJingle(unittest.TestCase):
|
class TestJingle(unittest.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -92,33 +92,33 @@ class TestJingle(unittest.TestCase):
|
||||||
self.con = self.client.Connection
|
self.con = self.client.Connection
|
||||||
self.con.server_resource = None
|
self.con.server_resource = None
|
||||||
self.con.connection = Connection()
|
self.con.connection = Connection()
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Fake file_props when we recieve a file. Gajim creates a file_props
|
Fake file_props when we recieve a file. Gajim creates a file_props
|
||||||
out of a FileRequestRecieve event and from then on it changes in
|
out of a FileRequestRecieve event and from then on it changes in
|
||||||
a lot of places. It is easier to just copy it in here.
|
a lot of places. It is easier to just copy it in here.
|
||||||
If the session_initiate stanza changes, this also must change.
|
If the session_initiate stanza changes, this also must change.
|
||||||
'''
|
'''
|
||||||
self.recieve_file = {'stream-methods':
|
self.recieve_file = {'stream-methods':
|
||||||
'http://jabber.org/protocol/bytestreams',
|
'http://jabber.org/protocol/bytestreams',
|
||||||
'sender': u'jtest@thiessen.im/Gajim',
|
'sender': 'jtest@thiessen.im/Gajim',
|
||||||
'file-name': u'test_recieved_file',
|
'file-name': 'test_recieved_file',
|
||||||
'request-id': u'43', 'sid': u'39',
|
'request-id': '43', 'sid': '39',
|
||||||
'session-sid': u'38', 'session-type': 'jingle',
|
'session-sid': '38', 'session-type': 'jingle',
|
||||||
'transfered_size': [], 'receiver':
|
'transfered_size': [], 'receiver':
|
||||||
u'jingleft@thiessen.im/Gajim', 'desc': '',
|
'jingleft@thiessen.im/Gajim', 'desc': '',
|
||||||
u'size': u'2273', 'type': 'r',
|
'size': '2273', 'type': 'r',
|
||||||
'streamhosts': [{'initiator':
|
'streamhosts': [{'initiator':
|
||||||
u'jtest@thiessen.im/Gajim',
|
'jtest@thiessen.im/Gajim',
|
||||||
'target': u'jingleft@thiessen.im/Gajim',
|
'target': 'jingleft@thiessen.im/Gajim',
|
||||||
'cid': u'41', 'state': 0, 'host': u'192.168.2.100',
|
'cid': '41', 'state': 0, 'host': '192.168.2.100',
|
||||||
'type': u'direct', 'port': u'28011'},
|
'type': 'direct', 'port': '28011'},
|
||||||
{'initiator': u'jtest@thiessen.im/Gajim',
|
{'initiator': 'jtest@thiessen.im/Gajim',
|
||||||
'target': u'jingleft@thiessen.im/Gajim',
|
'target': 'jingleft@thiessen.im/Gajim',
|
||||||
'cid': u'42', 'state': 0, 'host': u'192.168.2.100',
|
'cid': '42', 'state': 0, 'host': '192.168.2.100',
|
||||||
'type': u'proxy', 'port': u'5000'}],
|
'type': 'proxy', 'port': '5000'}],
|
||||||
u'name': u'to'}
|
'name': 'to'}
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
# Unplug if needed
|
# Unplug if needed
|
||||||
if hasattr(self.dispatcher, '_owner'):
|
if hasattr(self.dispatcher, '_owner'):
|
||||||
|
@ -126,12 +126,12 @@ class TestJingle(unittest.TestCase):
|
||||||
|
|
||||||
def _simulate_connect(self):
|
def _simulate_connect(self):
|
||||||
self.dispatcher.PlugIn(self.client) # client is owner
|
self.dispatcher.PlugIn(self.client) # client is owner
|
||||||
# Simulate that we have established a connection
|
# Simulate that we have established a connection
|
||||||
self.dispatcher.StreamInit()
|
self.dispatcher.StreamInit()
|
||||||
self.dispatcher.ProcessNonBlocking("<stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client'>")
|
self.dispatcher.ProcessNonBlocking("<stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client'>")
|
||||||
|
|
||||||
def _simulate_jingle_session(self):
|
def _simulate_jingle_session(self):
|
||||||
|
|
||||||
self.dispatcher.RegisterHandler('iq', self.con._JingleCB, 'set'
|
self.dispatcher.RegisterHandler('iq', self.con._JingleCB, 'set'
|
||||||
, common.xmpp.NS_JINGLE)
|
, common.xmpp.NS_JINGLE)
|
||||||
self.dispatcher.ProcessNonBlocking(session_init)
|
self.dispatcher.ProcessNonBlocking(session_init)
|
||||||
|
@ -142,15 +142,15 @@ class TestJingle(unittest.TestCase):
|
||||||
# we have to manually simulate this behavior
|
# we have to manually simulate this behavior
|
||||||
session.approve_session()
|
session.approve_session()
|
||||||
self.con.send_file_approval(self.recieve_file)
|
self.con.send_file_approval(self.recieve_file)
|
||||||
|
|
||||||
self.dispatcher.ProcessNonBlocking(transport_info)
|
self.dispatcher.ProcessNonBlocking(transport_info)
|
||||||
|
|
||||||
|
|
||||||
def test_jingle_session(self):
|
def test_jingle_session(self):
|
||||||
self._simulate_connect()
|
self._simulate_connect()
|
||||||
self._simulate_jingle_session()
|
self._simulate_jingle_session()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -40,38 +40,38 @@ class TestModuleLevelFunctions(unittest.TestCase):
|
||||||
self.assertEqual(_user, user)
|
self.assertEqual(_user, user)
|
||||||
self.assertEqual(_passwd, passwd)
|
self.assertEqual(_passwd, passwd)
|
||||||
|
|
||||||
bosh_dict = {'bosh_content': u'text/xml; charset=utf-8',
|
bosh_dict = {'bosh_content': 'text/xml; charset=utf-8',
|
||||||
'bosh_hold': 2,
|
'bosh_hold': 2,
|
||||||
'bosh_http_pipelining': False,
|
'bosh_http_pipelining': False,
|
||||||
'bosh_uri': u'http://gajim.org:5280/http-bind',
|
'bosh_uri': 'http://gajim.org:5280/http-bind',
|
||||||
'bosh_useproxy': False,
|
'bosh_useproxy': False,
|
||||||
'bosh_wait': 30,
|
'bosh_wait': 30,
|
||||||
'bosh_wait_for_restart_response': False,
|
'bosh_wait_for_restart_response': False,
|
||||||
'host': u'172.16.99.11',
|
'host': '172.16.99.11',
|
||||||
'pass': u'pass',
|
'pass': 'pass',
|
||||||
'port': 3128,
|
'port': 3128,
|
||||||
'type': u'bosh',
|
'type': 'bosh',
|
||||||
'useauth': True,
|
'useauth': True,
|
||||||
'user': u'user'}
|
'user': 'user'}
|
||||||
check_dict(bosh_dict, host=u'gajim.org', port=5280, user=u'user',
|
check_dict(bosh_dict, host='gajim.org', port=5280, user='user',
|
||||||
passwd=u'pass')
|
passwd='pass')
|
||||||
|
|
||||||
proxy_dict = {'bosh_content': u'text/xml; charset=utf-8',
|
proxy_dict = {'bosh_content': 'text/xml; charset=utf-8',
|
||||||
'bosh_hold': 2,
|
'bosh_hold': 2,
|
||||||
'bosh_http_pipelining': False,
|
'bosh_http_pipelining': False,
|
||||||
'bosh_port': 5280,
|
'bosh_port': 5280,
|
||||||
'bosh_uri': u'',
|
'bosh_uri': '',
|
||||||
'bosh_useproxy': True,
|
'bosh_useproxy': True,
|
||||||
'bosh_wait': 30,
|
'bosh_wait': 30,
|
||||||
'bosh_wait_for_restart_response': False,
|
'bosh_wait_for_restart_response': False,
|
||||||
'host': u'172.16.99.11',
|
'host': '172.16.99.11',
|
||||||
'pass': u'pass',
|
'pass': 'pass',
|
||||||
'port': 3128,
|
'port': 3128,
|
||||||
'type': 'socks5',
|
'type': 'socks5',
|
||||||
'useauth': True,
|
'useauth': True,
|
||||||
'user': u'user'}
|
'user': 'user'}
|
||||||
check_dict(proxy_dict, host=u'172.16.99.11', port=3128, user=u'user',
|
check_dict(proxy_dict, host='172.16.99.11', port=3128, user='user',
|
||||||
passwd=u'pass')
|
passwd='pass')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue