Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
6b6987c3 by lovetox at 2020-07-06T21:30:53+02:00
MUC: Return message id on invite()
- - - - -
1 changed file:
- nbxmpp/modules/muc.py
Changes:
=====================================
nbxmpp/modules/muc.py
=====================================
@@ -492,7 +492,7 @@ class MUC(BaseModule):
else:
invite = self._build_mediated_invite(
room, to, reason, password, continue_)
- self._client.send_stanza(invite)
+ return self._client.send_stanza(invite)
@staticmethod
def _build_direct_invite(room, to, reason, password, continue_):
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/6b6987c3dbb14963d865008a…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/6b6987c3dbb14963d865008a…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
cb4a2ed5 by Daniel Brötzmann at 2020-07-06T09:06:31+02:00
Roster: Add spam reporting
- - - - -
1 changed file:
- gajim/roster_window.py
Changes:
=====================================
gajim/roster_window.py
=====================================
@@ -2740,10 +2740,12 @@ class RosterWindow:
When clicked on the 'block' button in context menu. list_ is a list of
(contact, account)
"""
- def on_continue(msg, pep_dict):
- if msg is None:
- # user pressed Cancel to change status message dialog
- return
+ def _block_it(is_checked=None, report=None):
+ if is_checked is not None: # Dialog has been shown
+ if is_checked:
+ app.config.set('confirm_block', 'no')
+ else:
+ app.config.set('confirm_block', 'yes')
accounts = []
for _, account in list_:
@@ -2755,7 +2757,7 @@ class RosterWindow:
l_ = [i[0] for i in list_ if i[1] == acct]
con = app.connections[acct]
jid_list = [contact.jid for contact in l_]
- con.get_module('Blocking').block(jid_list)
+ con.get_module('Blocking').block(jid_list, report)
for contact in l_:
ctrl = app.interface.msg_win_mgr.get_control(
contact.jid, acct)
@@ -2768,14 +2770,6 @@ class RosterWindow:
return
self.draw_contact(contact.jid, acct)
- def _block_it(is_checked=None):
- if is_checked is not None: # Dialog has been shown
- if is_checked:
- app.config.set('confirm_block', 'no')
- else:
- app.config.set('confirm_block', 'yes')
- self.get_status_message('offline', on_continue, show_pep=False)
-
# Check if confirmation is needed for blocking
confirm_block = app.config.get('confirm_block')
if confirm_block == 'no':
@@ -2789,6 +2783,10 @@ class RosterWindow:
'will not receive further messages.'),
_('_Do not ask again'),
[DialogButton.make('Cancel'),
+ DialogButton.make('OK',
+ text=_('_Report Spam'),
+ callback=_block_it,
+ kwargs={'report': 'spam'}),
DialogButton.make('Remove',
text=_('_Block'),
callback=_block_it)],
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/cb4a2ed5ecac6df95c27ae21d14ad385…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/cb4a2ed5ecac6df95c27ae21d14ad385…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
db8cea4d by lovetox at 2020-07-05T22:35:23+02:00
Smacks: Don't fail on saving error replies
- - - - -
1 changed file:
- nbxmpp/smacks.py
Changes:
=====================================
nbxmpp/smacks.py
=====================================
@@ -23,6 +23,7 @@ from nbxmpp.simplexml import Node
from nbxmpp.const import StreamState
from nbxmpp.util import LogAdapter
from nbxmpp.structs import StanzaHandler
+from nbxmpp.protocol import Error
log = logging.getLogger('nbxmpp.smacks')
@@ -139,7 +140,9 @@ class Smacks:
# Make a full copy so we dont run into problems when
# the stanza is modified after sending for some reason
- stanza = type(stanza)(node=str(stanza))
+ # TODO: Make also copies of Protocol.Error objects
+ if not isinstance(stanza, Error):
+ stanza = type(stanza)(node=str(stanza))
self._add_delay(stanza)
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/db8cea4d9322963d27b74b81…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/db8cea4d9322963d27b74b81…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
d22961dc by lovetox at 2020-07-05T21:35:55+02:00
Roster: Remove blocking whole group feature
Multiselecting contacts should be efficient enough for such rare action
- - - - -
6881c696 by lovetox at 2020-07-05T21:56:12+02:00
Roster: Don't depend on Privacy lists for multiple contact block
- - - - -
2 changed files:
- gajim/common/helpers.py
- gajim/roster_window.py
Changes:
=====================================
gajim/common/helpers.py
=====================================
@@ -837,11 +837,6 @@ def jid_is_blocked(account, jid):
jid in con.get_module('PrivacyLists').blocked_contacts or
con.get_module('PrivacyLists').blocked_all)
-def group_is_blocked(account, group):
- con = app.connections[account]
- return (group in con.get_module('PrivacyLists').blocked_groups or
- con.get_module('PrivacyLists').blocked_all)
-
def get_subscription_request_msg(account=None):
s = app.config.get_per('accounts', account, 'subscription_request_msg')
if s:
=====================================
gajim/roster_window.py
=====================================
@@ -1073,8 +1073,6 @@ class RosterWindow:
else:
accounts = [account]
text = GLib.markup_escape_text(group)
- if helpers.group_is_blocked(account, group):
- text = '<span strikethrough="true">%s</span>' % text
if app.config.get('show_contacts_number'):
nbr_on, nbr_total = app.contacts.get_nb_online_total_contacts(
accounts=accounts, groups=[group])
@@ -1165,14 +1163,7 @@ class RosterWindow:
name = '%s [%s]' % (name, str(nb_unread))
# Strike name if blocked
- strike = False
- if helpers.jid_is_blocked(account, jid):
- strike = True
- else:
- for group in contact.get_shown_groups():
- if helpers.group_is_blocked(account, group):
- strike = True
- break
+ strike = helpers.jid_is_blocked(account, jid)
if strike:
name = '<span strikethrough="true">%s</span>' % name
@@ -2744,7 +2735,7 @@ class RosterWindow:
for jid in obj.changed:
self.draw_contact(jid, obj.conn.name)
- def on_block(self, widget, list_, group=None):
+ def on_block(self, widget, list_):
"""
When clicked on the 'block' button in context menu. list_ is a list of
(contact, account)
@@ -2757,34 +2748,25 @@ class RosterWindow:
accounts = []
for _, account in list_:
con = app.connections[account]
- if con.get_module('PrivacyLists').supported or (
- group is None and con.get_module('Blocking').supported):
+ if (con.get_module('PrivacyLists').supported or
+ con.get_module('Blocking').supported):
accounts.append(account)
- if group is None:
- for acct in accounts:
- l_ = [i[0] for i in list_ if i[1] == acct]
- con = app.connections[acct]
- con.get_module('PrivacyLists').block_contacts(l_, msg)
- for contact in l_:
- ctrl = app.interface.msg_win_mgr.get_control(
- contact.jid, acct)
- if ctrl:
- ctrl.parent_win.remove_tab(
- ctrl, ctrl.parent_win.CLOSE_COMMAND, force=True)
- if contact.show == 'not in roster':
- self.remove_contact(contact.jid, acct, force=True,
- backend=True)
- return
- self.draw_contact(contact.jid, acct)
- else:
- for acct in accounts:
- l_ = [i[0] for i in list_ if i[1] == acct]
- con = app.connections[acct]
- con.get_module('PrivacyLists').block_group(group, l_, msg)
- self.draw_group(group, acct)
- for contact in l_:
- self.draw_contact(contact.jid, acct)
+ for acct in accounts:
+ l_ = [i[0] for i in list_ if i[1] == acct]
+ con = app.connections[acct]
+ con.get_module('PrivacyLists').block_contacts(l_, msg)
+ for contact in l_:
+ ctrl = app.interface.msg_win_mgr.get_control(
+ contact.jid, acct)
+ if ctrl:
+ ctrl.parent_win.remove_tab(
+ ctrl, ctrl.parent_win.CLOSE_COMMAND, force=True)
+ if contact.show == 'not in roster':
+ self.remove_contact(contact.jid, acct, force=True,
+ backend=True)
+ return
+ self.draw_contact(contact.jid, acct)
def _block_it(is_checked=None):
if is_checked is not None: # Dialog has been shown
@@ -2800,22 +2782,11 @@ class RosterWindow:
_block_it()
return
- # Set dialog's labels depending on if it is a group or a single contact
- if group is None:
- title = _('Block Contact')
- pritext = _('Really block this contact?')
- sectext = _('You will appear offline for this contact and you '
- 'will not receive further messages.')
- else:
- title = _('Block Group')
- pritext = _('Really block this group?')
- sectext = _('You will appear offline for these contacts '
- 'and you will not receive further messages.')
-
NewConfirmationCheckDialog(
- title,
- pritext,
- sectext,
+ _('Block Contact'),
+ _('Really block this contact?'),
+ _('You will appear offline for this contact and you '
+ 'will not receive further messages.'),
_('_Do not ask again'),
[DialogButton.make('Cancel'),
DialogButton.make('Remove',
@@ -2823,32 +2794,24 @@ class RosterWindow:
callback=_block_it)],
modal=False).show()
- def on_unblock(self, widget, list_, group=None):
+ def on_unblock(self, widget, list_):
"""
When clicked on the 'unblock' button in context menu.
"""
accounts = []
for _, account in list_:
con = app.connections[account]
- if con.get_module('PrivacyLists').supported or (
- group is None and con.get_module('Blocking').supported):
+ if (con.get_module('PrivacyLists').supported or
+ con.get_module('Blocking').supported):
accounts.append(account)
- if group is None:
- for acct in accounts:
- l_ = [i[0] for i in list_ if i[1] == acct]
- con = app.connections[acct]
- con.get_module('PrivacyLists').unblock_contacts(l_)
- for contact in l_:
- self.draw_contact(contact.jid, acct)
- else:
- for acct in accounts:
- l_ = [i[0] for i in list_ if i[1] == acct]
- con = app.connections[acct]
- con.get_module('PrivacyLists').unblock_group(group, l_)
- self.draw_group(group, acct)
- for contact in l_:
- self.draw_contact(contact.jid, acct)
+ for acct in accounts:
+ l_ = [i[0] for i in list_ if i[1] == acct]
+ con = app.connections[acct]
+ con.get_module('PrivacyLists').unblock_contacts(l_)
+ for contact in l_:
+ self.draw_contact(contact.jid, acct)
+
for acct in accounts:
if 'privacy_list_block' in app.interface.instances[acct]:
del app.interface.instances[acct]['privacy_list_block']
@@ -4899,28 +4862,6 @@ class RosterWindow:
rename_item.connect('activate', self.on_rename, 'group', group,
account)
- # Block group
- is_blocked = False
- if self.regroup:
- for g_account in app.connections:
- if helpers.group_is_blocked(g_account, group):
- is_blocked = True
- else:
- if helpers.group_is_blocked(account, group):
- is_blocked = True
-
- if is_blocked and app.connections[account].get_module('PrivacyLists').supported:
- unblock_menuitem = Gtk.MenuItem.new_with_mnemonic(_('_Unblock'))
- unblock_menuitem.connect('activate', self.on_unblock, list_,
- group)
- menu.append(unblock_menuitem)
- else:
- block_menuitem = Gtk.MenuItem.new_with_mnemonic(_('_Block'))
- block_menuitem.connect('activate', self.on_block, list_, group)
- menu.append(block_menuitem)
- if not app.connections[account].get_module('PrivacyLists').supported:
- block_menuitem.set_sensitive(False)
-
# Remove group
remove_item = Gtk.MenuItem.new_with_mnemonic(_('Remo_ve'))
menu.append(remove_item)
@@ -4964,16 +4905,19 @@ class RosterWindow:
list_ = [] # list of (jid, account) tuples
one_account_offline = False
is_blocked = True
- privacy_rules_supported = True
+ blocking_supported = True
for titer in iters:
jid = model[titer][Column.JID]
account = model[titer][Column.ACCOUNT]
if not app.account_is_available(account):
one_account_offline = True
- if not app.connections[account].get_module('PrivacyLists').supported:
- privacy_rules_supported = False
- contact = app.contacts.get_contact_with_highest_priority(account,
- jid)
+
+ con = app.connections[account]
+ if (not con.get_module('PrivacyLists').supported and
+ not con.get_module('Blocking').supported):
+ blocking_supported = False
+ contact = app.contacts.get_contact_with_highest_priority(
+ account, jid)
if not helpers.jid_is_blocked(account, jid):
is_blocked = False
list_.append((contact, account))
@@ -5024,7 +4968,7 @@ class RosterWindow:
manage_contacts_submenu.append(item)
# Block
- if is_blocked and privacy_rules_supported:
+ if is_blocked and blocking_supported:
unblock_menuitem = Gtk.MenuItem.new_with_mnemonic(_('_Unblock'))
unblock_menuitem.connect('activate', self.on_unblock, list_)
manage_contacts_submenu.append(unblock_menuitem)
@@ -5033,7 +4977,7 @@ class RosterWindow:
block_menuitem.connect('activate', self.on_block, list_)
manage_contacts_submenu.append(block_menuitem)
- if not privacy_rules_supported:
+ if not blocking_supported:
block_menuitem.set_sensitive(False)
# Remove
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/e9a0e679612fdcc1d424e8ad5eb409d…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/e9a0e679612fdcc1d424e8ad5eb409d…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
64c81bdc by wurstsalat at 2020-07-05T18:12:51+02:00
ChatControl: Add menu item for blocking/reporting
- - - - -
e9a0e679 by wurstsalat at 2020-07-05T18:12:51+02:00
Roster: Adapt strings in blocking dialog
- - - - -
3 changed files:
- gajim/chat_control.py
- gajim/gui_menu_builder.py
- gajim/roster_window.py
Changes:
=====================================
gajim/chat_control.py
=====================================
@@ -251,8 +251,9 @@ class ChatControl(ChatControlBase):
actions = [
('invite-contacts-', self._on_invite_contacts),
('add-to-roster-', self._on_add_to_roster),
+ ('block-contact-', self._on_block_contact),
('information-', self._on_information),
- ]
+ ]
for action in actions:
action_name, func = action
@@ -300,6 +301,11 @@ class ChatControl(ChatControlBase):
win.lookup_action(
'add-to-roster-' + self.control_id).set_enabled(False)
+ # Block contact
+ win.lookup_action(
+ 'block-contact-' + self.control_id).set_enabled(
+ online and con.get_module('Blocking').supported)
+
# Audio
win.lookup_action('toggle-audio-' + self.control_id).set_enabled(
online and self.jingle['audio'].available)
@@ -376,6 +382,33 @@ class ChatControl(ChatControlBase):
def _on_add_to_roster(self, _action, _param):
AddNewContactWindow(self.account, self.contact.jid)
+ def _on_block_contact(self, _action, _param):
+ def _block_contact(report=None):
+ con = app.connections[self.account]
+ con.get_module('Blocking').block([self.contact.jid], report=report)
+
+ self.parent_win.remove_tab(self, None, force=True)
+ if _('Not in contact list') in self.contact.get_shown_groups():
+ app.interface.roster.remove_contact(
+ self.contact.jid, self.account, force=True, backend=True)
+ return
+ app.interface.roster.draw_contact(self.contact.jid, self.account)
+
+ NewConfirmationDialog(
+ _('Block Contact'),
+ _('Really block this contact?'),
+ _('You will appear offline for this contact and you will '
+ 'not receive further messages.'),
+ [DialogButton.make('Cancel'),
+ DialogButton.make('OK',
+ text=_('_Report Spam'),
+ callback=_block_contact,
+ kwargs={'report': 'spam'}),
+ DialogButton.make('Remove',
+ text=_('_Block'),
+ callback=_block_contact)],
+ modal=False).show()
+
def _on_information(self, _action, _param):
app.interface.roster.on_info(None, self.contact, self.account)
=====================================
gajim/gui_menu_builder.py
=====================================
@@ -522,6 +522,7 @@ def get_singlechat_menu(control_id, account, jid):
(_('Send Chatstate'), ['chatstate']),
('win.invite-contacts-', _('Invite Contacts…')),
('win.add-to-roster-', _('Add to Contact List…')),
+ ('win.block-contact-', _('Block Contact…')),
('win.toggle-audio-', _('Voice Chat')),
('win.toggle-video-', _('Video Chat')),
('win.information-', _('Information')),
=====================================
gajim/roster_window.py
=====================================
@@ -2787,8 +2787,8 @@ class RosterWindow:
self.draw_contact(contact.jid, acct)
def _block_it(is_checked=None):
- if is_checked is not None: # dialog has been shown
- if is_checked: # user does not want to be asked again
+ if is_checked is not None: # Dialog has been shown
+ if is_checked:
app.config.set('confirm_block', 'no')
else:
app.config.set('confirm_block', 'yes')
@@ -2804,25 +2804,22 @@ class RosterWindow:
if group is None:
title = _('Block Contact')
pritext = _('Really block this contact?')
- sectext = _('This contact will see you offline and you will not '
- 'receive any messages sent to you by this contact.')
- button_text = _('_Block Contact')
+ sectext = _('You will appear offline for this contact and you '
+ 'will not receive further messages.')
else:
title = _('Block Group')
pritext = _('Really block this group?')
- sectext = _('All contacts of this group will see you as offline '
- 'and you will not receive any messages sent to you '
- 'by any one of these contacts.')
- button_text = _('_Block Group')
+ sectext = _('You will appear offline for these contacts '
+ 'and you will not receive further messages.')
NewConfirmationCheckDialog(
title,
pritext,
sectext,
- _('_Do not ask me again'),
+ _('_Do not ask again'),
[DialogButton.make('Cancel'),
DialogButton.make('Remove',
- text=button_text,
+ text=_('_Block'),
callback=_block_it)],
modal=False).show()
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/6ad2dfb8d2b1c76429ed4b0ce2a9407…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/6ad2dfb8d2b1c76429ed4b0ce2a9407…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
6ad2dfb8 by wurstsalat at 2020-07-05T15:42:39+02:00
ChatControl: Remove account string from banner
- - - - -
1 changed file:
- gajim/chat_control.py
Changes:
=====================================
gajim/chat_control.py
=====================================
@@ -802,37 +802,15 @@ class ChatControl(ChatControlBase):
name, jid
"""
contact = self.contact
- jid = contact.jid
-
name = contact.get_shown_name()
if self.resource:
name += '/' + self.resource
if self._type.is_privatechat:
- name = i18n.direction_mark + _(
+ name = i18n.direction_mark + _(
'%(nickname)s from group chat %(room_name)s') % \
{'nickname': name, 'room_name': self.room_name}
name = i18n.direction_mark + GLib.markup_escape_text(name)
- # We know our contacts nick, but if another contact has the same nick
- # in another account we need to also display the account.
- # except if we are talking to two different resources of the
- # same contact
- acct_info = ''
- for account in app.contacts.get_accounts():
- if account == self.account:
- continue
- if acct_info: # We already found a contact with same nick
- break
- for jid in app.contacts.get_jid_list(account):
- other_contact_ = \
- app.contacts.get_first_contact_from_jid(account, jid)
- if other_contact_.get_shown_name() == \
- self.contact.get_shown_name():
- acct_info = i18n.direction_mark + ' (%s)' % \
- GLib.markup_escape_text(
- app.get_account_label(self.account))
- break
-
status = contact.status
if status is not None:
status_reduced = helpers.reduce_chars_newlines(status, max_lines=1)
@@ -849,17 +827,12 @@ class ChatControl(ChatControlBase):
if app.config.get('show_chatstate_in_banner'):
chatstate = helpers.get_uf_chatstate(cs)
- label_text = '<span>%s</span><span size="x-small" weight="light">%s %s</span>' \
- % (name, acct_info, chatstate)
- if acct_info:
- acct_info = i18n.direction_mark + ' ' + acct_info
- label_tooltip = '%s%s %s' % (name, acct_info, chatstate)
+ label_text = '<span>%s</span><span size="x-small" weight="light"> %s</span>' % \
+ (name, chatstate)
+ label_tooltip = '%s %s' % (name, chatstate)
else:
- label_text = '<span>%s</span><span size="x-small" weight="light">%s</span>' % \
- (name, acct_info)
- if acct_info:
- acct_info = i18n.direction_mark + ' ' + acct_info
- label_tooltip = '%s%s' % (name, acct_info)
+ label_text = '<span>%s</span>' % name
+ label_tooltip = name
if status_escaped:
status_text = make_href_markup(status_escaped)
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/6ad2dfb8d2b1c76429ed4b0ce2a94073…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/6ad2dfb8d2b1c76429ed4b0ce2a94073…
You're receiving this email because of your account on dev.gajim.org.