Philipp Hörist pushed to branch master at gajim / gajim
Commits:
77613c22 by Philipp Hörist at 2019-12-07T12:14:58Z
Accounts: Move changing config setting to gui_interface
- - - - -
71197932 by Philipp Hörist at 2019-12-07T12:14:58Z
Simplify remove_account()
Use disable_account() before removing
- - - - -
c986abcd by Philipp Hörist at 2019-12-07T12:14:58Z
Extend get_connected_accounts()
Add option to exclude Local account from the result
- - - - -
b022f883 by Philipp Hörist at 2019-12-07T12:14:58Z
Update the state of app actions
This allows us to update certain actions, e.g. when no account is connected
- - - - -
9f5b83e0 by Philipp Hörist at 2019-12-07T12:14:58Z
CreateGroupchat: Show only connected accounts
- - - - -
6 changed files:
- gajim/application.py
- gajim/common/app.py
- gajim/gtk/accounts.py
- gajim/gtk/groupchat_creation.py
- gajim/gui_interface.py
- gajim/roster_window.py
Changes:
=====================================
gajim/application.py
=====================================
@@ -239,6 +239,7 @@ class GajimApplication(Gtk.Application):
self._set_shortcuts()
from gajim import gui_menu_builder
gui_menu_builder.build_accounts_menu()
+ self.update_app_actions_state()
app.ged.register_event_handler('feature-discovered',
ged.CORE,
@@ -535,6 +536,13 @@ class GajimApplication(Gtk.Application):
# We go online
self.lookup_action(account + action_name).set_enabled(True)
+ def update_app_actions_state(self):
+ active_accounts = bool(app.get_connected_accounts(exclude_local=True))
+ self.lookup_action('create-groupchat').set_enabled(active_accounts)
+
+ enabled_accounts = app.contacts.get_accounts()
+ self.lookup_action('start-chat').set_enabled(enabled_accounts)
+
def _set_shortcuts(self):
shortcuts = {
'app.quit': ['<Primary>Q'],
=====================================
gajim/common/app.py
=====================================
@@ -415,12 +415,14 @@ def get_number_of_connected_accounts(accounts_list=None):
connected_accounts = connected_accounts + 1
return connected_accounts
-def get_connected_accounts():
+def get_connected_accounts(exclude_local=False):
"""
Returns a list of CONNECTED accounts
"""
account_list = []
for account in connections:
+ if account == 'Local' and exclude_local:
+ continue
if account_is_connected(account):
account_list.append(account)
return account_list
=====================================
gajim/gtk/accounts.py
=====================================
@@ -521,7 +521,6 @@ class AccountRow(Gtk.ListBoxRow):
app.connections[account].change_status('offline', 'offline')
app.connections[account].disconnect(reconnect=False)
app.interface.disable_account(account)
- app.config.set_per('accounts', account, 'active', False)
switch.set_state(state)
old_state = app.config.get_per('accounts', account, 'active')
@@ -547,7 +546,6 @@ class AccountRow(Gtk.ListBoxRow):
app.interface.enable_account(account)
else:
app.interface.disable_account(account)
- app.config.set_per('accounts', account, 'active', state)
return Gdk.EVENT_PROPAGATE
=====================================
gajim/gtk/groupchat_creation.py
=====================================
@@ -62,7 +62,7 @@ class CreateGroupchatWindow(Gtk.ApplicationWindow):
self.set_focus(self._ui.address_entry)
def _fill_account_combo(self, account):
- accounts = app.get_enabled_accounts_with_labels()
+ accounts = app.get_enabled_accounts_with_labels(connected_only=True)
account_liststore = self._ui.account_combo.get_model()
for acc in accounts:
account_liststore.append(acc)
=====================================
gajim/gui_interface.py
=====================================
@@ -1762,6 +1762,8 @@ class Interface:
self.roster.setup_and_draw_roster()
gui_menu_builder.build_accounts_menu()
self.roster.send_status(account, 'online', '')
+ app.config.set_per('accounts', account, 'active', True)
+ app.app.update_app_actions_state()
def disable_account(self, account):
self.roster.close_all(account, force=True)
@@ -1796,42 +1798,21 @@ class Interface:
'accounts', account, 'roster_version', '')
self.roster.setup_and_draw_roster()
gui_menu_builder.build_accounts_menu()
+ app.config.set_per('accounts', account, 'active', False)
+ app.app.update_app_actions_state()
def remove_account(self, account):
- # Close all opened windows
- self.roster.close_all(account, force=True)
if account in app.connections:
app.connections[account].disconnect(reconnect=False)
- app.connections[account].cleanup()
- del app.connections[account]
+
+ self.disable_account(account)
+
app.logger.remove_roster(app.get_jid_from_account(account))
# Delete password must be before del_per() because it calls set_per()
# which would recreate the account with defaults values if not found
passwords.delete_password(account)
app.config.del_per('accounts', account)
- del self.instances[account]
- if account in app.nicks:
- del self.minimized_controls[account]
- del app.nicks[account]
- del app.block_signed_in_notifications[account]
- del app.groups[account]
- app.contacts.remove_account(account)
- del app.gc_connected[account]
- del app.automatic_rooms[account]
- del app.to_be_removed[account]
- del app.newly_added[account]
- del app.sleeper_state[account]
- del app.last_message_time[account]
- del app.status_before_autoaway[account]
- del app.gajim_optional_features[account]
- del app.caps_hash[account]
- if len(app.connections) >= 2: # Do not merge accounts if only one exists
- self.roster.regroup = app.config.get('mergeaccounts')
- else:
- self.roster.regroup = False
- self.roster.setup_and_draw_roster()
app.app.remove_account_actions(account)
- gui_menu_builder.build_accounts_menu()
window = get_app_window('AccountsWindow')
if window is not None:
=====================================
gajim/roster_window.py
=====================================
@@ -2597,6 +2597,7 @@ class RosterWindow:
if app.get_number_of_connected_accounts() == 0:
model[iter_][3] = False
self.application.set_account_actions_state(obj.conn.name)
+ self.application.update_app_actions_state()
else:
# sensitivity for this menuitem
model[iter_][3] = True
@@ -2652,6 +2653,7 @@ class RosterWindow:
def _nec_signed_in(self, obj):
self.application.set_account_actions_state(obj.conn.name, True)
+ self.application.update_app_actions_state()
self.draw_account(obj.conn.name)
def _nec_decrypted_message_received(self, obj):
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/eef27894bff0235be3598b3bd9c14ca6d…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/eef27894bff0235be3598b3bd9c14ca6d…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
eef27894 by Daniel Brötzmann at 2019-12-06T21:48:56Z
ChatControl: Make allow_shutdown more precise
On closing a control this checks if logs are enabled for the contact/account
and displays the appropriate message.
- - - - -
1 changed file:
- gajim/chat_control.py
Changes:
=====================================
gajim/chat_control.py
=====================================
@@ -1136,14 +1136,24 @@ class ChatControl(ChatControlBase):
def allow_shutdown(self, method, on_yes, on_no, _on_minimize):
time_ = app.last_message_time[self.account][self.get_full_jid()]
+ # 2 seconds
if time.time() - time_ < 2:
- # 2 seconds
+ no_log_for = app.config.get_per(
+ 'accounts', self.account, 'no_log_for').split()
+ more = ''
+ if self.contact.jid in no_log_for:
+ more = _('Note: Chat history is disabled for this contact.')
+ if self.account in no_log_for:
+ more = _('Note: Chat history is disabled for this account.')
+ text = _('You just received a new message from %s.\n'
+ 'Do you want to close this tab?') % self.contact.get_shown_name()
+ if more:
+ text += '\n' + more
+
NewConfirmationDialog(
_('Close'),
- _('You just received a new message '
- 'from %s') % self.contact.jid,
- _('If you close this tab while having chat history disabled, '
- 'this message will be lost.'),
+ _('New Message'),
+ text,
[DialogButton.make('Cancel',
callback=lambda: on_no(self)),
DialogButton.make('Remove',
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/eef27894bff0235be3598b3bd9c14ca6d6…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/eef27894bff0235be3598b3bd9c14ca6d6…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
ff61353d by Philipp Hörist at 2019-12-06T21:35:53Z
Refactor pubsub notification handlers
Adapt to nbxmpp changes
- - - - -
7 changed files:
- gajim/common/modules/bookmarks.py
- gajim/common/modules/user_activity.py
- gajim/common/modules/user_avatar.py
- gajim/common/modules/user_location.py
- gajim/common/modules/user_mood.py
- gajim/common/modules/user_nickname.py
- gajim/common/modules/user_tune.py
Changes:
=====================================
gajim/common/modules/bookmarks.py
=====================================
@@ -75,19 +75,8 @@ class Bookmarks(BaseModule):
return self._pubsub_support() and self.conversion_2
@event_node(nbxmpp.NS_BOOKMARKS)
- def _bookmark_event_received(self, _con, stanza, properties):
+ def _bookmark_event_received(self, _con, _stanza, properties):
if properties.pubsub_event.retracted:
- # Unsure how to handle that
- return
-
- bookmarks = properties.pubsub_event.data
- if properties.pubsub_event.deleted or properties.pubsub_event.purged:
- self._log.info('Bookmark node deleted')
- bookmarks = []
-
- elif properties.pubsub_event.data is None:
- self._log.warning('Invalid bookmark data')
- self._log.warning(stanza)
return
if not properties.is_self_message:
@@ -102,6 +91,10 @@ class Bookmarks(BaseModule):
self._log.info('Ignore update, pubsub request in progress')
return
+ bookmarks = properties.pubsub_event.data
+ if bookmarks is None:
+ bookmarks = []
+
old_bookmarks = self._convert_to_set(self._bookmarks)
self._bookmarks = bookmarks
self._act_on_changed_bookmarks(old_bookmarks)
@@ -109,7 +102,7 @@ class Bookmarks(BaseModule):
NetworkEvent('bookmarks-received', account=self._account))
@event_node(nbxmpp.NS_BOOKMARKS_2)
- def _bookmark_2_event_received(self, _con, stanza, properties):
+ def _bookmark_2_event_received(self, _con, _stanza, properties):
if not properties.is_self_message:
self._log.warning('%s has an open access bookmarks node',
properties.jid)
@@ -125,7 +118,7 @@ class Bookmarks(BaseModule):
old_bookmarks = self._convert_to_set(self._bookmarks)
if properties.pubsub_event.deleted or properties.pubsub_event.purged:
- self._log.info('Bookmark node deleted')
+ self._log.info('Bookmark node deleted/purged')
self._bookmarks = []
elif properties.pubsub_event.retracted:
@@ -138,11 +131,6 @@ class Bookmarks(BaseModule):
except KeyError:
pass
- elif properties.pubsub_event.data is None:
- self._log.warning('Invalid bookmark data')
- self._log.warning(stanza)
- return
-
else:
new_bookmark = properties.pubsub_event.data
old_bookmark = self.get_bookmark_from_jid(new_bookmark.jid)
=====================================
gajim/common/modules/user_activity.py
=====================================
@@ -40,18 +40,19 @@ class UserActivity(BaseModule):
@event_node(nbxmpp.NS_ACTIVITY)
def _activity_received(self, _con, _stanza, properties):
- data = properties.pubsub_event.data
- empty = properties.pubsub_event.empty
+ if properties.pubsub_event.retracted:
+ return
+ data = properties.pubsub_event.data
for contact in app.contacts.get_contacts(self._account,
str(properties.jid)):
- if not empty:
+ if data is not None:
contact.pep[PEPEventType.ACTIVITY] = data
else:
contact.pep.pop(PEPEventType.ACTIVITY, None)
if properties.is_self_message:
- if not empty:
+ if data is not None:
self._con.pep[PEPEventType.ACTIVITY] = data
else:
self._con.pep.pop(PEPEventType.ACTIVITY, None)
=====================================
gajim/common/modules/user_avatar.py
=====================================
@@ -35,12 +35,14 @@ class UserAvatar(BaseModule):
@event_node(nbxmpp.NS_AVATAR_METADATA)
def _avatar_metadata_received(self, _con, _stanza, properties):
+ if properties.pubsub_event.retracted:
+ return
+
data = properties.pubsub_event.data
- empty = properties.pubsub_event.empty
jid = str(properties.jid)
own_jid = self._con.get_own_jid().getBare()
- if empty:
+ if data is None:
# Remove avatar
self._log.info('Remove: %s', jid)
app.contacts.set_avatar(self._account, jid, None)
=====================================
gajim/common/modules/user_location.py
=====================================
@@ -37,18 +37,19 @@ class UserLocation(BaseModule):
@event_node(nbxmpp.NS_LOCATION)
def _location_received(self, _con, _stanza, properties):
- data = properties.pubsub_event.data
- empty = properties.pubsub_event.empty
+ if properties.pubsub_event.retracted:
+ return
+ data = properties.pubsub_event.data
for contact in app.contacts.get_contacts(self._account,
str(properties.jid)):
- if not empty:
+ if data is not None:
contact.pep[PEPEventType.LOCATION] = data
else:
contact.pep.pop(PEPEventType.LOCATION, None)
if properties.is_self_message:
- if not empty:
+ if data is not None:
self._con.pep[PEPEventType.LOCATION] = data
else:
self._con.pep.pop(PEPEventType.LOCATION, None)
=====================================
gajim/common/modules/user_mood.py
=====================================
@@ -40,18 +40,19 @@ class UserMood(BaseModule):
@event_node(nbxmpp.NS_MOOD)
def _mood_received(self, _con, _stanza, properties):
- data = properties.pubsub_event.data
- empty = properties.pubsub_event.empty
+ if properties.pubsub_event.retracted:
+ return
+ data = properties.pubsub_event.data
for contact in app.contacts.get_contacts(self._account,
str(properties.jid)):
- if not empty:
+ if data is not None:
contact.pep[PEPEventType.MOOD] = data
else:
contact.pep.pop(PEPEventType.MOOD, None)
if properties.is_self_message:
- if not empty:
+ if data is not None:
self._con.pep[PEPEventType.MOOD] = data
else:
self._con.pep.pop(PEPEventType.MOOD, None)
=====================================
gajim/common/modules/user_nickname.py
=====================================
@@ -38,6 +38,9 @@ class UserNickname(BaseModule):
@event_node(nbxmpp.NS_NICK)
def _nickname_received(self, _con, _stanza, properties):
+ if properties.pubsub_event.retracted:
+ return
+
nick = properties.pubsub_event.data
if properties.is_self_message:
if nick is None:
=====================================
gajim/common/modules/user_tune.py
=====================================
@@ -40,18 +40,19 @@ class UserTune(BaseModule):
@event_node(nbxmpp.NS_TUNE)
def _tune_received(self, _con, _stanza, properties):
- data = properties.pubsub_event.data
- empty = properties.pubsub_event.empty
+ if properties.pubsub_event.retracted:
+ return
+ data = properties.pubsub_event.data
for contact in app.contacts.get_contacts(self._account,
str(properties.jid)):
- if not empty:
+ if data is not None:
contact.pep[PEPEventType.TUNE] = data
else:
contact.pep.pop(PEPEventType.TUNE, None)
if properties.is_self_message:
- if not empty:
+ if data is not None:
self._con.pep[PEPEventType.TUNE] = data
else:
self._con.pep.pop(PEPEventType.TUNE, None)
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/ff61353d8d6d6b1a97d66db100da8a7eea…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/ff61353d8d6d6b1a97d66db100da8a7eea…
You're receiving this email because of your account on dev.gajim.org.
Yann Leboulanger pushed to branch master at gajim / gajim
Commits:
06f2b08f by Yann Leboulanger at 2019-12-06T08:25:49Z
there is no more core plugins. see [765180d1]
- - - - -
1 changed file:
- scripts/dev/plugins_translate
Changes:
=====================================
scripts/dev/plugins_translate
=====================================
@@ -14,13 +14,6 @@ check_args()
init_ln()
{
- if [ -e "core_plugins" ] && [ ! -L "core_plugins" ]; then
- echo "core_plugins must be a symbolic link" >&2
- exit 1
- fi
- if [ ! -e "core_plugins" ]; then
- ln -s ../../plugins core_plugins
- fi
if [ ! -L "community_plugins" ]; then
echo "community_plugins should be a symbolic link to gajim-plugins repository, else they won't be in po files"
fi
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/06f2b08f674702fdbacff23fab63197d83…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/06f2b08f674702fdbacff23fab63197d83…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
69770417 by Philipp Hörist at 2019-12-02T21:26:20Z
Pylint: Don't check for optional module
- - - - -
0b11fb4b by Philipp Hörist at 2019-12-02T21:27:32Z
Update pylintrc
pylint throws false positive no-member errors because the class is overridden
in pygobject and pylint seem not to pick up on this
- - - - -
713a95fb by Philipp Hörist at 2019-12-02T21:42:29Z
CI: Update pylint script
- - - - -
3 changed files:
- gajim/common/dbus/location.py
- pylintrc
- scripts/dev/pylint-ci.sh
Changes:
=====================================
gajim/common/dbus/location.py
=====================================
@@ -23,7 +23,7 @@ from nbxmpp.structs import LocationData
from gajim.common import app
if app.is_installed('GEOCLUE'):
- from gi.repository import Geoclue # pylint: disable=ungrouped-imports
+ from gi.repository import Geoclue # pylint: disable=ungrouped-imports,no-name-in-module
log = logging.getLogger('gajim.c.dbus.location')
=====================================
pylintrc
=====================================
@@ -140,7 +140,7 @@ ignore-mixin-members=yes
# List of class names for which member attributes should not be checked (useful
# for classes with dynamically set attributes). This supports the use of
# qualified names.
-ignored-classes=optparse.Values,thread._local,_thread._local
+ignored-classes=optparse.Values,thread._local,_thread._local,gi.repository.GLib.Error
# List of module names for which member attributes should not be checked
# (useful for modules/projects where namespaces are manipulated during runtime
=====================================
scripts/dev/pylint-ci.sh
=====================================
@@ -11,9 +11,10 @@ IGNORE_GTK_MODULE_ERRORS=C0103,C0301,C0330,C0415,E0401,E0611,E1101,E1133,E1136,R
"$PYLINT" --version
-"$PYLINT" --disable=$IGNORE_ERRORS --ignore=modules,gtk "$@"
+"$PYLINT" --disable=$IGNORE_ERRORS --ignore=modules,dbus,gtk "$@"
"$PYLINT" --disable=$IGNORE_GTK_MODULE_ERRORS "$@/gtk"
"$PYLINT" --disable=E0401,C0415 "$@/common/modules"
+"$PYLINT" "$@/common/dbus"
# C0103 invalid-name
# C0301 line-too-long
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/2499d4dc20bf30b1bc701b8962c4d8e6d…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/2499d4dc20bf30b1bc701b8962c4d8e6d…
You're receiving this email because of your account on dev.gajim.org.