Philipp Hörist pushed to branch master at gajim / gajim
Commits:
7ed18786 by lovetox at 2020-09-19T12:59:00+02:00
Notifications: Remove notify on signin/signout
Feature is not very useful, needs to be reimplemented with an option
to track status changes per contact
- - - - -
28d11df0 by lovetox at 2020-09-19T13:49:03+02:00
Notifications: Remove setting
We don’t show a notification if a chat has focus, in all other cases
a notification is shown
- - - - -
8 changed files:
- gajim/common/config.py
- gajim/common/connection_handlers_events.py
- gajim/common/helpers.py
- gajim/common/setting_values.py
- gajim/data/style/default.css
- gajim/gtk/notification.py
- gajim/gtk/preferences.py
- gajim/gtk/util.py
Changes:
=====================================
gajim/common/config.py
=====================================
@@ -67,11 +67,8 @@ class Config:
# name: [ type, default_value, help_string, restart ]
'verbose': [opt_bool, False, '', True],
'autopopup': [opt_bool, False],
- 'notify_on_signin': [opt_bool, False],
- 'notify_on_signout': [opt_bool, False],
'notify_on_new_message': [opt_bool, True],
'autopopupaway': [opt_bool, False],
- 'autopopup_chat_opened': [opt_bool, False, _('Show desktop notification even when a chat window is opened for this contact and does not have focus.')],
'sounddnd': [opt_bool, False, _('Play sound even when being busy.')],
'showoffline': [opt_bool, True],
'show_only_chat_and_online': [opt_bool, False, _('Show only online and free for chat contacts in the contact list.')],
=====================================
gajim/common/connection_handlers_events.py
=====================================
@@ -244,8 +244,7 @@ class NotificationEvent(nec.NetworkIncomingEvent):
num_unread) % {'nickname': nick, 'n_msgs': num_unread}
if app.settings.get('notify_on_new_message'):
- if self.first_unread or (app.settings.get('autopopup_chat_opened') \
- and not self.control_focused):
+ if self.first_unread or not self.control_focused:
if app.settings.get('autopopupaway'):
# always show notification
self.do_popup = True
@@ -380,10 +379,7 @@ class NotificationEvent(nec.NetworkIncomingEvent):
if account_server in app.block_signed_in_notifications and \
app.block_signed_in_notifications[account_server]:
block_transport = True
- if helpers.allow_showing_notification(account, 'notify_on_signin') \
- and not app.block_signed_in_notifications[account] and \
- not block_transport:
- self.do_popup = True
+
sound = app.settings.get_soundevent_settings('contact_connected')
if sound['enabled'] and not app.block_signed_in_notifications[account] and\
not block_transport and helpers.allow_sound_notification(account,
@@ -393,9 +389,6 @@ class NotificationEvent(nec.NetworkIncomingEvent):
elif pres_obj.old_show > 1 and pres_obj.new_show < 2:
event = 'contact_disconnected'
- if helpers.allow_showing_notification(account, 'notify_on_signout'):
- self.do_popup = True
-
sound = app.settings.get_soundevent_settings('contact_disconnected')
if sound['enabled'] and helpers.allow_sound_notification(account, event):
self.sound_event = event
@@ -422,18 +415,7 @@ class NotificationEvent(nec.NetworkIncomingEvent):
if pres_obj.status:
self.popup_text = self.popup_text + " : " + pres_obj.status
self.popup_event_type = _('Contact Changed Status')
- elif event == 'contact_connected':
- self.popup_title = _('%(nickname)s Signed In') % {'nickname': nick}
- self.popup_text = ''
- if pres_obj.status:
- self.popup_text = pres_obj.status
- self.popup_event_type = _('Contact Signed In')
- elif event == 'contact_disconnected':
- self.popup_title = _('%(nickname)s Signed Out') % {'nickname': nick}
- self.popup_text = ''
- if pres_obj.status:
- self.popup_text = pres_obj.status
- self.popup_event_type = _('Contact Signed Out')
+
class InformationEvent(nec.NetworkIncomingEvent):
name = 'information'
=====================================
gajim/common/helpers.py
=====================================
@@ -654,21 +654,12 @@ def get_os_info():
info = platform.system()
return info
-def allow_showing_notification(account,
- type_='notify_on_new_message',
- is_first_message=True):
- """
- Is it allowed to show nofication?
-
- Check OUR status and if we allow notifications for that status type is the
- option that need to be True e.g.: notify_on_signing is_first_message: set it
- to false when it's not the first message
- """
- if type_ and (not app.settings.get(type_) or not is_first_message):
+def allow_showing_notification(account):
+ if not app.settings.get('notify_on_new_message'):
return False
if app.settings.get('autopopupaway'):
return True
- if app.connections[account].status in ('online', 'chat'):
+ if app.account_is_available(account):
return True
return False
=====================================
gajim/common/setting_values.py
=====================================
@@ -15,11 +15,8 @@ HAS_ACCOUNT_DEFAULT = _ACCOUNT_DEFAULT()
APP_SETTINGS = {
'verbose': False,
'autopopup': False,
- 'notify_on_signin': False,
- 'notify_on_signout': False,
'notify_on_new_message': True,
'autopopupaway': False,
- 'autopopup_chat_opened': False,
'sounddnd': False,
'showoffline': True,
'show_only_chat_and_online': False,
=====================================
gajim/data/style/default.css
=====================================
@@ -53,12 +53,6 @@
.gajim-notify-message {
color: rgb(30, 144, 255);
}
-.gajim-notify-signin {
- color: rgb(68, 134, 38);
-}
-.gajim-notify-signout {
- color: rgb(134, 22, 22);
-}
.gajim-notify-status {
color: rgb(170, 170, 170);
}
=====================================
gajim/gtk/notification.py
=====================================
@@ -181,7 +181,6 @@ class Notification(EventHelper):
notification.set_body(text)
notif_id = None
if event_type in (
- _('Contact Signed In'), _('Contact Signed Out'),
_('New Message'), _('New Private Message'),
_('New Group Chat Message'),
_('Contact Changed Status'), _('File Transfer Request'),
@@ -203,9 +202,7 @@ class Notification(EventHelper):
variant_dict)
# Only one notification per JID
- if event_type in (_('Contact Signed In'),
- _('Contact Signed Out'),
- _('Contact Changed Status')):
+ if event_type == _('Contact Changed Status'):
notif_id = self._make_id('contact-status-changed', account, jid)
elif event_type == _('Group Chat Invitation'):
notif_id = self._make_id('gc-invitation', account, room_jid)
@@ -264,15 +261,9 @@ class PopupNotification(Gtk.Window):
self._ui = get_builder('popup_notification_window.ui')
self.add(self._ui.eventbox)
- if event_type == _('Contact Signed In'):
- bg_color = app.css_config.get_value('.gajim-notify-signin',
- StyleAttr.COLOR)
- elif event_type == _('Contact Signed Out'):
- bg_color = app.css_config.get_value('.gajim-notify-signout',
- StyleAttr.COLOR)
- elif event_type in (_('New Message'),
- _('New Private Message'),
- _('New E-mail')):
+ if event_type in (_('New Message'),
+ _('New Private Message'),
+ _('New E-mail')):
bg_color = app.css_config.get_value('.gajim-notify-message',
StyleAttr.COLOR)
elif event_type == _('File Transfer Request'):
=====================================
gajim/gtk/preferences.py
=====================================
@@ -487,33 +487,12 @@ class VisualNotifications(PreferenceBox):
props={'entries': event_received_items},
callback=self._set_event_handling),
- Setting(SettingKind.SWITCH,
- _('Always Show Notifications'),
- SettingType.CONFIG,
- 'autopopup_chat_opened',
- desc=_('Show notifications even if there is already '
- 'a chat window opened')),
-
Setting(SettingKind.SWITCH,
_('Notifications When Away'),
SettingType.CONFIG,
'autopopupaway',
desc=_('Show notifications even if you are Away, '
'Busy, etc.')),
-
- Setting(SettingKind.SWITCH,
- _('Contact Online Notification'),
- SettingType.CONFIG,
- 'notify_on_signin',
- desc=_('Show a notification when a contact goes '
- 'online')),
-
- Setting(SettingKind.SWITCH,
- _('Contact Offline Notification'),
- SettingType.CONFIG,
- 'notify_on_signout',
- desc=_('Show a notification when a contact goes '
- 'offline')),
]
PreferenceBox.__init__(self, settings)
=====================================
gajim/gtk/util.py
=====================================
@@ -494,8 +494,6 @@ def get_show_in_roster(event, session=None):
if event == 'gc_message_received':
return True
if event == 'message_received':
- if app.settings.get('autopopup_chat_opened'):
- return True
if session and session.control:
return False
return True
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/59e95afd27b2d9a256d8950b627dc52…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/59e95afd27b2d9a256d8950b627dc52…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
59e95afd by lovetox at 2020-09-19T10:56:34+02:00
Storage: Fix SQL statement
- - - - -
1 changed file:
- gajim/common/storage/archive.py
Changes:
=====================================
gajim/common/storage/archive.py
=====================================
@@ -77,7 +77,7 @@ ARCHIVE_SQL_STATEMENT = '''
jid_id INTEGER PRIMARY KEY UNIQUE,
last_mam_id TEXT,
oldest_mam_timestamp TEXT,
- last_muc_timestamp TEXT,
+ last_muc_timestamp TEXT
);
CREATE INDEX idx_logs_jid_id_time ON logs (jid_id, time DESC);
CREATE INDEX idx_logs_stanza_id ON logs (stanza_id);
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/59e95afd27b2d9a256d8950b627dc526…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/59e95afd27b2d9a256d8950b627dc526…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
2b166066 by lovetox at 2020-09-19T07:53:59+02:00
GroupChatControl: Use helper for popup logic
- - - - -
1 changed file:
- gajim/groupchat_control.py
Changes:
=====================================
gajim/groupchat_control.py
=====================================
@@ -51,6 +51,7 @@ from gajim.common import ged
from gajim.common import helpers
from gajim.common.helpers import event_filter
from gajim.common.helpers import to_user_string
+from gajim.common.helpers import allow_popup_window
from gajim.common.const import AvatarSize
from gajim.common.i18n import _
@@ -916,16 +917,13 @@ class GroupchatControl(ChatControlBase):
additional_data=additional_data)
app.events.add_event(self.account, fjid, event)
- autopopup = app.settings.get('autopopup')
- autopopupaway = app.settings.get('autopopupaway')
- if not autopopup or (not autopopupaway and \
- app.account_is_available(self.account)):
+ if allow_popup_window(self.account):
+ self._start_private_message(nick)
+ else:
self.roster.draw_contact(nick)
if self.parent_win:
self.parent_win.show_title()
self.parent_win.redraw_tab(self)
- else:
- self._start_private_message(nick)
contact = app.contacts.get_contact_with_highest_priority(
self.account, self.room_jid)
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/2b16606612b501cd3cf60d16a40cef66…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/2b16606612b501cd3cf60d16a40cef66…
You're receiving this email because of your account on dev.gajim.org.