Philipp Hörist pushed to branch master at gajim / gajim
Commits:
840dc749 by lovetox at 2020-07-29T16:07:36+02:00
Remove unused code
- - - - -
1 changed file:
- gajim/common/optparser.py
Changes:
=====================================
gajim/common/optparser.py
=====================================
@@ -150,26 +150,6 @@ class OptionsParser:
app.config.set('version', new_version)
- @staticmethod
- def update_ft_proxies(to_remove=None, to_add=None):
- if to_remove is None:
- to_remove = []
- if to_add is None:
- to_add = []
- for account in app.config.get_per('accounts'):
- proxies_str = app.config.get_per('accounts', account,
- 'file_transfer_proxies')
- proxies = [p.strip() for p in proxies_str.split(',')]
- for wrong_proxy in to_remove:
- if wrong_proxy in proxies:
- proxies.remove(wrong_proxy)
- for new_proxy in to_add:
- if new_proxy not in proxies:
- proxies.append(new_proxy)
- proxies_str = ', '.join(proxies)
- app.config.set_per('accounts', account, 'file_transfer_proxies',
- proxies_str)
-
def update_config_to_01641(self):
for account in self.old_values['accounts'].keys():
connection_types = self.old_values['accounts'][account][
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/840dc749dd24f908a60826b5a9db6080…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/840dc749dd24f908a60826b5a9db6080…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
3e5da209 by lovetox at 2020-07-29T13:31:40+02:00
Don’t create zeroconf default config
- - - - -
1 changed file:
- gajim/gui_interface.py
Changes:
=====================================
gajim/gui_interface.py
=====================================
@@ -2047,7 +2047,7 @@ class Interface:
self.create_core_handlers_list()
self.register_core_handlers()
- self.create_zeroconf_default_config()
+ # self.create_zeroconf_default_config()
# if app.config.get_per('accounts', app.ZEROCONF_ACC_NAME, 'active') \
# and app.is_installed('ZEROCONF'):
# app.connections[app.ZEROCONF_ACC_NAME] = \
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/3e5da209c27f23bd6e1299f6e00453c7…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/3e5da209c27f23bd6e1299f6e00453c7…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
a287b218 by lovetox at 2020-07-29T13:20:53+02:00
Move notify_for_muc() into helpers module
- - - - -
9 changed files:
- gajim/chat_control_base.py
- gajim/common/config.py
- gajim/common/connection_handlers_events.py
- gajim/common/helpers.py
- gajim/groupchat_control.py
- gajim/gtk/util.py
- gajim/message_window.py
- gajim/remote_control.py
- gajim/roster_window.py
Changes:
=====================================
gajim/chat_control_base.py
=====================================
@@ -1138,7 +1138,7 @@ class ChatControlBase(ChatCommandProcessor, CommandTools, EventHelper):
if kind == 'incoming':
if (not self._type.is_groupchat or
- app.config.notify_for_muc(jid) or
+ helpers.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
=====================================
@@ -628,11 +628,6 @@ class Config:
return obj[subname][Option.RESTART]
return False
- 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 get_options(self, optname, return_type=str):
options = self.get(optname).split(',')
options = [return_type(option.strip()) for option in options]
=====================================
gajim/common/connection_handlers_events.py
=====================================
@@ -305,7 +305,7 @@ class NotificationEvent(nec.NetworkIncomingEvent):
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
+ notify_for_muc = (helpers.notify_for_muc(self.jid) or
sound == 'highlight')
if not notify_for_muc:
self.do_popup = False
=====================================
gajim/common/helpers.py
=====================================
@@ -1570,3 +1570,9 @@ def should_log(account, jid):
no_log_for = no_log_for.split()
return (account not in no_log_for) and (jid not in no_log_for)
+
+
+def notify_for_muc(room):
+ all_ = app.config.get('notify_on_all_muc_messages')
+ room = app.config.get_per('rooms', room, 'notify_on_all_messages')
+ return all_ or room
=====================================
gajim/groupchat_control.py
=====================================
@@ -962,7 +962,7 @@ class GroupchatControl(ChatControlBase):
def get_nb_unread(self):
type_events = ['printed_marked_gc_msg']
- if app.config.notify_for_muc(self.room_jid):
+ if helpers.notify_for_muc(self.room_jid):
type_events.append('printed_gc_msg')
nb = len(app.events.get_events(self.account,
self.room_jid,
@@ -984,7 +984,7 @@ class GroupchatControl(ChatControlBase):
"""
highlight, sound = None, None
- notify = app.config.notify_for_muc(self.room_jid)
+ notify = helpers.notify_for_muc(self.room_jid)
message_sound_enabled = app.config.get_per('soundevents',
'muc_message_received',
'enabled')
=====================================
gajim/gtk/util.py
=====================================
@@ -48,6 +48,7 @@ from gajim.common import configpaths
from gajim.common import i18n
from gajim.common.i18n import _
from gajim.common.helpers import URL_REGEX
+from gajim.common.helpers import notify_for_muc
from gajim.common.const import MOODS
from gajim.common.const import ACTIVITIES
from gajim.common.const import LOCATION_DATA
@@ -500,7 +501,7 @@ def get_show_in_systray(type_, jid):
"""
Return True if this event must be shown in systray, else False
"""
- notify = app.config.notify_for_muc(jid)
+ notify = 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
=====================================
gajim/message_window.py
=====================================
@@ -36,6 +36,7 @@ from gajim.common import app
from gajim.common import ged
from gajim.common.i18n import Q_
from gajim.common.i18n import _
+from gajim.common.helpers import notify_for_muc
from gajim.common.nec import EventHelper
from gajim import gtkgui_helpers
@@ -491,7 +492,7 @@ class MessageWindow(EventHelper):
unread = 0
for ctrl in self.controls():
if (ctrl.is_groupchat and
- not app.config.notify_for_muc(ctrl.room_jid) and
+ not notify_for_muc(ctrl.room_jid) and
not ctrl.attention_flag):
# count only pm messages
unread += ctrl.get_nb_unread_pm()
@@ -509,7 +510,7 @@ class MessageWindow(EventHelper):
if control.is_groupchat:
name = control.contact.get_shown_name()
urgent = (control.attention_flag or
- app.config.notify_for_muc(control.room_jid))
+ notify_for_muc(control.room_jid))
else:
name = control.contact.get_shown_name()
if control.resource:
=====================================
gajim/remote_control.py
=====================================
@@ -884,7 +884,7 @@ class GajimRemote(Server):
def get_unread_msgs_number(self):
unread = app.events.get_nb_events()
for event in app.events.get_all_events(['printed_gc_msg']):
- if not app.config.notify_for_muc(event.jid):
+ if not helpers.notify_for_muc(event.jid):
unread -= 1
return str(unread)
=====================================
gajim/roster_window.py
=====================================
@@ -2368,7 +2368,7 @@ class RosterWindow:
unread = app.events.get_nb_events()
for event in app.events.get_all_events(['printed_gc_msg']):
- if not app.config.notify_for_muc(event.jid):
+ if not helpers.notify_for_muc(event.jid):
unread -= 1
# check if we have recent messages
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/a287b218a58d8715bb3167c18af7572a…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/a287b218a58d8715bb3167c18af7572a…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
cd7c43de by lovetox at 2020-07-29T13:11:55+02:00
Move should_log() into helpers module
- - - - -
6 changed files:
- gajim/common/config.py
- gajim/common/helpers.py
- gajim/common/modules/message.py
- gajim/common/modules/muc.py
- gajim/common/modules/presence.py
- gajim/session.py
Changes:
=====================================
gajim/common/config.py
=====================================
@@ -628,19 +628,6 @@ class Config:
return obj[subname][Option.RESTART]
return False
- def should_log(self, account, jid):
- """
- Should conversations between a local account and a remote jid be logged?
- """
- no_log_for = self.get_per('accounts', account, 'no_log_for')
-
- if not no_log_for:
- no_log_for = ''
-
- no_log_for = no_log_for.split()
-
- 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')
=====================================
gajim/common/helpers.py
=====================================
@@ -1556,3 +1556,17 @@ def get_idle_status_message(state, status_message):
'time': app.config.get(f'auto{state}time')
}
return message
+
+
+def should_log(account, jid):
+ """
+ Should conversations between a local account and a remote jid be logged?
+ """
+ no_log_for = app.config.get_per('accounts', account, 'no_log_for')
+
+ if not no_log_for:
+ no_log_for = ''
+
+ no_log_for = no_log_for.split()
+
+ return (account not in no_log_for) and (jid not in no_log_for)
=====================================
gajim/common/modules/message.py
=====================================
@@ -24,6 +24,7 @@ from nbxmpp.util import generate_id
from gajim.common import app
from gajim.common.nec import NetworkEvent
from gajim.common.helpers import AdditionalDataDict
+from gajim.common.helpers import should_log
from gajim.common.const import KindConstant
from gajim.common.modules.base import BaseModule
from gajim.common.modules.util import get_eme_message
@@ -236,7 +237,7 @@ class Message(BaseModule):
def _log_muc_message(self, event):
self._check_for_mam_compliance(event.room_jid, event.stanza_id)
- if (app.config.should_log(self._account, event.jid) and
+ if (should_log(self._account, event.jid) and
event.msgtxt and event.properties.muc_nickname):
# if not event.nick, it means message comes from room itself
# usually it hold description and can be send at each connection
@@ -355,7 +356,7 @@ class Message(BaseModule):
if not message.is_loggable:
return
- if not app.config.should_log(self._account, message.jid):
+ if not should_log(self._account, message.jid):
return
if message.message is None:
=====================================
gajim/common/modules/muc.py
=====================================
@@ -540,7 +540,7 @@ class MUC(BaseModule):
return
if (not app.config.get('log_contact_status_changes') or
- not app.config.should_log(self._account, properties.jid)):
+ not helpers.should_log(self._account, properties.jid)):
return
additional_data = AdditionalDataDict()
=====================================
gajim/common/modules/presence.py
=====================================
@@ -25,6 +25,7 @@ from gajim.common import app
from gajim.common import idle
from gajim.common.i18n import _
from gajim.common.nec import NetworkEvent
+from gajim.common.helpers import should_log
from gajim.common.const import KindConstant
from gajim.common.const import ShowConstant
from gajim.common.modules.base import BaseModule
@@ -228,7 +229,7 @@ class Presence(BaseModule):
def _log_presence(self, properties):
if not app.config.get('log_contact_status_changes'):
return
- if not app.config.should_log(self._account, properties.jid.getBare()):
+ if not should_log(self._account, properties.jid.getBare()):
return
show = ShowConstant[properties.show.name]
=====================================
gajim/session.py
=====================================
@@ -66,8 +66,7 @@ class ChatControlSession:
)
def is_loggable(self):
- return app.config.should_log(self.conn.name,
- self.jid.getStripped())
+ return helpers.should_log(self.conn.name, self.jid.getStripped())
def get_to(self):
bare_jid = self.jid.getBare()
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/cd7c43dedb8cea2dbf4770b31455b6ca…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/cd7c43dedb8cea2dbf4770b31455b6ca…
You're receiving this email because of your account on dev.gajim.org.