Daniel Brötzmann pushed to branch mainwindow at gajim / gajim
Commits:
9faa5606 by wurstsalat at 2021-08-29T17:37:23+02:00
PrivateChatControl: Linting
- - - - -
cdd51278 by wurstsalat at 2021-08-29T17:51:00+02:00
GroupChatControl: Remove focus_line_out, linting
- - - - -
625d1a7e by wurstsalat at 2021-08-29T18:55:09+02:00
ChatControl: Remove roster reference, linting
- - - - -
c2043a6e by wurstsalat at 2021-08-29T19:04:22+02:00
BaseControl: Fix PM jingle file transfer warning, linting
- - - - -
4 changed files:
- gajim/gtk/controls/base.py
- gajim/gtk/controls/chat.py
- gajim/gtk/controls/groupchat.py
- gajim/gtk/controls/private.py
Changes:
=====================================
gajim/gtk/controls/base.py
=====================================
@@ -256,7 +256,6 @@ def __init__(self, widget_name, account, jid):
# instance object (also subclasses, eg. ChatControl or GroupchatControl)
app.plugin_manager.gui_extension_point('chat_control_base', self)
- # pylint: disable=line-too-long
self.register_events([
('ping-sent', ged.GUI1, self._nec_ping),
('ping-reply', ged.GUI1, self._nec_ping),
@@ -264,7 +263,6 @@ def __init__(self, widget_name, account, jid):
('sec-catalog-received', ged.GUI1, self._sec_labels_received),
('style-changed', ged.GUI1, self._style_changed),
])
- # pylint: enable=line-too-long
# This is basically a very nasty hack to surpass the inability
# to properly use the super, because of the old code.
@@ -363,7 +361,7 @@ def safe_shutdown(self):
return True
def allow_shutdown(self, method, on_response_yes, on_response_no,
- on_response_minimize):
+ on_response_minimize):
"""
Called to check is a control is allowed to shutdown.
If a control is not in a suitable shutdown state this method
@@ -427,10 +425,6 @@ def get_tab_label(self, chatstate):
# Return a markup'd label and optional Gtk.Color in a tuple like:
# return (label_str, None)
- def get_tab_image(self):
- # Return a suitable tab image for display.
- return None
-
def prepare_context_menu(self, hide_buttonbar_items=False):
"""
Derived classes SHOULD implement this
@@ -627,7 +621,8 @@ def set_encryption_menu_icon(self):
Gtk.IconSize.MENU)
def set_speller(self):
- if not app.is_installed('GSPELL') or not app.settings.get('use_speller'):
+ if (not app.is_installed('GSPELL') or
+ not app.settings.get('use_speller')):
return
gspell_lang = self.get_speller_language()
@@ -751,6 +746,7 @@ def _on_banner_eventbox_button_press_event(self, _widget, event):
If right-clicked, show popup
"""
if event.button == 3: # right click
+ # TODO:
self.parent_win.popup_menu(event)
def _on_message_textview_paste_event(self, _texview):
@@ -822,9 +818,10 @@ def _on_message_textview_key_press_event(self, textview, event):
if event.keyval == Gdk.KEY_space:
self.space_pressed = True
- elif (self.space_pressed or self.msg_textview.undo_pressed) and \
- event.keyval not in (Gdk.KEY_Control_L, Gdk.KEY_Control_R) and \
- not (event.keyval == Gdk.KEY_z and event.get_state() & Gdk.ModifierType.CONTROL_MASK):
+ elif ((self.space_pressed or self.msg_textview.undo_pressed) and
+ event.keyval not in (Gdk.KEY_Control_L, Gdk.KEY_Control_R) and
+ not (event.keyval == Gdk.KEY_z and
+ event.get_state() & Gdk.ModifierType.CONTROL_MASK)):
# If the space key has been pressed and now it hasn't,
# we save the buffer into the undo list. But be careful we're not
# pressing Control again (as in ctrl+z)
@@ -841,8 +838,9 @@ def _on_message_textview_key_press_event(self, textview, event):
self.last_key_tabs = False
if event.get_state() & Gdk.ModifierType.SHIFT_MASK:
- if event.get_state() & Gdk.ModifierType.CONTROL_MASK and \
- event.keyval == Gdk.KEY_ISO_Left_Tab:
+ if (event.get_state() & Gdk.ModifierType.CONTROL_MASK and
+ event.keyval == Gdk.KEY_ISO_Left_Tab):
+ # TODO:
self.parent_win.move_to_next_unread_tab(False)
return True
@@ -852,6 +850,7 @@ def _on_message_textview_key_press_event(self, textview, event):
if event.get_state() & Gdk.ModifierType.CONTROL_MASK:
if event.keyval == Gdk.KEY_Tab:
+ # TODO
self.parent_win.move_to_next_unread_tab(True)
return True
@@ -886,8 +885,8 @@ def _on_message_textview_key_press_event(self, textview, event):
if self.command_hits:
message_buffer.delete(start, end)
- message_buffer.insert_at_cursor(self.COMMAND_PREFIX + \
- self.command_hits[0] + ' ')
+ message_buffer.insert_at_cursor(
+ self.COMMAND_PREFIX + self.command_hits[0] + ' ')
self.last_key_tabs = True
return True
if not self._type.is_groupchat:
@@ -930,7 +929,7 @@ def _on_message_textview_key_press_event(self, textview, event):
self._on_send_message()
return True
- elif event.keyval == Gdk.KEY_z: # CTRL+z
+ elif event.keyval == Gdk.KEY_z: # CTRL+z
if event_state & Gdk.ModifierType.CONTROL_MASK:
self.msg_textview.undo()
return True
@@ -962,8 +961,8 @@ def _on_jump_to_end(self, _button):
self.scroll_to_end(force=True)
self._jump_to_end_button.reset_unread_count()
- def _on_drag_data_received(self, widget, context, x, y, selection,
- target_type, timestamp):
+ def _on_drag_data_received(self, widget, context, x_coord, y_coord,
+ selection, target_type, timestamp):
"""
Derived types SHOULD implement this
"""
@@ -1053,13 +1052,13 @@ def send_message(self,
# Clear msg input
message_buffer = self.msg_textview.get_buffer()
- message_buffer.set_text('') # clear message buffer (and tv of course)
+ message_buffer.set_text('') # clear message buffer (and tv of course)
def _on_window_motion_notify(self, *args):
"""
It gets called no matter if it is the active window or not
"""
- # TODO
+ # TODO:
return
if self.parent_win.get_active_jid() == self.contact.jid:
# if window is the active one, set last interaction
@@ -1069,7 +1068,7 @@ def _on_window_motion_notify(self, *args):
def _on_message_tv_buffer_changed(self, textbuffer):
has_text = self.msg_textview.has_text()
app.window.lookup_action(
- 'send-message-' + self.control_id).set_enabled(has_text)
+ f'send-message-{self.control_id}').set_enabled(has_text)
if textbuffer.get_char_count() and self.encryption:
app.plugin_manager.extension_point(
@@ -1303,7 +1302,8 @@ def on_color_menuitem_activate(self, _widget):
def on_font_menuitem_activate(self, _widget):
font_dialog = Gtk.FontChooserDialog(None, app.window)
start, finish = self.msg_textview.get_active_iters()
- font_dialog.connect('response', self.msg_textview.font_set, start, finish)
+ font_dialog.connect(
+ 'response', self.msg_textview.font_set, start, finish)
font_dialog.show_all()
def on_formatting_menuitem_activate(self, widget):
@@ -1344,45 +1344,34 @@ def _on_send_file(self, action, _param):
else:
self._on_send_file_jingle()
- def _on_send_file_jingle(self, gc_contact=None):
- """
- gc_contact can be set when we are in a groupchat control
- """
- def _on_ok(_contact):
+ def _on_send_file_jingle(self):
+ def _on_send():
app.interface.instances['file_transfers'].show_file_send_request(
- self.account, _contact)
-
- if self._type.is_privatechat:
- gc_contact = self.gc_contact
-
- if not gc_contact:
- _on_ok(self.contact)
- return
-
- # gc or pm
- gc_control = app.interface.msg_win_mgr.get_gc_control(
- gc_contact.room_jid, self.account)
- self_contact = app.contacts.get_gc_contact(self.account,
- gc_control.room_jid,
- gc_control.nick)
- if (gc_control.is_anonymous and
- gc_contact.affiliation.value not in ['admin', 'owner'] and
- self_contact.affiliation.value in ['admin', 'owner']):
- contact = app.contacts.get_contact(self.account, gc_contact.jid)
- if not contact or contact.sub not in ('both', 'to'):
+ self.account, self.contact)
+ if self.is_privatechat:
+ gc_control = app.window.get_control(
+ self.account, self._room_contact.jid)
+ self_contact = self._room_contact.get_self()
+
+ if (gc_control.is_anonymous and
+ self.contact.affiliation.value not
+ in ['admin', 'owner'] and
+ self_contact.affiliation.value in ['admin', 'owner']):
+ # Show a warning if we're trying to send a file to a PM contact
+ # which is not Admin/Owner, and thus cannot normally see our JID
ConfirmationDialog(
_('Privacy'),
_('Warning'),
_('If you send a file to <b>%s</b>, your real XMPP '
- 'address will be revealed.') % gc_contact.name,
+ 'address will be revealed.') % self.contact.name,
[DialogButton.make('Cancel'),
DialogButton.make(
'OK',
- text=_('_Continue'),
- callback=lambda: _on_ok(gc_contact))]).show()
+ text=_('_Send Anyway'),
+ callback=_on_send)]).show()
return
- _on_ok(gc_contact)
+ _on_send()
def set_control_active(self, state):
if state:
@@ -1538,9 +1527,10 @@ def scroll_messages(self, direction, msg_buf, msg_type):
start_iter = msg_buf.get_start_iter()
end_iter = msg_buf.get_end_iter()
self.orig_msg = msg_buf.get_text(start_iter, end_iter, False)
- if pos == size and size > 0 and direction == 'up' and \
- msg_type == 'sent' and not self.correcting and (not \
- history[pos - 1].startswith('/') or history[pos - 1].startswith('/me')):
+ if (pos == size and size > 0 and direction == 'up' and
+ msg_type == 'sent' and not self.correcting and (
+ not history[pos - 1].startswith('/') or
+ history[pos - 1].startswith('/me'))):
self.correcting = True
gtkgui_helpers.add_css_class(
self.msg_textview, 'gajim-msg-correcting')
=====================================
gajim/gtk/controls/chat.py
=====================================
@@ -52,7 +52,8 @@
from gajim import gtkgui_helpers
from gajim import gui_menu_builder
-from gajim import dialogs
+
+from gajim.dialogs import TransformChatToMUC
from gajim.gui.call_widget import CallWidget
from gajim.gui.dialogs import DialogButton
@@ -78,7 +79,7 @@ class ChatControl(BaseControl):
A control for standard 1-1 chat
"""
_type = ControlType.CHAT
- old_msg_kind = None # last kind of the printed message
+ old_msg_kind = None # last kind of the printed message
# Set a command host to bound to. Every command given through a chat will be
# processed with this command host.
@@ -86,9 +87,9 @@ class ChatControl(BaseControl):
def __init__(self, account, jid):
BaseControl.__init__(self,
- 'chat_control',
- account,
- jid)
+ 'chat_control',
+ account,
+ jid)
self.last_recv_message_id = None
self.last_recv_message_marks = None
@@ -300,11 +301,6 @@ def delegate_action(self, action):
return Gdk.EVENT_STOP
if action == 'send-file':
- if app.interface.msg_win_mgr.mode == \
- app.interface.msg_win_mgr.ONE_MSG_WINDOW_ALWAYS_WITH_ROSTER:
- app.interface.roster.tree.grab_focus()
- return Gdk.EVENT_PROPAGATE
-
self._get_action('send-file-').activate()
return Gdk.EVENT_STOP
@@ -324,7 +320,7 @@ def _on_invite_contacts(self, _action, _param):
"""
User wants to invite some friends to chat
"""
- dialogs.TransformChatToMUC(self.account, [self.contact.jid])
+ TransformChatToMUC(self.account, [self.contact.jid])
def _on_send_chatstate(self, action, param):
action.set_state(param)
@@ -613,11 +609,11 @@ def send_message(self,
return
BaseControl.send_message(self,
- message,
- type_='chat',
- xhtml=xhtml,
- process_commands=process_commands,
- attention=attention)
+ message,
+ type_='chat',
+ xhtml=xhtml,
+ process_commands=process_commands,
+ attention=attention)
def get_our_nick(self):
return app.nicks[self.account]
@@ -642,15 +638,15 @@ def add_message(self,
name = self.get_our_nick()
BaseControl.add_message(self,
- text,
- kind,
- name,
- tim,
- displaymarking=displaymarking,
- msg_log_id=msg_log_id,
- message_id=message_id,
- correct_id=correct_id,
- additional_data=additional_data)
+ text,
+ kind,
+ name,
+ tim,
+ displaymarking=displaymarking,
+ msg_log_id=msg_log_id,
+ message_id=message_id,
+ correct_id=correct_id,
+ additional_data=additional_data)
def prepare_context_menu(self, hide_buttonbar_items=False):
"""
@@ -686,7 +682,7 @@ def shutdown(self):
super(ChatControl, self).shutdown()
app.check_finalize(self)
- def allow_shutdown(self, method, on_yes, on_no, _on_minimize):
+ def allow_shutdown(self, _method, on_yes, on_no, _on_minimize):
time_ = app.last_message_time[self.account][self.contact.jid]
# 2 seconds
if time.time() - time_ < 2:
@@ -723,8 +719,8 @@ def _update_avatar(self):
surface = self.contact.get_avatar(AvatarSize.CHAT, scale)
self.xml.avatar_image.set_from_surface(surface)
- def _on_drag_data_received(self, widget, context, x, y, selection,
- target_type, timestamp):
+ def _on_drag_data_received(self, _widget, _context, _x_coord, _y_coord,
+ selection, target_type, _timestamp):
if not selection.get_data():
return
@@ -749,17 +745,15 @@ def _on_drag_data_received(self, widget, context, x, y, selection,
dropped_transport = app.get_transport_name_from_jid(dropped_jid)
c_transport = app.get_transport_name_from_jid(self.contact.jid)
if dropped_transport or c_transport:
- return # transport contacts cannot be invited
+ return # transport contacts cannot be invited
- dialogs.TransformChatToMUC(self.account,
- [self.contact.jid],
- [dropped_jid])
+ TransformChatToMUC(self.account, [self.contact.jid], [dropped_jid])
def _on_convert_to_gc_menuitem_activate(self, _widget):
"""
User wants to invite some friends to chat
"""
- dialogs.TransformChatToMUC(self.account, [self.contact.jid])
+ TransformChatToMUC(self.account, [self.contact.jid])
def _on_client_state_changed(self, _client, _signal_name, state):
self.msg_textview.set_sensitive(state.is_connected)
=====================================
gajim/gtk/controls/groupchat.py
=====================================
@@ -710,8 +710,6 @@ def add_message(self,
self._nick_completion.record_message(contact, highlight)
- # self.check_focus_out_line()
-
BaseControl.add_message(self,
text,
kind,
@@ -723,18 +721,6 @@ def add_message(self,
stanza_id=stanza_id,
additional_data=additional_data)
- def check_focus_out_line(self):
- """
- Check and possibly add focus out line for room_jid if it needs it and
- does not already have it as last event. If it goes to add this line
- - remove previous line first
- """
-
- if app.window.is_chat_active(self.account, self.room_jid):
- return
-
- # self.conv_textview.show_focus_out_line()
-
def _on_room_subject(self, _contact, _signal_name, properties):
if self.subject == properties.subject:
# Probably a rejoin, we already showed that subject
@@ -881,7 +867,8 @@ def _on_room_config_failed(self, _contact, _signal_name, error):
self.xml.error_label.set_text(to_user_string(error))
self._show_page('error')
- def _on_user_nickname_changed(self, _contact, _signal_name, user_contact, properties):
+ def _on_user_nickname_changed(self, _contact, _signal_name, user_contact,
+ properties):
nick = user_contact.name
new_nick = properties.muc_user.nick
if properties.is_muc_self_presence:
@@ -922,7 +909,7 @@ def _on_user_affiliation_changed(self,
reason = '' if reason is None else ': {reason}'.format(reason=reason)
actor = properties.muc_user.actor
- #Group Chat: You have been kicked by Alice
+ # Group Chat: You have been kicked by Alice
actor = '' if actor is None else _(' by {actor}').format(actor=actor)
if properties.is_muc_self_presence:
@@ -953,7 +940,7 @@ def _on_user_role_changed(self,
reason = '' if reason is None else ': {reason}'.format(reason=reason)
actor = properties.muc_user.actor
- #Group Chat: You have been kicked by Alice
+ # Group Chat: You have been kicked by Alice
actor = '' if actor is None else _(' by {actor}').format(actor=actor)
if properties.is_muc_self_presence:
@@ -978,47 +965,47 @@ def _on_room_kicked(self, _contact, _signal_name, properties):
reason = '' if reason is None else ': {reason}'.format(reason=reason)
actor = properties.muc_user.actor
- #Group Chat: You have been kicked by Alice
+ # Group Chat: You have been kicked by Alice
actor = '' if actor is None else _(' by {actor}').format(actor=actor)
- #Group Chat: We have been removed from the room by Alice: reason
+ # Group Chat: We have been removed from the room by Alice: reason
message = _('You have been removed from the group chat{actor}{reason}')
if StatusCode.REMOVED_ERROR in status_codes:
# Handle 333 before 307, some MUCs add both
- #Group Chat: Server kicked us because of an server error
+ # Group Chat: Server kicked us because of an server error
message = _('You have left due '
'to an error{reason}').format(reason=reason)
self.add_info_message(message)
elif StatusCode.REMOVED_KICKED in status_codes:
- #Group Chat: We have been kicked by Alice: reason
+ # Group Chat: We have been kicked by Alice: reason
message = _('You have been '
'kicked{actor}{reason}').format(actor=actor,
reason=reason)
self.add_info_message(message)
elif StatusCode.REMOVED_BANNED in status_codes:
- #Group Chat: We have been banned by Alice: reason
+ # Group Chat: We have been banned by Alice: reason
message = _('You have been '
'banned{actor}{reason}').format(actor=actor,
reason=reason)
self.add_info_message(message)
elif StatusCode.REMOVED_AFFILIATION_CHANGE in status_codes:
- #Group Chat: We were removed because of an affiliation change
+ # Group Chat: We were removed because of an affiliation change
reason = _(': Affiliation changed')
message = message.format(actor=actor, reason=reason)
self.add_info_message(message)
elif StatusCode.REMOVED_NONMEMBER_IN_MEMBERS_ONLY in status_codes:
- #Group Chat: Room configuration changed
+ # Group Chat: Room configuration changed
reason = _(': Group chat configuration changed to members-only')
message = message.format(actor=actor, reason=reason)
self.add_info_message(message)
elif StatusCode.REMOVED_SERVICE_SHUTDOWN in status_codes:
- #Group Chat: Kicked because of server shutdown
+ # Group Chat: Kicked because of server shutdown
reason = ': System shutdown'
message = message.format(actor=actor, reason=reason)
self.add_info_message(message)
@@ -1031,10 +1018,10 @@ def _on_user_left(self, _contact, _signal_name, user_contact, properties):
reason = '' if reason is None else ': {reason}'.format(reason=reason)
actor = properties.muc_user.actor
- #Group Chat: You have been kicked by Alice
+ # Group Chat: You have been kicked by Alice
actor = '' if actor is None else _(' by {actor}').format(actor=actor)
- #Group Chat: We have been removed from the room
+ # Group Chat: We have been removed from the room
message = _('{nick} has been removed from the group chat{by}{reason}')
if StatusCode.REMOVED_ERROR in status_codes:
@@ -1043,7 +1030,7 @@ def _on_user_left(self, _contact, _signal_name, user_contact, properties):
nick, properties.muc_user.reason, error=True)
elif StatusCode.REMOVED_KICKED in status_codes:
- #Group Chat: User was kicked by Alice: reason
+ # Group Chat: User was kicked by Alice: reason
message = _('{nick} has been '
'kicked{actor}{reason}').format(nick=nick,
actor=actor,
@@ -1051,7 +1038,7 @@ def _on_user_left(self, _contact, _signal_name, user_contact, properties):
self.add_info_message(message)
elif StatusCode.REMOVED_BANNED in status_codes:
- #Group Chat: User was banned by Alice: reason
+ # Group Chat: User was banned by Alice: reason
message = _('{nick} has been '
'banned{actor}{reason}').format(nick=nick,
actor=actor,
@@ -1197,7 +1184,7 @@ def safe_shutdown(self):
return False
return True
- def allow_shutdown(self, method, on_yes, on_no):
+ def allow_shutdown(self, _method, on_yes, on_no):
# whether to ask for confirmation before closing muc
if app.settings.get('confirm_close_muc') and self.contact.is_joined:
def on_ok(is_checked):
@@ -1237,8 +1224,8 @@ def set_control_active(self, state):
self.attention_flag = False
BaseControl.set_control_active(self, state)
- def _on_drag_data_received(self, widget, context, x, y, selection,
- target_type, timestamp):
+ def _on_drag_data_received(self, _widget, _context, _x_coord, _y_coord,
+ selection, target_type, _timestamp):
if not selection.get_data():
return
@@ -1269,7 +1256,7 @@ def _on_message_textview_key_press_event(self, widget, event):
if res:
return True
- if event.keyval == Gdk.KEY_Tab: # TAB
+ if event.keyval == Gdk.KEY_Tab: # TAB
message_buffer = widget.get_buffer()
start_iter, end_iter = message_buffer.get_bounds()
cursor_position = message_buffer.get_insert()
@@ -1281,13 +1268,13 @@ def _on_message_textview_key_press_event(self, widget, event):
# nick completion
# check if tab is pressed with empty message
if splitted_text: # if there are any words
- begin = splitted_text[-1] # last word we typed
+ begin = splitted_text[-1] # last word we typed
else:
begin = ''
gc_refer_to_nick_char = app.settings.get('gc_refer_to_nick_char')
with_refer_to_nick_char = False
- after_nick_len = 1 # the space that is printed after we type [Tab]
+ after_nick_len = 1 # the space that is printed after we type [Tab]
# first part of this if : works fine even if refer_to_nick_char
if (gc_refer_to_nick_char and
@@ -1331,8 +1318,8 @@ def _on_message_textview_key_press_event(self, widget, event):
not app.settings.get('shell_like_completion')):
# have to accommodate for the added space from last
# completion
- start_iter.backward_chars(len(begin) + \
- len(gc_refer_to_nick_char))
+ start_iter.backward_chars(
+ len(begin) + len(gc_refer_to_nick_char))
else:
start_iter.backward_chars(len(begin))
@@ -1343,13 +1330,13 @@ def _on_message_textview_key_press_event(self, widget, event):
# 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 app.settings.get('shell_like_completion') and \
- len(self.nick_hits) > 1:
+ if (app.settings.get('shell_like_completion') and
+ len(self.nick_hits) > 1):
end = False
completion = ''
- add = "" # if nick is not complete, don't add anything
+ add = "" # if nick is not complete, don't add anything
while not end and len(completion) < len(self.nick_hits[0]):
- completion = self.nick_hits[0][:len(completion)+1]
+ completion = self.nick_hits[0][:len(completion) + 1]
for nick in self.nick_hits:
if completion.lower() not in nick.lower():
end = True
@@ -1441,7 +1428,7 @@ def append_nick_in_msg_textview(self, _widget, nick):
end_iter = message_buffer.get_iter_at_mark(cursor_position)
text = message_buffer.get_text(start_iter, end_iter, False)
start = ''
- if text: # Cursor is not at first position
+ if text: # Cursor is not at first position
if not text[-1] in (' ', '\n', '\t'):
start = ' '
add = ' '
=====================================
gajim/gtk/controls/private.py
=====================================
@@ -151,10 +151,10 @@ def send_message(self, message, xhtml=None, process_commands=True,
if not self.contact.is_available:
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': self.room_name, 'nick': self.contact.name})
+ _('You are no longer joined "%(room)s" or '
+ '"%(nick)s" has left the chat.') % {
+ 'room': self.room_name,
+ 'nick': self.contact.name})
return
ChatControl.send_message(self, message,
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/935a7ae229206cd45c67f486a3d12fb…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/935a7ae229206cd45c67f486a3d12fb…
You're receiving this email because of your account on dev.gajim.org.
Daniel Brötzmann pushed to branch mainwindow at gajim / gajim
Commits:
11bd812f by wurstsalat at 2021-08-28T16:05:32+02:00
App: Remove unused methods
- - - - -
1 changed file:
- gajim/common/app.py
Changes:
=====================================
gajim/common/app.py
=====================================
@@ -352,38 +352,9 @@ def get_room_and_nick_from_fjid(jid):
l.append('')
return l
-def get_real_jid_from_fjid(account, fjid):
- """
- Return real jid or returns None, if we don't know the real jid
- """
- room_jid, nick = get_room_and_nick_from_fjid(fjid)
- if not nick: # It's not a fake_jid, it is a real jid
- return fjid # we return the real jid
- real_jid = fjid
- if interface.msg_win_mgr.get_gc_control(room_jid, account):
- # It's a pm, so if we have real jid it's in contact.jid
- gc_contact = contacts.get_gc_contact(account, room_jid, nick)
- if not gc_contact:
- return
- # gc_contact.jid is None when it's not a real jid (we don't know real jid)
- real_jid = gc_contact.jid
- return real_jid
-
-def get_room_from_fjid(jid):
- return get_room_and_nick_from_fjid(jid)[0]
-
-def get_contact_name_from_jid(account, jid):
- c = contacts.get_first_contact_from_jid(account, jid)
- return c.name
-
def get_jid_without_resource(jid):
return jid.split('/')[0]
-def construct_fjid(room_jid, nick):
- # fake jid is the jid for a contact in a room
- # gaim(a)conference.jabber.org/nick
- return room_jid + '/' + nick
-
def get_resource_from_jid(jid):
jids = jid.split('/', 1)
if len(jids) > 1:
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/11bd812f4e9b018f7f1d85829d5ada64…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/11bd812f4e9b018f7f1d85829d5ada64…
You're receiving this email because of your account on dev.gajim.org.