Philipp Hörist pushed to branch master at gajim / gajim
Commits:
610218ec by Philipp Hörist at 2019-11-11T21:51:16Z
MessageTextView: Fix pylint errors
- - - - -
19e5a686 by Philipp Hörist at 2019-11-11T21:51:16Z
MessageTextView: Remove unused method
- - - - -
84aa231e by Philipp Hörist at 2019-11-11T21:51:16Z
Rename MessageTextView to MessageInputTextView
To make it more obvious what this class is for
- - - - -
628e675b by Philipp Hörist at 2019-11-11T21:51:16Z
Move message_input module to gtk folder
- - - - -
2 changed files:
- gajim/chat_control_base.py
- gajim/message_textview.py → gajim/gtk/message_input.py
Changes:
=====================================
gajim/chat_control_base.py
=====================================
@@ -49,11 +49,12 @@ from gajim import message_control
from gajim.message_control import MessageControl
from gajim.conversation_textview import ConversationTextview
-from gajim.message_textview import MessageTextView
+
from gajim.gtk.dialogs import DialogButton
from gajim.gtk.dialogs import NewConfirmationDialog
from gajim.gtk.dialogs import NewConfirmationCheckDialog
+from gajim.gtk.message_input import MessageInputTextView
from gajim.gtk import util
from gajim.gtk.util import at_the_end
from gajim.gtk.util import get_show_in_roster
@@ -80,7 +81,7 @@ if app.is_installed('GSPELL'):
################################################################################
class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
"""
- A base class containing a banner, ConversationTextview, MessageTextView
+ A base class containing a banner, ConversationTextview, MessageInputTextView
"""
# This is needed so copying text from the conversation textview
@@ -289,8 +290,8 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
self.correcting = False
self.last_sent_msg = None
- # add MessageTextView to UI and connect signals
- self.msg_textview = MessageTextView()
+ # add MessageInputTextView to UI and connect signals
+ self.msg_textview = MessageInputTextView()
self.msg_scrolledwindow = ScrolledWindow()
self.msg_scrolledwindow.add(self.msg_textview)
@@ -547,7 +548,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
def _on_html_textview_grab_focus(self, textview):
# Abort signal so the textview does not get focused
- # Focus the MessageTextView instead
+ # Focus the MessageInputTextView instead
GObject.signal_stop_emission_by_name(textview, 'grab-focus')
self.msg_textview.grab_focus()
return Gdk.EVENT_STOP
=====================================
gajim/message_textview.py → gajim/gtk/message_input.py
=====================================
@@ -34,7 +34,7 @@ if app.is_installed('GSPELL'):
from gi.repository import Gspell # pylint: disable=ungrouped-imports
-class MessageTextView(Gtk.TextView):
+class MessageInputTextView(Gtk.TextView):
"""
Class for the message textview (where user writes new messages) for
chat/groupchat windows
@@ -90,12 +90,15 @@ class MessageTextView(Gtk.TextView):
self.begin_tags['italic'] = '<em>'
self.end_tags['italic'] = '</em>'
self.other_tags['underline'] = buffer_.create_tag('underline')
- self.other_tags['underline'].set_property('underline', Pango.Underline.SINGLE)
- self.begin_tags['underline'] = '<span style="text-decoration: underline;">'
+ self.other_tags['underline'].set_property('underline',
+ Pango.Underline.SINGLE)
+ underline = '<span style="text-decoration: underline;">'
+ self.begin_tags['underline'] = underline
self.end_tags['underline'] = '</span>'
self.other_tags['strike'] = buffer_.create_tag('strike')
self.other_tags['strike'].set_property('strikethrough', True)
- self.begin_tags['strike'] = '<span style="text-decoration: line-through;">'
+ strike = '<span style="text-decoration: line-through;">'
+ self.begin_tags['strike'] = strike
self.end_tags['strike'] = '</span>'
self.connect('paste-clipboard', self._paste_clipboard)
@@ -240,13 +243,15 @@ class MessageTextView(Gtk.TextView):
_buffer = self.get_buffer()
# Create #aabbcc color string from rgba color
color_string = '#%02X%02X%02X' % (round(color.red*255),
- round(color.green*255), round(color.blue*255))
+ round(color.green*255),
+ round(color.blue*255))
tag_name = 'color' + color_string
if not tag_name in self.color_tags:
- tagColor = _buffer.create_tag(tag_name)
- tagColor.set_property('foreground', color_string)
- self.begin_tags[tag_name] = '<span style="color: %s;">' % color_string
+ tag_color = _buffer.create_tag(tag_name)
+ tag_color.set_property('foreground', color_string)
+ begin = '<span style="color: %s;">' % color_string
+ self.begin_tags[tag_name] = begin
self.end_tags[tag_name] = '</span>'
self.color_tags.append(tag_name)
@@ -276,8 +281,8 @@ class MessageTextView(Gtk.TextView):
tag_name = 'font' + font
if not tag_name in self.fonts_tags:
- tagFont = _buffer.create_tag(tag_name)
- tagFont.set_property('font', family + ' ' + str(size))
+ tag_font = _buffer.create_tag(tag_name)
+ tag_font.set_property('font', family + ' ' + str(size))
self.begin_tags[tag_name] = \
'<span style="font-family: ' + family + '; ' + \
'font-size: ' + str(size) + 'px">'
@@ -335,7 +340,8 @@ class MessageTextView(Gtk.TextView):
for tag in iter_.get_tags():
tag_name = tag.get_property('name')
- if tag_name not in self.begin_tags or tag_name not in self.end_tags:
+ if (tag_name not in self.begin_tags or
+ tag_name not in self.end_tags):
continue
if tag_name not in new_tags:
old_tags.append(tag_name)
@@ -355,7 +361,8 @@ class MessageTextView(Gtk.TextView):
for tag in old_tags:
text += self.begin_tags[tag]
- text += xhtml_special(_buffer.get_text(old, _buffer.get_end_iter(), True))
+ buffer_text = _buffer.get_text(old, _buffer.get_end_iter(), True)
+ text += xhtml_special(buffer_text)
for tag in iter_.get_toggled_tags(False):
tag_name = tag.get_property('name')
if tag_name not in self.end_tags:
@@ -363,7 +370,8 @@ class MessageTextView(Gtk.TextView):
text += self.end_tags[tag_name]
if modified:
- return build_xhtml_body('<p>%s</p>' % self.make_clickable_urls(text))
+ wrapped_text = '<p>%s</p>' % self.make_clickable_urls(text)
+ return build_xhtml_body(wrapped_text)
return None
def replace_emojis(self):
@@ -413,7 +421,7 @@ class MessageTextView(Gtk.TextView):
self.add_child_at_anchor(image, anchor)
buffer_.insert_at_cursor(' ')
- def clear(self, widget=None):
+ def clear(self, _widget=None):
"""
Clear text in the textview
"""
@@ -427,7 +435,7 @@ class MessageTextView(Gtk.TextView):
del self.undo_list[0]
self.undo_pressed = False
- def undo(self, widget=None):
+ def undo(self, _widget=None):
"""
Undo text in the textview
"""
@@ -435,10 +443,3 @@ class MessageTextView(Gtk.TextView):
if self.undo_list:
_buffer.set_text(self.undo_list.pop())
self.undo_pressed = True
-
- def get_sensitive(self):
- # get sensitive is not in GTK < 2.18
- try:
- return super(MessageTextView, self).get_sensitive()
- except AttributeError:
- return self.get_property('sensitive')
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/f95c1f0240325c503d63b1c482f252dfe…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/f95c1f0240325c503d63b1c482f252dfe…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
dfa65e9e by Philipp Hörist at 2019-11-10T19:36:26Z
Fix open-link action
param is a string array
- - - - -
85a59711 by Philipp Hörist at 2019-11-10T19:38:20Z
Presence: Correctly detect presences from contacts not in the roster
- - - - -
2 changed files:
- gajim/app_actions.py
- gajim/common/modules/presence.py
Changes:
=====================================
gajim/app_actions.py
=====================================
@@ -356,7 +356,7 @@ def open_mail(_action, param):
def open_link(_action, param):
- account, uri = param.get_string()
+ account, uri = param.get_strv()
helpers.open_uri(uri, account=account)
=====================================
gajim/common/modules/presence.py
=====================================
@@ -63,7 +63,13 @@ class Presence(BaseModule):
def _presence_received(self, _con, stanza, properties):
if properties.from_muc:
- # Already handled in MUC module
+ # MUC occupant presences are already handled in MUC module
+ return
+
+ muc = self._con.get_module('MUC').get_manager().get(properties.jid)
+ if muc is not None:
+ # Presence from the MUC itself, used for MUC avatar
+ # handled in VCardAvatars module
return
self._log.info('Received from %s', properties.jid)
@@ -86,9 +92,9 @@ class Presence(BaseModule):
show=properties.show.value))
return
- contacts = app.contacts.get_jid_list(self._account)
- if (properties.jid.getBare() not in contacts and
- not properties.is_self_bare):
+ jid = properties.jid.getBare()
+ roster_item = self._con.get_module('Roster').get_item(jid)
+ if not properties.is_self_bare and roster_item is None:
# Handle only presence from roster contacts
self._log.warning('Unknown presence received')
self._log.warning(stanza)
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/8f299caa387aa6d6420e7b75cd99cccaf…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/8f299caa387aa6d6420e7b75cd99cccaf…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
0639bc03 by Philipp Hörist at 2019-11-09T15:04:23Z
ChatControl: Don't handle MAM groupchat messages
Fixes #9488
- - - - -
1 changed file:
- gajim/chat_control.py
Changes:
=====================================
gajim/chat_control.py
=====================================
@@ -790,6 +790,9 @@ class ChatControl(ChatControlBase):
if obj.conn.name != self.account:
return
+ if obj.properties.type.is_groupchat:
+ return
+
if obj.properties.is_muc_pm:
if not obj.with_ == self.contact.get_full_jid():
return
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/0639bc034fcd1a557fff0bd77774c86650…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/0639bc034fcd1a557fff0bd77774c86650…
You're receiving this email because of your account on dev.gajim.org.