fix indentation and 80 char width
This commit is contained in:
parent
fc5e91a039
commit
469d496dcb
1 changed files with 252 additions and 221 deletions
|
@ -86,9 +86,11 @@ def tree_cell_data_func(column, renderer, model, iter_, tv=None):
|
|||
renderer.set_property('xalign', 1) # align pixbuf to the right
|
||||
else:
|
||||
renderer.set_property('xalign', 0.5)
|
||||
if parent_iter and (model[iter_][C_AVATAR] or avatar_position == 'left'):
|
||||
if parent_iter and (model[iter_][C_AVATAR] or avatar_position == \
|
||||
'left'):
|
||||
renderer.set_property('visible', True)
|
||||
renderer.set_property('width', gajim.config.get('roster_avatar_width'))
|
||||
renderer.set_property('width', gajim.config.get(
|
||||
'roster_avatar_width'))
|
||||
else:
|
||||
renderer.set_property('visible', False)
|
||||
if parent_iter:
|
||||
|
@ -132,7 +134,8 @@ class PrivateChatControl(ChatControl):
|
|||
|
||||
def __init__(self, parent_win, gc_contact, contact, account, session):
|
||||
room_jid = gc_contact.room_jid
|
||||
room_ctrl = gajim.interface.msg_win_mgr.get_gc_control(room_jid, account)
|
||||
room_ctrl = gajim.interface.msg_win_mgr.get_gc_control(room_jid,
|
||||
account)
|
||||
if room_jid in gajim.interface.minimized_controls[account]:
|
||||
room_ctrl = gajim.interface.minimized_controls[account][room_jid]
|
||||
if room_ctrl:
|
||||
|
@ -163,8 +166,8 @@ class PrivateChatControl(ChatControl):
|
|||
dialogs.ErrorDialog(
|
||||
_('Sending private message failed'),
|
||||
#in second %s code replaces with nickname
|
||||
_('You are no longer in group chat "%(room)s" or "%(nick)s" has '
|
||||
'left.') % {'room': room, 'nick': nick})
|
||||
_('You are no longer in group chat "%(room)s" or '
|
||||
'"%(nick)s" has left.') % {'room': room, 'nick': nick})
|
||||
return
|
||||
|
||||
ChatControl.send_message(self, message, xhtml=xhtml,
|
||||
|
@ -185,7 +188,8 @@ class PrivateChatControl(ChatControl):
|
|||
|
||||
if not self.session:
|
||||
fjid = self.gc_contact.get_full_jid()
|
||||
new_sess = gajim.connections[self.account].make_new_session(fjid, type_=self.type_id)
|
||||
new_sess = gajim.connections[self.account].make_new_session(fjid,
|
||||
type_=self.type_id)
|
||||
self.set_session(new_sess)
|
||||
|
||||
self.session.negotiate_e2e(False)
|
||||
|
@ -201,7 +205,7 @@ class GroupchatControl(ChatControlBase):
|
|||
ChatControlBase.__init__(self, self.TYPE_ID, parent_win,
|
||||
'groupchat_control', contact, acct)
|
||||
|
||||
self.is_continued=is_continued
|
||||
self.is_continued = is_continued
|
||||
self.is_anonymous = True
|
||||
|
||||
# Controls the state of autorejoin.
|
||||
|
@ -222,7 +226,8 @@ class GroupchatControl(ChatControlBase):
|
|||
self.handlers[id_] = widget
|
||||
|
||||
widget = self.xml.get_object('change_subject_button')
|
||||
id_ = widget.connect('clicked', self._on_change_subject_menuitem_activate)
|
||||
id_ = widget.connect('clicked',
|
||||
self._on_change_subject_menuitem_activate)
|
||||
self.handlers[id_] = widget
|
||||
|
||||
widget = self.xml.get_object('bookmark_button')
|
||||
|
@ -240,7 +245,8 @@ class GroupchatControl(ChatControlBase):
|
|||
id_ = widget.connect('row_expanded', self.on_list_treeview_row_expanded)
|
||||
self.handlers[id_] = widget
|
||||
|
||||
id_ = widget.connect('row_collapsed', self.on_list_treeview_row_collapsed)
|
||||
id_ = widget.connect('row_collapsed',
|
||||
self.on_list_treeview_row_collapsed)
|
||||
self.handlers[id_] = widget
|
||||
|
||||
id_ = widget.connect('row_activated',
|
||||
|
@ -348,7 +354,8 @@ class GroupchatControl(ChatControlBase):
|
|||
if gajim.config.get('avatar_position_in_roster') == 'left':
|
||||
add_avatar_renderer()
|
||||
|
||||
renderer_image = cell_renderer_image.CellRendererImage(0, 0) # status img
|
||||
# status img
|
||||
renderer_image = cell_renderer_image.CellRendererImage(0, 0)
|
||||
renderer_image.set_property('width', 26)
|
||||
column.pack_start(renderer_image, expand=False)
|
||||
column.add_attribute(renderer_image, 'image', C_IMG)
|
||||
|
@ -442,7 +449,8 @@ class GroupchatControl(ChatControlBase):
|
|||
self.room_jid)):
|
||||
item = gtk.MenuItem(nick, use_underline=False)
|
||||
submenu.append(item)
|
||||
id_ = item.connect('activate', self.append_nick_in_msg_textview, nick)
|
||||
id_ = item.connect('activate', self.append_nick_in_msg_textview,
|
||||
nick)
|
||||
self.handlers[id_] = item
|
||||
|
||||
menu.show_all()
|
||||
|
@ -533,8 +541,8 @@ class GroupchatControl(ChatControlBase):
|
|||
self.attention_flag = False
|
||||
# get active color from gtk
|
||||
color = self.parent_win.notebook.style.fg[gtk.STATE_ACTIVE]
|
||||
elif chatstate == 'newmsg' and (not has_focus or not current_tab) and\
|
||||
not self.attention_flag:
|
||||
elif chatstate == 'newmsg' and (not has_focus or not current_tab) \
|
||||
and not self.attention_flag:
|
||||
color_name = gajim.config.get_per('themes', theme,
|
||||
'state_muc_msg_color')
|
||||
if color_name:
|
||||
|
@ -637,7 +645,8 @@ class GroupchatControl(ChatControlBase):
|
|||
subject = helpers.reduce_chars_newlines(self.subject, max_lines=2)
|
||||
subject = gobject.markup_escape_text(subject)
|
||||
subject_text = self.urlfinder.sub(self.make_href, subject)
|
||||
subject_text = '<span %s>%s</span>' % (font_attrs_small, subject_text)
|
||||
subject_text = '<span %s>%s</span>' % (font_attrs_small,
|
||||
subject_text)
|
||||
|
||||
# tooltip must always hold ALL the subject
|
||||
self.event_box.set_tooltip_text(self.subject)
|
||||
|
@ -807,7 +816,7 @@ class GroupchatControl(ChatControlBase):
|
|||
gajim.connections[self.account].connected > 2):
|
||||
if no_queue: # We didn't have a queue: we change icons
|
||||
model = self.list_treeview.get_model()
|
||||
state_images =\
|
||||
state_images = \
|
||||
gajim.interface.roster.get_appropriate_state_images(
|
||||
self.room_jid, icon_name='event')
|
||||
image = state_images['event']
|
||||
|
@ -821,8 +830,8 @@ class GroupchatControl(ChatControlBase):
|
|||
self.list_treeview.expand_row(path[0:1], False)
|
||||
self.list_treeview.scroll_to_cell(path)
|
||||
self.list_treeview.set_cursor(path)
|
||||
contact = gajim.contacts.get_contact_with_highest_priority(self.account, \
|
||||
self.room_jid)
|
||||
contact = gajim.contacts.get_contact_with_highest_priority(
|
||||
self.account, self.room_jid)
|
||||
if contact:
|
||||
gajim.interface.roster.draw_contact(self.room_jid, self.account)
|
||||
|
||||
|
@ -939,8 +948,8 @@ class GroupchatControl(ChatControlBase):
|
|||
def get_nb_unread_pm(self):
|
||||
nb = 0
|
||||
for nick in gajim.contacts.get_nick_list(self.account, self.room_jid):
|
||||
nb += len(gajim.events.get_events(self.account, self.room_jid + '/' + \
|
||||
nick, ['pm']))
|
||||
nb += len(gajim.events.get_events(self.account, self.room_jid + \
|
||||
'/' + nick, ['pm']))
|
||||
return nb
|
||||
|
||||
def highlighting_for_message(self, text, tim):
|
||||
|
@ -974,7 +983,8 @@ class GroupchatControl(ChatControlBase):
|
|||
does not already have it as last event. If it goes to add this line
|
||||
- remove previous line first
|
||||
"""
|
||||
win = gajim.interface.msg_win_mgr.get_window(self.room_jid, self.account)
|
||||
win = gajim.interface.msg_win_mgr.get_window(self.room_jid,
|
||||
self.account)
|
||||
if win and self.room_jid == win.get_active_jid() and\
|
||||
win.window.get_property('has-toplevel-focus') and\
|
||||
self.parent_win.get_active_control() == self:
|
||||
|
@ -1033,8 +1043,8 @@ class GroupchatControl(ChatControlBase):
|
|||
for nick in nick_list:
|
||||
# Update pm chat window
|
||||
fjid = self.room_jid + '/' + nick
|
||||
gc_contact = gajim.contacts.get_gc_contact(self.account, self.room_jid,
|
||||
nick)
|
||||
gc_contact = gajim.contacts.get_gc_contact(self.account,
|
||||
self.room_jid, nick)
|
||||
|
||||
ctrl = gajim.interface.msg_win_mgr.get_control(fjid, self.account)
|
||||
if ctrl:
|
||||
|
@ -1060,7 +1070,8 @@ class GroupchatControl(ChatControlBase):
|
|||
if self.autorejoin is None and gajim.account_is_connected(self.account):
|
||||
ar_to = gajim.config.get('muc_autorejoin_timeout')
|
||||
if ar_to:
|
||||
self.autorejoin = gobject.timeout_add_seconds(ar_to, self.rejoin)
|
||||
self.autorejoin = gobject.timeout_add_seconds(ar_to,
|
||||
self.rejoin)
|
||||
|
||||
def rejoin(self):
|
||||
if not self.autorejoin:
|
||||
|
@ -1073,8 +1084,8 @@ class GroupchatControl(ChatControlBase):
|
|||
def draw_roster(self):
|
||||
self.list_treeview.get_model().clear()
|
||||
for nick in gajim.contacts.get_nick_list(self.account, self.room_jid):
|
||||
gc_contact = gajim.contacts.get_gc_contact(self.account, self.room_jid,
|
||||
nick)
|
||||
gc_contact = gajim.contacts.get_gc_contact(self.account,
|
||||
self.room_jid, nick)
|
||||
self.add_contact_to_roster(nick, gc_contact.show, gc_contact.role,
|
||||
gc_contact.affiliation, gc_contact.status, gc_contact.jid)
|
||||
self.draw_all_roles()
|
||||
|
@ -1108,7 +1119,8 @@ class GroupchatControl(ChatControlBase):
|
|||
gc_contact = gajim.contacts.get_gc_contact(self.account, self.room_jid,
|
||||
nick)
|
||||
state_images = gajim.interface.jabber_state_images['16']
|
||||
if len(gajim.events.get_events(self.account, self.room_jid + '/' + nick)):
|
||||
if len(gajim.events.get_events(self.account, self.room_jid + '/' + \
|
||||
nick)):
|
||||
image = state_images['event']
|
||||
else:
|
||||
image = state_images[gc_contact.show]
|
||||
|
@ -1129,9 +1141,11 @@ class GroupchatControl(ChatControlBase):
|
|||
# escape markup entities and make them small italic and fg color
|
||||
color = gtkgui_helpers.get_fade_color(self.list_treeview,
|
||||
selected, focus)
|
||||
colorstring = "#%04x%04x%04x" % (color.red, color.green, color.blue)
|
||||
colorstring = "#%04x%04x%04x" % (color.red, color.green,
|
||||
color.blue)
|
||||
name += ('\n<span size="small" style="italic" foreground="%s">'
|
||||
'%s</span>') % (colorstring, gobject.markup_escape_text(status))
|
||||
'%s</span>') % (colorstring, gobject.markup_escape_text(
|
||||
status))
|
||||
|
||||
if image.get_storage_type() == gtk.IMAGE_PIXBUF and \
|
||||
gc_contact.affiliation != 'none' and gajim.config.get(
|
||||
|
@ -1207,14 +1221,17 @@ class GroupchatControl(ChatControlBase):
|
|||
nick_jid += ' (%s)' % simple_jid
|
||||
|
||||
# statusCode
|
||||
# http://www.xmpp.org/extensions/xep-0045.html#registrar-statuscodes-init
|
||||
# http://www.xmpp.org/extensions/xep-0045.html#registrar-statuscodes-\
|
||||
# init
|
||||
if statusCode:
|
||||
if '100' in statusCode:
|
||||
# Can be a message (see handle_event_gc_config_change in gajim.py)
|
||||
# Can be a message (see handle_event_gc_config_change in
|
||||
# gajim.py)
|
||||
self.print_conversation(\
|
||||
_('Any occupant is allowed to see your full JID'))
|
||||
if '170' in statusCode:
|
||||
# Can be a message (see handle_event_gc_config_change in gajim.py)
|
||||
# Can be a message (see handle_event_gc_config_change in
|
||||
# gajim.py)
|
||||
self.print_conversation(_('Room logging is enabled'))
|
||||
if '201' in statusCode:
|
||||
self.print_conversation(_('A new room has been created'))
|
||||
|
@ -1230,9 +1247,8 @@ class GroupchatControl(ChatControlBase):
|
|||
'nick': nick,
|
||||
'reason': reason }
|
||||
else:
|
||||
s = _('%(nick)s has been kicked by %(who)s: %(reason)s') % {
|
||||
'nick': nick,
|
||||
'who': actor,
|
||||
s = _('%(nick)s has been kicked by %(who)s: '
|
||||
'%(reason)s') % {'nick': nick, 'who': actor,
|
||||
'reason': reason }
|
||||
self.print_conversation(s, 'info', tim=tim, graphics=False)
|
||||
if nick == self.nick and not gajim.config.get(
|
||||
|
@ -1241,12 +1257,10 @@ class GroupchatControl(ChatControlBase):
|
|||
elif '301' in statusCode:
|
||||
if actor is None: # do not print 'banned by None'
|
||||
s = _('%(nick)s has been banned: %(reason)s') % {
|
||||
'nick': nick,
|
||||
'reason': reason }
|
||||
'nick': nick, 'reason': reason }
|
||||
else:
|
||||
s = _('%(nick)s has been banned by %(who)s: %(reason)s') % {
|
||||
'nick': nick,
|
||||
'who': actor,
|
||||
s = _('%(nick)s has been banned by %(who)s: '
|
||||
'%(reason)s') % { 'nick': nick, 'who': actor,
|
||||
'reason': reason }
|
||||
self.print_conversation(s, 'info', tim=tim, graphics=False)
|
||||
if nick == self.nick:
|
||||
|
@ -1262,24 +1276,25 @@ class GroupchatControl(ChatControlBase):
|
|||
self.room_jid)
|
||||
for nick_ in nick_list:
|
||||
fjid_ = self.room_jid + '/' + nick_
|
||||
ctrl = gajim.interface.msg_win_mgr.get_control(fjid_,
|
||||
self.account)
|
||||
ctrl = gajim.interface.msg_win_mgr.get_control(
|
||||
fjid_, self.account)
|
||||
if ctrl and ctrl.session and \
|
||||
ctrl.session.enable_encryption:
|
||||
thread_id = ctrl.session.thread_id
|
||||
ctrl.session.terminate_e2e()
|
||||
gajim.connections[self.account].delete_session(fjid_,
|
||||
thread_id)
|
||||
gajim.connections[self.account].delete_session(
|
||||
fjid_, thread_id)
|
||||
ctrl.no_autonegotiation = False
|
||||
else:
|
||||
s = _('%(nick)s is now known as %(new_nick)s') % {
|
||||
'nick': nick, 'new_nick': new_nick}
|
||||
# We add new nick to muc roster here, so we don't see
|
||||
# that "new_nick has joined the room" when he just changed nick.
|
||||
# that "new_nick has joined the room" when he just changed
|
||||
# nick.
|
||||
# add_contact_to_roster will be called a second time
|
||||
# after that, but that doesn't hurt
|
||||
self.add_contact_to_roster(new_nick, show, role, affiliation,
|
||||
status, jid)
|
||||
self.add_contact_to_roster(new_nick, show, role,
|
||||
affiliation, status, jid)
|
||||
if nick in self.attention_list:
|
||||
self.attention_list.remove(nick)
|
||||
# keep nickname color
|
||||
|
@ -1290,7 +1305,8 @@ class GroupchatControl(ChatControlBase):
|
|||
puny_jid = helpers.sanitize_filename(self.room_jid)
|
||||
puny_nick = helpers.sanitize_filename(nick)
|
||||
puny_new_nick = helpers.sanitize_filename(new_nick)
|
||||
old_path = os.path.join(gajim.VCARD_PATH, puny_jid, puny_nick)
|
||||
old_path = os.path.join(gajim.VCARD_PATH, puny_jid,
|
||||
puny_nick)
|
||||
new_path = os.path.join(gajim.VCARD_PATH, puny_jid,
|
||||
puny_new_nick)
|
||||
files = {old_path: new_path}
|
||||
|
@ -1301,22 +1317,26 @@ class GroupchatControl(ChatControlBase):
|
|||
files[os.path.join(path, puny_nick + ext)] = \
|
||||
os.path.join(path, puny_new_nick + ext)
|
||||
for old_file in files:
|
||||
if os.path.exists(old_file) and old_file != files[old_file]:
|
||||
if os.path.exists(files[old_file]) and helpers.windowsify(
|
||||
old_file) != helpers.windowsify(files[old_file]):
|
||||
# Windows require this, but os.remove('test') will also
|
||||
# remove 'TEST'
|
||||
if os.path.exists(old_file) and old_file != \
|
||||
files[old_file]:
|
||||
if os.path.exists(files[old_file]) and \
|
||||
helpers.windowsify(old_file) != helpers.windowsify(
|
||||
files[old_file]):
|
||||
# Windows require this, but os.remove('test')
|
||||
# will also remove 'TEST'
|
||||
os.remove(files[old_file])
|
||||
os.rename(old_file, files[old_file])
|
||||
self.print_conversation(s, 'info', tim=tim, graphics=False)
|
||||
elif '321' in statusCode:
|
||||
s = _('%(nick)s has been removed from the room (%(reason)s)') % {
|
||||
'nick': nick, 'reason': _('affiliation changed') }
|
||||
s = _('%(nick)s has been removed from the room '
|
||||
'(%(reason)s)') % { 'nick': nick,
|
||||
'reason': _('affiliation changed') }
|
||||
self.print_conversation(s, 'info', tim=tim, graphics=False)
|
||||
elif '322' in statusCode:
|
||||
s = _('%(nick)s has been removed from the room (%(reason)s)') % {
|
||||
'nick': nick,
|
||||
'reason': _('room configuration changed to members-only') }
|
||||
s = _('%(nick)s has been removed from the room '
|
||||
'(%(reason)s)') % { 'nick': nick,
|
||||
'reason': _('room configuration changed to '
|
||||
'members-only') }
|
||||
self.print_conversation(s, 'info', tim=tim, graphics=False)
|
||||
elif '332' in statusCode:
|
||||
s = _('%(nick)s has been removed from the room '
|
||||
|
@ -1420,17 +1440,17 @@ class GroupchatControl(ChatControlBase):
|
|||
actual_role = self.get_role(nick)
|
||||
if role != actual_role:
|
||||
self.remove_contact(nick)
|
||||
self.add_contact_to_roster(nick, show, role,
|
||||
affiliation, status, jid)
|
||||
self.add_contact_to_roster(nick, show, role, affiliation,
|
||||
status, jid)
|
||||
self.draw_role(actual_role)
|
||||
self.draw_role(role)
|
||||
if actor:
|
||||
st = _('** Role of %(nick)s has been set to %(role)s by '
|
||||
'%(actor)s') % {'nick': nick_jid, 'role': role,
|
||||
st = _('** Role of %(nick)s has been set to %(role)s '
|
||||
'by %(actor)s') % {'nick': nick_jid, 'role': role,
|
||||
'actor': actor}
|
||||
else:
|
||||
st = _('** Role of %(nick)s has been set to %(role)s') % {
|
||||
'nick': nick_jid, 'role': role}
|
||||
st = _('** Role of %(nick)s has been set to '
|
||||
'%(role)s') % {'nick': nick_jid, 'role': role}
|
||||
if reason:
|
||||
st += ' (%s)' % reason
|
||||
self.print_conversation(st, tim=tim, graphics=False)
|
||||
|
@ -1622,10 +1642,11 @@ class GroupchatControl(ChatControlBase):
|
|||
for nick in nick_list:
|
||||
# Update pm chat window
|
||||
fjid = self.room_jid + '/' + nick
|
||||
ctrl = gajim.interface.msg_win_mgr.get_gc_control(fjid, self.account)
|
||||
ctrl = gajim.interface.msg_win_mgr.get_gc_control(fjid,
|
||||
self.account)
|
||||
if ctrl:
|
||||
contact = gajim.contacts.get_gc_contact(self.account, self.room_jid,
|
||||
nick)
|
||||
contact = gajim.contacts.get_gc_contact(self.account,
|
||||
self.room_jid, nick)
|
||||
contact.show = 'offline'
|
||||
contact.status = ''
|
||||
ctrl.update_ui()
|
||||
|
@ -1658,9 +1679,9 @@ class GroupchatControl(ChatControlBase):
|
|||
includes = gajim.config.get('confirm_close_muc_rooms').split(' ')
|
||||
excludes = gajim.config.get('noconfirm_close_muc_rooms').split(' ')
|
||||
# whether to ask for comfirmation before closing muc
|
||||
if (gajim.config.get('confirm_close_muc') or self.room_jid in includes) \
|
||||
and gajim.gc_connected[self.account][self.room_jid] and self.room_jid not\
|
||||
in excludes:
|
||||
if (gajim.config.get('confirm_close_muc') or self.room_jid in includes)\
|
||||
and gajim.gc_connected[self.account][self.room_jid] and self.room_jid \
|
||||
not in excludes:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
@ -1677,9 +1698,9 @@ class GroupchatControl(ChatControlBase):
|
|||
includes = gajim.config.get('confirm_close_muc_rooms').split(' ')
|
||||
excludes = gajim.config.get('noconfirm_close_muc_rooms').split(' ')
|
||||
# whether to ask for comfirmation before closing muc
|
||||
if (gajim.config.get('confirm_close_muc') or self.room_jid in includes) \
|
||||
and gajim.gc_connected[self.account][self.room_jid] and self.room_jid not\
|
||||
in excludes:
|
||||
if (gajim.config.get('confirm_close_muc') or self.room_jid in includes)\
|
||||
and gajim.gc_connected[self.account][self.room_jid] and self.room_jid \
|
||||
not in excludes:
|
||||
|
||||
def on_ok(clicked):
|
||||
if clicked:
|
||||
|
@ -1730,7 +1751,8 @@ class GroupchatControl(ChatControlBase):
|
|||
def on_ok(subject):
|
||||
# Note, we don't update self.subject since we don't know whether it
|
||||
# will work yet
|
||||
gajim.connections[self.account].send_gc_subject(self.room_jid, subject)
|
||||
gajim.connections[self.account].send_gc_subject(self.room_jid,
|
||||
subject)
|
||||
|
||||
dialogs.InputTextDialog(_('Changing Subject'),
|
||||
_('Please specify the new subject:'), input_str=self.subject,
|
||||
|
@ -1747,14 +1769,16 @@ class GroupchatControl(ChatControlBase):
|
|||
prompt, change_nick=True)
|
||||
|
||||
def _on_configure_room_menuitem_activate(self, widget):
|
||||
c = gajim.contacts.get_gc_contact(self.account, self.room_jid, self.nick)
|
||||
c = gajim.contacts.get_gc_contact(self.account, self.room_jid,
|
||||
self.nick)
|
||||
if c.affiliation == 'owner':
|
||||
gajim.connections[self.account].request_gc_config(self.room_jid)
|
||||
elif c.affiliation == 'admin':
|
||||
if self.room_jid not in gajim.interface.instances[self.account][
|
||||
'gc_config']:
|
||||
gajim.interface.instances[self.account]['gc_config'][self.room_jid]\
|
||||
= config.GroupchatConfigWindow(self.account, self.room_jid)
|
||||
gajim.interface.instances[self.account]['gc_config'][
|
||||
self.room_jid] = config.GroupchatConfigWindow(self.account,
|
||||
self.room_jid)
|
||||
|
||||
def _on_destroy_room_menuitem_activate(self, widget):
|
||||
def on_ok(reason, jid):
|
||||
|
@ -1766,8 +1790,8 @@ class GroupchatControl(ChatControlBase):
|
|||
dialogs.ErrorDialog(_('Invalid group chat Jabber ID'),
|
||||
_('The group chat Jabber ID has not allowed characters.'))
|
||||
return
|
||||
gajim.connections[self.account].destroy_gc_room(self.room_jid, reason,
|
||||
jid)
|
||||
gajim.connections[self.account].destroy_gc_room(self.room_jid,
|
||||
reason, jid)
|
||||
|
||||
# Ask for a reason
|
||||
dialogs.DoubleInputDialog(_('Destroying %s') % self.room_jid,
|
||||
|
@ -1780,7 +1804,7 @@ class GroupchatControl(ChatControlBase):
|
|||
Bookmark the room, without autojoin and not minimized
|
||||
"""
|
||||
password = gajim.gc_passwords.get(self.room_jid, '')
|
||||
gajim.interface.add_gc_bookmark(self.account, self.name, self.room_jid, \
|
||||
gajim.interface.add_gc_bookmark(self.account, self.name, self.room_jid,\
|
||||
'0', '0', password, self.nick)
|
||||
|
||||
def _on_drag_data_received(self, widget, context, x, y, selection,
|
||||
|
@ -1824,9 +1848,10 @@ class GroupchatControl(ChatControlBase):
|
|||
|
||||
# HACK: Not the best soltution.
|
||||
if (text.startswith(self.COMMAND_PREFIX) and not
|
||||
text.startswith(self.COMMAND_PREFIX * 2) and len(splitted_text) == 1):
|
||||
return super(GroupchatControl,
|
||||
self).handle_message_textview_mykey_press(widget, event_keyval,
|
||||
text.startswith(self.COMMAND_PREFIX * 2) and \
|
||||
len(splitted_text) == 1):
|
||||
return super(GroupchatControl, self).\
|
||||
handle_message_textview_mykey_press(widget, event_keyval,
|
||||
event_keymod)
|
||||
|
||||
# nick completion
|
||||
|
@ -1848,8 +1873,8 @@ class GroupchatControl(ChatControlBase):
|
|||
if len(self.nick_hits) and self.last_key_tabs and \
|
||||
text[:-after_nick_len].endswith(self.nick_hits[0]):
|
||||
# we should cycle
|
||||
# Previous nick in list may had a space inside, so we check text and
|
||||
# not splitted_text and store it into 'begin' var
|
||||
# Previous nick in list may had a space inside, so we check text
|
||||
# and not splitted_text and store it into 'begin' var
|
||||
self.nick_hits.append(self.nick_hits[0])
|
||||
begin = self.nick_hits.pop(0)
|
||||
else:
|
||||
|
@ -1894,8 +1919,8 @@ class GroupchatControl(ChatControlBase):
|
|||
|
||||
message_buffer.delete(start_iter, end_iter)
|
||||
# get a shell-like completion
|
||||
# if there's more than one nick for this completion, complete only
|
||||
# the part that all these nicks have in common
|
||||
# if there's more than one nick for this completion, complete
|
||||
# only the part that all these nicks have in common
|
||||
if gajim.config.get('shell_like_completion') and \
|
||||
len(self.nick_hits) > 1:
|
||||
end = False
|
||||
|
@ -1909,7 +1934,8 @@ class GroupchatControl(ChatControlBase):
|
|||
completion = completion[:-1]
|
||||
break
|
||||
# if the current nick matches a COMPLETE existing nick,
|
||||
# and if the user tab TWICE, complete that nick (with the "add")
|
||||
# and if the user tab TWICE, complete that nick (with the
|
||||
# "add")
|
||||
if self.last_key_tabs:
|
||||
for nick in self.nick_hits:
|
||||
if nick == completion:
|
||||
|
@ -2023,23 +2049,27 @@ class GroupchatControl(ChatControlBase):
|
|||
item = xml.get_object('member_checkmenuitem')
|
||||
item.set_active(target_affiliation != 'none')
|
||||
if not user_affiliation in ('admin', 'owner') or \
|
||||
(user_affiliation != 'owner' and target_affiliation in ('admin', 'owner')):
|
||||
(user_affiliation != 'owner' and target_affiliation in ('admin',
|
||||
'owner')):
|
||||
item.set_sensitive(False)
|
||||
id_ = item.connect('activate', self.on_member_checkmenuitem_activate, jid)
|
||||
id_ = item.connect('activate', self.on_member_checkmenuitem_activate,
|
||||
jid)
|
||||
self.handlers[id_] = item
|
||||
|
||||
item = xml.get_object('admin_checkmenuitem')
|
||||
item.set_active(target_affiliation in ('admin', 'owner'))
|
||||
if not user_affiliation == 'owner':
|
||||
item.set_sensitive(False)
|
||||
id_ = item.connect('activate', self.on_admin_checkmenuitem_activate, jid)
|
||||
id_ = item.connect('activate', self.on_admin_checkmenuitem_activate,
|
||||
jid)
|
||||
self.handlers[id_] = item
|
||||
|
||||
item = xml.get_object('owner_checkmenuitem')
|
||||
item.set_active(target_affiliation == 'owner')
|
||||
if not user_affiliation == 'owner':
|
||||
item.set_sensitive(False)
|
||||
id_ = item.connect('activate', self.on_owner_checkmenuitem_activate, jid)
|
||||
id_ = item.connect('activate', self.on_owner_checkmenuitem_activate,
|
||||
jid)
|
||||
self.handlers[id_] = item
|
||||
|
||||
item = xml.get_object('information_menuitem')
|
||||
|
@ -2216,8 +2246,8 @@ class GroupchatControl(ChatControlBase):
|
|||
self.tooltip.id = row
|
||||
nick = model[iter_][C_NICK].decode('utf-8')
|
||||
self.tooltip.timeout = gobject.timeout_add(500,
|
||||
self.show_tooltip, gajim.contacts.get_gc_contact(account,
|
||||
self.room_jid, nick))
|
||||
self.show_tooltip, gajim.contacts.get_gc_contact(
|
||||
account, self.room_jid, nick))
|
||||
|
||||
def on_list_treeview_leave_notify_event(self, widget, event):
|
||||
props = widget.get_path_at_pos(int(event.x), int(event.y))
|
||||
|
@ -2274,8 +2304,8 @@ class GroupchatControl(ChatControlBase):
|
|||
Ban a user
|
||||
"""
|
||||
def on_ok(reason):
|
||||
gajim.connections[self.account].gc_set_affiliation(self.room_jid, jid,
|
||||
'outcast', reason)
|
||||
gajim.connections[self.account].gc_set_affiliation(self.room_jid,
|
||||
jid, 'outcast', reason)
|
||||
|
||||
# to ban we know the real jid. so jid is not fakejid
|
||||
nick = gajim.get_nick_from_jid(jid)
|
||||
|
@ -2329,11 +2359,12 @@ class GroupchatControl(ChatControlBase):
|
|||
"""
|
||||
Call vcard_information_window class to display user's information
|
||||
"""
|
||||
gc_contact = gajim.contacts.get_gc_contact(self.account, self.room_jid, nick)
|
||||
gc_contact = gajim.contacts.get_gc_contact(self.account, self.room_jid,
|
||||
nick)
|
||||
contact = gc_contact.as_contact()
|
||||
if contact.jid in gajim.interface.instances[self.account]['infos']:
|
||||
gajim.interface.instances[self.account]['infos'][contact.jid].window.\
|
||||
present()
|
||||
gajim.interface.instances[self.account]['infos'][contact.jid].\
|
||||
window.present()
|
||||
else:
|
||||
gajim.interface.instances[self.account]['infos'][contact.jid] = \
|
||||
vcard.VcardWindow(contact, self.account, gc_contact)
|
||||
|
|
Loading…
Add table
Reference in a new issue