Philipp Hörist pushed to branch master at gajim / gajim
Commits:
760645f5 by Philipp Hörist at 2018-12-15T22:37:44Z
Improve MUC notifications
- Play sound for received messages, if notify for all messages is activated
- Send system notifications on MUC messages
- Make notify for all the default in private MUCs
Fixes #9383
- - - - -
9 changed files:
- gajim/chat_control_base.py
- gajim/common/config.py
- gajim/common/connection_handlers_events.py
- gajim/common/events.py
- gajim/groupchat_control.py
- gajim/gtk/notification.py
- gajim/gtk/util.py
- gajim/message_window.py
- gajim/roster_window.py
Changes:
=====================================
gajim/chat_control_base.py
=====================================
@@ -905,8 +905,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
return
if kind == 'incoming':
if not self.type_id == message_control.TYPE_GC or \
- app.config.get('notify_on_all_muc_messages') or \
- app.config.get_per('rooms', jid, 'notify_on_all_messages') or \
+ app.config.notify_for_muc(jid) or \
'marked' in other_tags_for_text:
# it's a normal message, or a muc message with want to be
# notified about if quitting just after
=====================================
gajim/common/config.py
=====================================
@@ -482,7 +482,7 @@ class Config:
'contact_disconnected': [False, 'disconnected.wav'],
'message_sent': [False, 'sent.wav'],
'muc_message_highlight': [True, 'gc_message1.wav', _('Sound to play when a group chat message contains one of the words in muc_highlight_words, or when a group chat message contains your nickname.')],
- 'muc_message_received': [False, 'gc_message2.wav', _('Sound to play when any MUC message arrives.')],
+ 'muc_message_received': [True, 'gc_message2.wav', _('Sound to play when any MUC message arrives.')],
}
proxies_default = {
@@ -638,13 +638,15 @@ class Config:
obj[subname] = value
self._timeout_save()
- def get_per(self, optname, key=None, subname=None): # per_group_of_option
+ def get_per(self, optname, key=None, subname=None, default=None): # per_group_of_option
if optname not in self.__options_per_key:
return None
dict_ = self.__options_per_key[optname][1]
if not key:
return list(dict_.keys())
if key not in dict_:
+ if default is not None:
+ return default
if subname in self.__options_per_key[optname][0]:
return self.__options_per_key[optname][0][subname][1]
return None
@@ -712,6 +714,11 @@ class Config:
return (account not in no_log_for) and (jid not in no_log_for)
+ def notify_for_muc(self, room):
+ all_ = self.get('notify_on_all_muc_messages')
+ room = self.get_per('rooms', room, 'notify_on_all_messages')
+ return all_ or room
+
def _init_options(self):
for opt in self.__options[0]:
self.__options[1][opt] = self.__options[0][opt][Option.VAL]
=====================================
gajim/common/connection_handlers_events.py
=====================================
@@ -1036,7 +1036,46 @@ class NotificationEvent(nec.NetworkIncomingEvent):
else:
self.do_sound = False
- self.do_popup = False
+ self.control = app.interface.msg_win_mgr.search_control(
+ msg_obj.jid, self.account)
+
+ if self.control is not None:
+ self.control_focused = self.control.has_focus()
+
+ if app.config.get('notify_on_new_message'):
+ notify_for_muc = (app.config.notify_for_muc(self.jid) or
+ sound == 'highlight')
+ if not notify_for_muc:
+ self.do_popup = False
+
+ elif self.control_focused:
+ self.do_popup = False
+
+ elif app.config.get('autopopupaway'):
+ # always show notification
+ self.do_popup = True
+
+ elif app.connections[self.conn.name].connected in (2, 3):
+ # we're online or chat
+ self.do_popup = True
+
+ self.popup_msg_type = 'gc_msg'
+ self.popup_event_type = _('New Group Chat Message')
+
+ if app.config.get('notification_preview_message'):
+ self.popup_text = msg_obj.msgtxt
+
+ type_events = ['printed_marked_gc_msg', 'printed_gc_msg']
+ count = len(app.events.get_events(self.account, self.jid, type_events))
+
+ contact = app.contacts.get_contact(self.account, self.jid)
+
+ self.popup_title = i18n.ngettext(
+ 'New message from %(nickname)s',
+ '%(n_msgs)i unread messages in %(groupchat_name)s',
+ count) % {'nickname': self.base_event.nick,
+ 'n_msgs': count,
+ 'groupchat_name': contact.get_shown_name()}
def handle_incoming_pres_event(self, pres_obj):
if app.jid_is_transport(pres_obj.jid):
=====================================
gajim/common/events.py
=====================================
@@ -332,6 +332,16 @@ class Events:
events_list.append(ev)
return events_list
+ def get_all_events(self, types=None):
+ accounts = self._events.keys()
+ events = []
+ for account in accounts:
+ for jid in self._events[account]:
+ for event in self._events[account][jid]:
+ if types is None or event.type_ in types:
+ events.append(event)
+ return events
+
def get_first_event(self, account=None, jid=None, type_=None):
"""
Return the first event of type type_ if given
=====================================
gajim/groupchat_control.py
=====================================
@@ -375,8 +375,11 @@ class GroupchatControl(ChatControlBase):
act.connect('change-state', self._on_minimize)
self.parent_win.window.add_action(act)
+ # Enable notify on all for private rooms
+ members_only = muc_caps_cache.supports(self.contact.jid,
+ 'muc#roomconfig_membersonly')
value = app.config.get_per(
- 'rooms', self.contact.jid, 'notify_on_all_messages')
+ 'rooms', self.contact.jid, 'notify_on_all_messages', members_only)
act = Gio.SimpleAction.new_stateful(
'notify-on-message-' + self.control_id,
@@ -1294,8 +1297,7 @@ class GroupchatControl(ChatControlBase):
def get_nb_unread(self):
type_events = ['printed_marked_gc_msg']
- if app.config.get('notify_on_all_muc_messages') or \
- app.config.get_per('rooms', self.room_jid, 'notify_on_all_messages'):
+ if app.config.notify_for_muc(self.room_jid):
type_events.append('printed_gc_msg')
nb = len(app.events.get_events(self.account, self.room_jid,
type_events))
@@ -1314,25 +1316,30 @@ class GroupchatControl(ChatControlBase):
Returns a 2-Tuple. The first says whether or not to highlight the text,
the second, what sound to play
"""
- highlight, sound = (None, None)
+ highlight, sound = None, None
+
+ notify = app.config.notify_for_muc(self.room_jid)
+ message_sound_enabled = app.config.get_per('soundevents',
+ 'muc_message_received',
+ 'enabled')
# Are any of the defined highlighting words in the text?
if self.needs_visual_notification(text):
highlight = True
- if app.config.get_per('soundevents', 'muc_message_highlight',
- 'enabled'):
+ if app.config.get_per('soundevents',
+ 'muc_message_highlight',
+ 'enabled'):
sound = 'highlight'
# Do we play a sound on every muc message?
- elif app.config.get_per('soundevents', 'muc_message_received', \
- 'enabled'):
+ elif notify and message_sound_enabled:
sound = 'received'
# Is it a history message? Don't want sound-floods when we join.
if tim is not None and time.mktime(time.localtime()) - tim > 1:
sound = None
- return (highlight, sound)
+ return highlight, sound
def check_and_possibly_add_focus_out_line(self):
"""
=====================================
gajim/gtk/notification.py
=====================================
@@ -111,7 +111,8 @@ class Notification:
if event.type_ == 'gc-invitation':
self._withdraw('gc-invitation', event.account, event.room_jid)
if event.type_ in ('normal', 'printed_chat', 'chat',
- 'printed_pm', 'pm'):
+ 'printed_pm', 'pm', 'printed_marked_gc_msg',
+ 'printed_gc_msg'):
self._withdraw('new-message', event.account, event.jid)
def _nec_our_status(self, obj):
@@ -164,6 +165,7 @@ class Notification:
if event_type in (
_('Contact Signed In'), _('Contact Signed Out'),
_('New Message'), _('New Single Message'), _('New Private Message'),
+ _('New Group Chat Message'),
_('Contact Changed Status'), _('File Transfer Request'),
_('File Transfer Error'), _('File Transfer Completed'),
_('File Transfer Stopped'), _('Groupchat Invitation'),
@@ -193,7 +195,8 @@ class Notification:
notif_id = self._make_id('connection-failed', account)
elif event_type in (_('New Message'),
_('New Single Message'),
- _('New Private Message')):
+ _('New Private Message'),
+ _('New Group Chat Message')):
avatar = app.contacts.get_avatar(account, jid)
if avatar:
icon_pixbuf = avatar
=====================================
gajim/gtk/util.py
=====================================
@@ -467,11 +467,8 @@ def get_show_in_systray(type_, jid):
"""
Return True if this event must be shown in systray, else False
"""
- notify = app.config.get('notify_on_all_muc_messages')
- notify_for_jid = app.config.get_per(
- 'rooms', jid, 'notify_on_all_messages')
-
- if type_ == 'printed_gc_msg' and not notify and not notify_for_jid:
+ notify = app.config.notify_for_muc(jid)
+ if type_ == 'printed_gc_msg' and not notify:
# it's not an highlighted message, don't show in systray
return False
return app.config.get('trayicon_notification_on_events')
=====================================
gajim/message_window.py
=====================================
@@ -490,10 +490,9 @@ class MessageWindow:
return
unread = 0
for ctrl in self.controls():
- if ctrl.type_id == message_control.TYPE_GC and not \
- app.config.get('notify_on_all_muc_messages') and not \
- app.config.get_per('rooms', ctrl.room_jid,
- 'notify_on_all_messages') and not ctrl.attention_flag:
+ if (ctrl.type_id == message_control.TYPE_GC and not
+ app.config.notify_for_muc(ctrl.room_jid) and not
+ ctrl.attention_flag):
# count only pm messages
unread += ctrl.get_nb_unread_pm()
continue
@@ -509,10 +508,8 @@ class MessageWindow:
if control.type_id == message_control.TYPE_GC:
name = control.room_jid.split('@')[0]
- urgent = control.attention_flag or \
- app.config.get('notify_on_all_muc_messages') or \
- app.config.get_per('rooms', control.room_jid,
- 'notify_on_all_messages')
+ urgent = (control.attention_flag or
+ app.config.notify_for_muc(control.room_jid))
else:
name = control.contact.get_shown_name()
if control.resource:
=====================================
gajim/roster_window.py
=====================================
@@ -2520,10 +2520,10 @@ class RosterWindow:
return
# check if we have unread messages
unread = app.events.get_nb_events()
- if not app.config.get('notify_on_all_muc_messages'):
- unread_not_to_notify = app.events.get_nb_events(
- ['printed_gc_msg'])
- unread -= unread_not_to_notify
+
+ for event in app.events.get_all_events(['printed_gc_msg']):
+ if not app.config.notify_for_muc(event.jid):
+ unread -= 1
# check if we have recent messages
recent = False
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/760645f5c3006de6c47353c02461f8067f…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/760645f5c3006de6c47353c02461f8067f…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
dac53707 by Philipp Hörist at 2018-12-14T20:39:58Z
Dont draw contact after selection change
This seems to be an old codepath, currently there is no need to redraw a contact on selection change
Fixes #9496
- - - - -
1 changed file:
- gajim/groupchat_control.py
Changes:
=====================================
gajim/groupchat_control.py
=====================================
@@ -174,8 +174,6 @@ class GroupchatControl(ChatControlBase):
self.widget_set_visible(self.xml.get_object('banner_eventbox'),
app.config.get('hide_groupchat_banner'))
- self._last_selected_contact = None # None or holds jid, account tuple
-
# muc attention flag (when we are mentioned in a muc)
# if True, the room has mentioned us
self.attention_flag = False
@@ -198,12 +196,8 @@ class GroupchatControl(ChatControlBase):
self.event_box = self.xml.get_object('banner_eventbox')
self.list_treeview = self.xml.get_object('list_treeview')
- selection = self.list_treeview.get_selection()
- id_ = selection.connect('changed',
- self.on_list_treeview_selection_changed)
- self.handlers[id_] = selection
id_ = self.list_treeview.connect('style-set',
- self.on_list_treeview_style_set)
+ self.on_list_treeview_style_set)
self.handlers[id_] = self.list_treeview
# flag that stops hpaned position event
@@ -912,21 +906,6 @@ class GroupchatControl(ChatControlBase):
nick = contact[Column.NICK]
self.draw_contact(nick)
- def on_list_treeview_selection_changed(self, selection):
- model, selected_iter = selection.get_selected()
- self.draw_contact(self.nick)
- if self._last_selected_contact is not None:
- self.draw_contact(self._last_selected_contact)
- if selected_iter is None:
- self._last_selected_contact = None
- return
- contact = model[selected_iter]
- nick = contact[Column.NICK]
- self._last_selected_contact = nick
- if contact[Column.TYPE] != 'contact':
- return
- self.draw_contact(nick, selected=True, focus=True)
-
def get_tab_label(self, chatstate):
"""
Markup the label if necessary. Returns a tuple such as: (new_label_str,
@@ -1625,7 +1604,7 @@ class GroupchatControl(ChatControlBase):
if ctrl and msg:
ctrl.send_message(msg)
- def draw_contact(self, nick, selected=False, focus=False):
+ def draw_contact(self, nick):
iter_ = self.get_contact_iter(nick)
if not iter_:
return
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/dac5370780961b05782d0767ee6f21788f…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/dac5370780961b05782d0767ee6f21788f…
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:
7f39ed31 by Philipp Hörist at 2018-12-14T20:14:48Z
Fix bind after failed resume
We already received the features at the time of a failed resume so the handler is never called
- - - - -
1 changed file:
- nbxmpp/bind.py
Changes:
=====================================
nbxmpp/bind.py
=====================================
@@ -47,6 +47,12 @@ class NonBlockingBind(PlugIn):
self._owner.RegisterHandler(
'features', self._on_features, xmlns=NS_STREAMS)
+ feats = self._owner.Dispatcher.Stream.features
+ if feats is not None:
+ if feats.getTag('bind', namespace=NS_BIND) is not None:
+ # We already received the features
+ self._on_features(None, feats)
+
def _on_features(self, _con, feats):
"""
Determine if server supports resource binding and set some internal
@@ -123,4 +129,4 @@ class NonBlockingBind(PlugIn):
if feats.getTag('sm', namespace=NS_STREAM_MGMT):
self._owner.Smacks.send_enable()
self._owner.Dispatcher.Event(Realm.CONNECTING, Event.CONNECTION_ACTIVE)
- self.PlugOut()
\ No newline at end of file
+ self.PlugOut()
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/commit/7f39ed31591c7d0eea66259d4b…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/commit/7f39ed31591c7d0eea66259d4b…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
5843827a by Philipp Hörist at 2018-12-12T22:35:36Z
Fix start chat menu action
Fixes #8275
- - - - -
1 changed file:
- gajim/gui_menu_builder.py
Changes:
=====================================
gajim/gui_menu_builder.py
=====================================
@@ -933,19 +933,13 @@ def get_conv_context_menu(account, kind, text):
menuitem.set_label(label)
if action.startswith('-'):
+ text = text.replace('xmpp:', '')
+ text = text.split('?')[0]
action = 'app.%s%s' % (account, action)
else:
action = 'app.%s' % action
menuitem.set_action_name(action)
- if 'join-groupchat' in action:
- text = text.replace('xmpp:', '')
- text = text.split('?')[0]
-
- if 'add-contact' in action:
- text = text.replace('xmpp:', '')
- text = text.split('?')[0]
-
if action == 'app.open-link':
value = GLib.Variant.new_strv([kind, text])
elif action == 'app.copy-link':
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/5843827abc94818e867dab1b82cdb1d18b…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/5843827abc94818e867dab1b82cdb1d18b…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
4e814dab by Philipp Hörist at 2018-12-10T21:30:37Z
Fix disabled join groupchat menu
When there are no bookmarks on the server the join groupchat menu
was disabled, preventing the user to open the join groupchat dialog
- - - - -
be420d44 by Philipp Hörist at 2018-12-10T21:30:45Z
Implement XEP-0411 Bookmarks Conversion
If bookmarks conversion is announced by the server:
- Dont merge bookmarks
- Only push to either private storage or pubsub
- - - - -
4 changed files:
- gajim/common/modules/bookmarks.py
- gajim/groupchat_control.py
- gajim/gtk/join_groupchat.py
- gajim/gui_menu_builder.py
Changes:
=====================================
gajim/common/modules/bookmarks.py
=====================================
@@ -38,7 +38,6 @@ class Bookmarks:
self._account = con.name
self.bookmarks = {}
self.conversion = False
- self.available = False
self.handlers = []
@@ -96,14 +95,18 @@ class Bookmarks:
def _pubsub_bookmarks_received(self, _con, stanza):
if not nbxmpp.isResultNode(stanza):
log.info('No pubsub bookmarks: %s', stanza.getError())
- # Fallback, request private storage
- self._request_private_bookmarks()
+ # Fallback, request private storage, only if server
+ # doesnt have bookmark conversion
+ if not self.conversion:
+ self._request_private_bookmarks()
return
- self.available = True
log.info('Received Bookmarks (PubSub)')
self._parse_bookmarks(stanza)
- self._request_private_bookmarks()
+ if not self.conversion:
+ # If server does not have bookmark conversion, request private
+ # storage and try to merge the bookmarks
+ self._request_private_bookmarks()
def _request_private_bookmarks(self) -> None:
if not app.account_is_connected(self._account):
@@ -120,7 +123,6 @@ class Bookmarks:
if not nbxmpp.isResultNode(stanza):
log.info('No private bookmarks: %s', stanza.getError())
else:
- self.available = True
log.info('Received Bookmarks (PrivateStorage)')
merged = self._parse_bookmarks(stanza, check_merge=True)
if merged and self._pubsub_support():
@@ -264,6 +266,9 @@ class Bookmarks:
if storage_type is None:
if self._pubsub_support():
self._pubsub_store(storage_node)
+ if self.conversion:
+ # Only push to either pubsub or private storage
+ return
self._private_store(storage_node)
elif storage_type == BookmarkStorageType.PUBSUB:
if self._pubsub_support():
=====================================
gajim/groupchat_control.py
=====================================
@@ -419,10 +419,9 @@ class GroupchatControl(ChatControlBase):
# Bookmarks
con = app.connections[self.account]
- bookmark_support = con.get_module('Bookmarks').available
bookmarked = self.room_jid in con.get_module('Bookmarks').bookmarks
win.lookup_action('bookmark-' + self.control_id).set_enabled(
- self.is_connected and bookmark_support and not bookmarked)
+ self.is_connected and not bookmarked)
# Request Voice
role = self.get_role(self.nick)
=====================================
gajim/gtk/join_groupchat.py
=====================================
@@ -113,10 +113,6 @@ class JoinGroupchatWindow(Gtk.ApplicationWindow):
# Set bookmark switch sensitive if server supports bookmarks
acc = self.account_combo.get_active_id()
- con = app.connections[acc]
- if not con.get_module('Bookmarks').available:
- self.bookmark_switch.set_sensitive(False)
- self.autojoin_switch.set_sensitive(False)
self.show_all()
=====================================
gajim/gui_menu_builder.py
=====================================
@@ -714,10 +714,8 @@ def get_groupchat_menu(control_id, account, jid):
def get_bookmarks_menu(account, rebuild=False):
con = app.connections[account]
- boomarks = con.get_module('Bookmarks').get_sorted_bookmarks(
- short_name=True)
- if not boomarks:
- return None
+ boomarks = con.get_module('Bookmarks').get_sorted_bookmarks(short_name=True)
+
menu = Gio.Menu()
# Build Join Groupchat
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/6e30d3af6473d41de42f1d60cd0363215…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/6e30d3af6473d41de42f1d60cd0363215…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch gajim_1.1 at gajim / gajim
Commits:
c9033938 by Philipp Hörist at 2018-12-09T20:41:25Z
Update ChangeLog
- - - - -
1 changed file:
- ChangeLog
Changes:
=====================================
ChangeLog
=====================================
@@ -1,3 +1,24 @@
+Gajim 1.1.1 (10 December 2018)
+
+ Bug fixes
+
+ * 9427 Placeholder not cleared if pasting text into message input
+ * 9444 Determine the delay timestamp correctly when using mam:1
+ * 9453 Fix opening links inside the group chat subject (MacOS/Windows)
+ * 9465 Allow the full range of possible nicknames in group chats
+ * 9067 Gajim crashes when receiving xhtml messages
+ * 9472 Handle presences without from attr correctly
+ * 9473 Error when creating a new group chat
+ * 9491 Identify group chat subject changes correctly
+ * Determine soundplayer correctly on unix systems
+ * In some circumstances plugins could not be deleted
+ * Show correct contact status on tabs
+ * Dont answer group chat receipt requests
+ * Fix receipts for private messages
+ * Pressing the back button in the Accounts window leads to an error
+ * Better handle not available keyring backends
+ * Dont show incorrect contact on private messages
+
Gajim 1.1.0 (06 November 2018)
New
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/c90339383c5276df677407e63af3dbad05…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/c90339383c5276df677407e63af3dbad05…
You're receiving this email because of your account on dev.gajim.org.