Philipp Hörist pushed to branch master at gajim / gajim
Commits:
20d5ea90 by Philipp Hörist at 2017-11-03T20:36:53+01:00
Store oob data into DB
Right now oob data is merged into the message text and stored into the DB.
If we load this message from the DB we cannot know anymore if and which
parts of the text was oob data.
Use the additional_data api to store oob data into the DB instead of
altering the original message text.
This lets us decide later on if and which data we want to display, even
on history replays. Also plugins can use the data.
- - - - -
2 changed files:
- gajim/common/connection_handlers_events.py
- gajim/conversation_textview.py
Changes:
=====================================
gajim/common/connection_handlers_events.py
=====================================
--- a/gajim/common/connection_handlers_events.py
+++ b/gajim/common/connection_handlers_events.py
@@ -1399,8 +1399,7 @@ class DecryptedMessageReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
def generate(self):
self.stanza = self.msg_obj.stanza
- if not hasattr(self, 'additional_data'):
- self.additional_data = self.msg_obj.additional_data
+ self.additional_data = self.msg_obj.additional_data
self.id_ = self.msg_obj.id_
self.jid = self.msg_obj.jid
self.fjid = self.msg_obj.fjid
@@ -1453,18 +1452,13 @@ class DecryptedMessageReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
self.get_chatstate()
oob_node = self.stanza.getTag('x', namespace=nbxmpp.NS_X_OOB)
- self.oob_url = None
- self.oob_desc = None
- if oob_node:
+ if oob_node is not None:
self.oob_url = oob_node.getTagData('url')
+ if self.oob_url is not None:
+ self.additional_data['gajim'] = {'oob_url': self.oob_url}
self.oob_desc = oob_node.getTagData('desc')
- if self.oob_url:
- self.msgtxt += '\n'
- if self.oob_desc:
- self.msgtxt += self.oob_desc
- else:
- self.msgtxt += _('URL:')
- self.msgtxt += ' ' + self.oob_url
+ if self.oob_desc is not None:
+ self.additional_data['gajim'] = {'oob_desc': self.oob_desc}
replace = self.stanza.getTag('replace', namespace=nbxmpp.NS_CORRECT)
if replace:
@@ -1506,7 +1500,10 @@ class GcMessageReceivedEvent(nec.NetworkIncomingEvent):
def generate(self):
self.stanza = self.msg_obj.stanza
- self.additional_data = self.msg_obj.additional_data
+ if not hasattr(self.msg_obj, 'additional_data'):
+ self.additional_data = {}
+ else:
+ self.additional_data = self.msg_obj.additional_data
self.id_ = self.msg_obj.stanza.getID()
self.fjid = self.msg_obj.fjid
self.msgtxt = self.msg_obj.msgtxt
=====================================
gajim/conversation_textview.py
=====================================
--- a/gajim/conversation_textview.py
+++ b/gajim/conversation_textview.py
@@ -844,6 +844,19 @@ class ConversationTextview(GObject.GObject):
# We impose an arbitrary limit of 100 specials per message.
specials_limit = 100
+ # add oob text to the end
+ try:
+ gajim_data = additional_data['gajim']
+ oob_url = gajim_data['oob_url']
+ print(oob_url)
+ except KeyError:
+ pass
+ else:
+ oob_desc = additional_data['gajim'].get('oob_desc', None)
+ if oob_desc is None:
+ oob_desc = _('URL:')
+ otext += '\n{} {}'.format(oob_desc, oob_url)
+
# basic: links + mail + formatting is always checked (we like that)
if app.config.get('emoticons_theme') and graphics:
# search for emoticons & urls
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/20d5ea90e7718e6931fd271715e8b9e2dc…
---
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/20d5ea90e7718e6931fd271715e8b9e2dc…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
0c8d88d3 by Philipp Hörist at 2017-11-02T16:00:18+01:00
Ensure that jid_id is created on new accounts
- - - - -
1 changed file:
- gajim/common/logger.py
Changes:
=====================================
gajim/common/logger.py
=====================================
--- a/gajim/common/logger.py
+++ b/gajim/common/logger.py
@@ -916,7 +916,9 @@ class Logger:
app.config.set_per('accounts', account_name, 'roster_version', '')
account_jid = app.get_jid_from_account(account_name)
- account_jid_id = self.get_jid_id(account_jid)
+ # Execute get_jid_id() because this ensures on new accounts that the
+ # jid_id will be created
+ self.get_jid_id(account_jid, type_=JIDConstant.NORMAL_TYPE)
# Delete old roster
self.remove_roster(account_jid)
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/0c8d88d372249ce497eadab49285e174b5…
---
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/0c8d88d372249ce497eadab49285e174b5…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
ecd5c652 by Philipp Hörist at 2017-10-31T18:13:31+01:00
Get drag and drop data correctly
Fixes #8773
- - - - -
1 changed file:
- gajim/chat_control.py
Changes:
=====================================
gajim/chat_control.py
=====================================
--- a/gajim/chat_control.py
+++ b/gajim/chat_control.py
@@ -1268,8 +1268,9 @@ class ChatControl(ChatControlBase):
if target_type == self.TARGET_TYPE_URI_LIST:
if not c.resource: # If no resource is known, we can't send a file
return
- uri = selection.get_data().strip()
- uri_splitted = uri.split() # we may have more than one file dropped
+
+ # we may have more than one file dropped
+ uri_splitted = selection.get_uris()
for uri in uri_splitted:
path = helpers.get_file_path_from_dnd_dropped_uri(uri)
if os.path.isfile(path): # is it file?
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/ecd5c652a24c156460f782d15362f9a3e2…
---
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/ecd5c652a24c156460f782d15362f9a3e2…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
417464d9 by Philipp Hörist at 2017-10-31T17:29:54+01:00
Remove advanced commandline handling
Its enough to connect to the handle-local-options signal for what we
currently want to do.
- - - - -
cb3d4f46 by Philipp Hörist at 2017-10-31T17:33:02+01:00
Update nbxmpp dependency to 0.6.0
- - - - -
a7e53eb0 by Philipp Hörist at 2017-10-31T17:33:32+01:00
Catch Application signals instead of overwriting
- - - - -
1b9c5066 by Philipp Hörist at 2017-10-31T17:33:32+01:00
Add Option to hide Gajim on pressing close
This also adds that Gajim gets present if Gajim is launched a second time
- - - - -
4 changed files:
- gajim/common/config.py
- gajim/gajim.py
- gajim/roster_window.py
- setup.py
Changes:
=====================================
gajim/common/config.py
=====================================
--- a/gajim/common/config.py
+++ b/gajim/common/config.py
@@ -237,6 +237,7 @@ class Config:
'notification_position_y': [opt_int, -1],
'muc_highlight_words': [opt_str, '', _('A semicolon-separated list of words that will be highlighted in group chats.')],
'quit_on_roster_x_button': [opt_bool, False, _('If True, quits Gajim when X button of Window Manager is clicked. This setting is taken into account only if notification icon is used.')],
+ 'hide_on_roster_x_button': [opt_bool, False, _('If True, Gajim hides the Roster window on pressing the X button instead of minimizing into the Dock.')],
'show_unread_tab_icon': [opt_bool, False, _('If True, Gajim will display an icon on each tab containing unread messages. Depending on the theme, this icon may be animated.')],
'show_status_msgs_in_roster': [opt_bool, True, _('If True, Gajim will display the status message, if not empty, for every contact under the contact name in roster window.'), True],
'show_avatars_in_roster': [opt_bool, True, '', True],
=====================================
gajim/gajim.py
=====================================
--- a/gajim/gajim.py
+++ b/gajim/gajim.py
@@ -53,15 +53,14 @@ from gajim.common import i18n
from gajim.common import logging_helpers
from gajim.common import crypto
-MIN_NBXMPP_VER = "0.5.6"
+MIN_NBXMPP_VER = "0.6.0"
class GajimApplication(Gtk.Application):
'''Main class handling activation and command line.'''
def __init__(self):
- Gtk.Application.__init__(self, application_id='org.gajim.Gajim',
- flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE)
+ Gtk.Application.__init__(self, application_id='org.gajim.Gajim')
self.add_main_option('version', ord('V'), GLib.OptionFlags.NONE,
GLib.OptionArg.NONE,
@@ -94,6 +93,10 @@ class GajimApplication(Gtk.Application):
GLib.OptionArg.STRING_ARRAY,
"")
+ self.connect('handle-local-options', self._handle_local_options)
+ self.connect('startup', self._startup)
+ self.connect('activate', self._activate)
+
self.profile = ''
self.config_path = None
self.profile_separation = False
@@ -103,9 +106,7 @@ class GajimApplication(Gtk.Application):
if GLib.get_application_name() != 'Gajim':
GLib.set_application_name('Gajim')
- def do_startup(self):
- Gtk.Application.do_startup(self)
-
+ def _startup(self, application):
from gajim import gtkexcepthook
gtkexcepthook.init()
@@ -222,8 +223,10 @@ class GajimApplication(Gtk.Application):
menubar.prepend_submenu('Gajim', appmenu)
self.set_menubar(menubar)
- def do_activate(self):
- Gtk.Application.do_activate(self)
+ def _activate(self, application):
+ if self.interface is not None:
+ self.interface.roster.window.present()
+ return
from gajim.gui_interface import Interface
from gajim import gtkgui_helpers
self.interface = Interface()
@@ -243,7 +246,8 @@ class GajimApplication(Gtk.Application):
from gajim.common import app
app.logger.commit()
- def do_handle_local_options(self, options: GLib.VariantDict) -> int:
+ def _handle_local_options(self, application,
+ options: GLib.VariantDict) -> int:
logging_helpers.init()
@@ -277,12 +281,6 @@ class GajimApplication(Gtk.Application):
return 0
return -1
- def do_command_line(self, command_line: Gio.ApplicationCommandLine) -> int:
- Gtk.Application.do_command_line(self, command_line)
- if not command_line.get_is_remote():
- self.activate()
- return 0
-
def show_warnings(self):
import traceback
import warnings
=====================================
gajim/roster_window.py
=====================================
--- a/gajim/roster_window.py
+++ b/gajim/roster_window.py
@@ -2406,7 +2406,10 @@ class RosterWindow:
x, y = self.window.get_position()
app.config.set('roster_x-position', x)
app.config.set('roster_y-position', y)
- self.window.iconify()
+ if app.config.get('hide_on_roster_x_button'):
+ self.window.hide()
+ else:
+ self.window.iconify()
elif app.config.get('quit_on_roster_x_button'):
self.on_quit_request()
else:
@@ -3755,7 +3758,10 @@ class RosterWindow:
'quit_on_roster_x_button') and ((app.interface.systray_enabled and\
app.config.get('trayicon') == 'always') or app.config.get(
'allow_hide_roster')):
- self.window.iconify()
+ if app.config.get('hide_on_roster_x_button'):
+ self.window.hide()
+ else:
+ self.window.iconify()
elif event.get_state() & Gdk.ModifierType.CONTROL_MASK and event.keyval == \
Gdk.KEY_i:
treeselection = self.tree.get_selection()
=====================================
setup.py
=====================================
--- a/setup.py
+++ b/setup.py
@@ -269,7 +269,7 @@ setup(
data_files=data_files,
install_requires=[
'dbus-python;sys_platform=="linux"',
- 'nbxmpp',
+ 'nbxmpp>=0.6.0',
'pyOpenSSL>=0.12',
'pyasn1',
],
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/0b21c12c416aa79b64a9654fc90ca7150…
---
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/0b21c12c416aa79b64a9654fc90ca7150…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
7ee06365 by Philipp Hörist at 2017-10-30T21:11:27+01:00
Pass iter to print_special_text extension point
- - - - -
1 changed file:
- gajim/conversation_textview.py
Changes:
=====================================
gajim/conversation_textview.py
=====================================
--- a/gajim/conversation_textview.py
+++ b/gajim/conversation_textview.py
@@ -892,7 +892,7 @@ class ConversationTextview(GObject.GObject):
# PluginSystem: adding GUI extension point for ConversationTextview
self.plugin_modified = False
app.plugin_manager.extension_point('print_special_text', self,
- special_text, other_tags, graphics, additional_data)
+ special_text, other_tags, graphics, additional_data, iter_)
if self.plugin_modified:
return
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/7ee0636574f346215ea0c9f344366419fe…
---
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/7ee0636574f346215ea0c9f344366419fe…
You're receiving this email because of your account on dev.gajim.org.