Philipp Hörist pushed to branch master at gajim / gajim
Commits:
c1dd6a04 by Daniel Brötzmann at 2019-05-22T19:48:40Z
StartChatDialog: Fix filter error and add dim-label for jid
- - - - -
1 changed file:
- gajim/gtk/start_chat.py
Changes:
=====================================
gajim/gtk/start_chat.py
=====================================
@@ -242,6 +242,9 @@ class StartChatDialog(Gtk.ApplicationWindow):
def _select_new_match(self, entry, direction):
selected_row = self.listbox.get_selected_row()
+ if selected_row is None:
+ return
+
index = selected_row.get_index()
if direction == 'next':
@@ -440,6 +443,7 @@ class ContactRow(Gtk.Grid):
self.jid_label.set_xalign(0)
self.jid_label.set_width_chars(25)
self.jid_label.set_halign(Gtk.Align.START)
+ self.jid_label.get_style_context().add_class('dim-label')
middle_box.add(self.jid_label)
self.add(middle_box)
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/c1dd6a045d1417fd3d9fe581eedf7a2246…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/c1dd6a045d1417fd3d9fe581eedf7a2246…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
519d8644 by Philipp Hörist at 2019-05-20T19:33:42Z
Refactor conditions to determine connected state
GUI code must not be aware of what integers map to connection states
- - - - -
19 changed files:
- gajim/chat_control_base.py
- gajim/command_system/implementation/standard.py
- gajim/common/app.py
- gajim/common/connection.py
- gajim/common/jingle_session.py
- gajim/common/modules/bytestream.py
- gajim/common/modules/entity_time.py
- gajim/common/modules/presence.py
- gajim/common/zeroconf/connection_zeroconf.py
- gajim/dialogs.py
- gajim/gtk/discovery.py
- gajim/gtk/join_groupchat.py
- gajim/gtk/profile.py
- gajim/gtk/settings.py
- gajim/gtk/single_message.py
- gajim/gtk/xml_console.py
- gajim/gui_interface.py
- gajim/remote_control.py
- gajim/roster_window.py
Changes:
=====================================
gajim/chat_control_base.py
=====================================
@@ -739,7 +739,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
is_ctrl_enter = bool(event_state & Gdk.ModifierType.CONTROL_MASK)
send_message = is_ctrl_enter == app.config.get('send_on_ctrl_enter')
- if send_message and app.connections[self.account].connected < 2:
+ if send_message and not app.account_is_connected(self.account):
# we are not connected
app.interface.raise_dialog('not-connected-while-sending')
elif send_message:
=====================================
gajim/command_system/implementation/standard.py
=====================================
@@ -128,7 +128,7 @@ class StandardCommonCommands(CommandContainer):
if not app.config.get_per('accounts', connection.name,
'sync_with_global_status'):
continue
- if connection.connected < 2:
+ if not connection.is_connected:
continue
connection.change_status(status, message)
@@ -142,7 +142,7 @@ class StandardCommonCommands(CommandContainer):
if not app.config.get_per('accounts', connection.name,
'sync_with_global_status'):
continue
- if connection.connected < 2:
+ if not connection.is_connected:
continue
connection.change_status('away', message)
@@ -156,7 +156,7 @@ class StandardCommonCommands(CommandContainer):
if not app.config.get_per('accounts', connection.name,
'sync_with_global_status'):
continue
- if connection.connected < 2:
+ if not connection.is_connected:
continue
connection.change_status('online', message)
=====================================
gajim/common/app.py
=====================================
@@ -453,7 +453,7 @@ def account_is_connected(account):
if account not in connections:
return False
# 0 is offline, 1 is connecting
- return connections[account].connected > 1
+ return connections[account].is_connected
def is_invisible(account):
return SHOW_LIST[connections[account].connected] == 'invisible'
=====================================
gajim/common/connection.py
=====================================
@@ -127,6 +127,10 @@ class CommonConnection:
self.get_config_values_or_default()
+ @property
+ def is_connected(self):
+ return self.connected > 1
+
def _register_new_handlers(self, con):
for handler in modules.get_handlers(self):
if len(handler) == 5:
@@ -176,7 +180,7 @@ class CommonConnection:
def _prepare_message(self, obj):
- if not self.connection or self.connected < 2:
+ if not self.connection or not self.is_connected:
return 1
if isinstance(obj.jid, list):
@@ -511,7 +515,7 @@ class Connection(CommonConnection, ConnectionHandlers):
def reconnect(self):
# Do not try to reco while we are already trying
self.time_to_reconnect = None
- if self.connected < 2: # connection failed
+ if not self.is_connected: # connection failed
log.info('Reconnect')
self.connected = 1
app.nec.push_incoming_event(OurShowEvent(None, conn=self,
@@ -1347,7 +1351,7 @@ class Connection(CommonConnection, ConnectionHandlers):
return
# If we are already connected, and privacy rules are supported, send
# offline presence first as it's required by XEP-0126
- if self.connected > 1 and self.get_module('PrivacyLists').supported:
+ if self.is_connected and self.get_module('PrivacyLists').supported:
self.get_module('Bytestream').remove_all_transfers()
self.get_module('Presence').send_presence(
typ='unavailable',
@@ -1780,7 +1784,7 @@ class Connection(CommonConnection, ConnectionHandlers):
# Account may have been disabled
return
if self.time_to_reconnect:
- if self.connected < 2:
+ if not self.is_connected:
self.reconnect()
else:
self.time_to_reconnect = None
=====================================
gajim/common/jingle_session.py
=====================================
@@ -766,7 +766,7 @@ class JingleSession:
def _session_terminate(self, reason=None):
stanza, jingle = self.__make_jingle('session-terminate', reason=reason)
self.__broadcast_all(stanza, jingle, None, 'session-terminate-sent')
- if self.connection.connection and self.connection.connected >= 2:
+ if self.connection.connection and self.connection.is_connected:
self.connection.connection.send(stanza)
# TODO: Move to GUI?
reason, text = self.__reason_from_stanza(jingle)
@@ -818,7 +818,7 @@ class JingleSession:
def __content_remove(self, content, reason=None):
assert self.state != JingleStates.ENDED
- if self.connection.connection and self.connection.connected > 1:
+ if self.connection.connection and self.connection.is_connected:
stanza, jingle = self.__make_jingle('content-remove', reason=reason)
self.__append_content(jingle, content)
self.connection.connection.send(stanza)
=====================================
gajim/common/modules/bytestream.py
=====================================
@@ -135,7 +135,7 @@ class Bytestream(BaseModule):
Send iq, confirming that we want to download the file
"""
# user response to ConfirmationDialog may come after we've disconneted
- if not self._con.connection or self._con.connected < 2:
+ if not app.account_is_connected(self._account):
return
# file transfer initiated by a jingle session
@@ -176,7 +176,7 @@ class Bytestream(BaseModule):
invalid stream or 'profile' for invalid profile
"""
# user response to ConfirmationDialog may come after we've disconnected
- if not self._con.connection or self._con.connected < 2:
+ if not app.account_is_connected(self._account):
return
if file_props.sid in self._sessions:
@@ -188,7 +188,7 @@ class Bytestream(BaseModule):
"""
Send reply to the initiator of FT that we made a connection
"""
- if not self._con.connection or self._con.connected < 2:
+ if not app.account_is_connected(self._account):
return
if streamhost is None:
return None
@@ -249,7 +249,7 @@ class Bytestream(BaseModule):
"""
Send iq for the present streamhosts and proxies
"""
- if not self._con.connection or self._con.connected < 2:
+ if not app.account_is_connected(self._account):
return
receiver = file_props.receiver
sender = file_props.sender
@@ -463,7 +463,7 @@ class Bytestream(BaseModule):
Called when there is an error establishing BS connection, or when
connection is rejected
"""
- if not self._con.connection or self._con.connected < 2:
+ if not app.account_is_connected(self._account):
return
file_props = FilesProp.getFileProp(self._account, sid)
if file_props is None:
@@ -491,7 +491,7 @@ class Bytestream(BaseModule):
"""
Called after authentication to proxy server
"""
- if not self._con.connection or self._con.connected < 2:
+ if not app.account_is_connected(self._account):
return
file_props = FilesProp.getFileProp(self._account, proxy['sid'])
iq = nbxmpp.Iq(to=proxy['initiator'], typ='set')
=====================================
gajim/common/modules/entity_time.py
=====================================
@@ -41,7 +41,7 @@ class EntityTime(BaseModule):
if not app.account_is_connected(self._account):
return
# If we are invisible, do not request
- if self._con.connected == app.SHOW_LIST.index('invisible'):
+ if app.is_invisible(self._account):
return
if resource:
=====================================
gajim/common/modules/presence.py
=====================================
@@ -189,7 +189,7 @@ class Presence(BaseModule):
if jid in app.to_be_removed[self._account]:
app.to_be_removed[self._account].remove(jid)
elif event.old_show > 1 and event.new_show == 0 and \
- self._con.connected > 1:
+ self._con.is_connected:
if not jid in app.to_be_removed[self._account]:
app.to_be_removed[self._account].append(jid)
if jid in app.newly_added[self._account]:
=====================================
gajim/common/zeroconf/connection_zeroconf.py
=====================================
@@ -224,7 +224,7 @@ class ConnectionZeroconf(CommonConnection, ConnectionHandlersZeroconf):
app.newly_added[self.name].append(jid)
if jid in app.to_be_removed[self.name]:
app.to_be_removed[self.name].remove(jid)
- elif event.old_show > 1 and event.new_show == 0 and self.connected > 1:
+ elif event.old_show > 1 and event.new_show == 0 and self.is_connected:
if not jid in app.to_be_removed[self.name]:
app.to_be_removed[self.name].append(jid)
if jid in app.newly_added[self.name]:
=====================================
gajim/dialogs.py
=====================================
@@ -783,7 +783,7 @@ class SynchroniseSelectAccountDialog:
return
remote_account = model.get_value(iter_, 0)
- if app.connections[remote_account].connected < 2:
+ if not app.account_is_connected(remote_account):
ErrorDialog(_('This account is not connected to the server'),
_('You cannot synchronize with an account unless it is connected.'))
return
=====================================
gajim/gtk/discovery.py
=====================================
@@ -488,7 +488,7 @@ class ServiceDiscoveryWindow:
self.reloading = False
# Check connection
- if app.connections[account].connected < 2:
+ if not app.account_is_connected(account):
ErrorDialog(_('You are not connected to the server'),
_('Without a connection, you can not browse available services'))
raise RuntimeError('You must be connected to browse services')
=====================================
gajim/gtk/join_groupchat.py
=====================================
@@ -187,8 +187,7 @@ class JoinGroupchatWindow(Gtk.ApplicationWindow):
account = self.account_combo.get_active_id()
nickname = self.nick_entry.get_text()
- invisible_show = app.SHOW_LIST.index('invisible')
- if app.connections[account].connected == invisible_show:
+ if app.is_invisible(account):
app.interface.raise_dialog('join-while-invisible')
return
=====================================
gajim/gtk/profile.py
=====================================
@@ -316,7 +316,7 @@ class ProfileWindow(Gtk.ApplicationWindow):
if self.update_progressbar_timeout_id:
# Operation in progress
return
- if app.connections[self.account].connected < 2:
+ if not app.account_is_connected(self.account):
ErrorDialog(
_('You are not connected to the server'),
_('Without a connection, you can not publish your contact '
=====================================
gajim/gtk/settings.py
=====================================
@@ -651,5 +651,5 @@ class ChangePasswordSetting(DialogSetting):
activatable = False
if self.account in app.connections:
con = app.connections[self.account]
- activatable = con.connected >= 2 and con.register_supported
+ activatable = con.is_connected and con.register_supported
self.set_activatable(activatable)
=====================================
gajim/gtk/single_message.py
=====================================
@@ -269,7 +269,7 @@ class SingleMessageWindow(Gtk.ApplicationWindow):
_('Characters typed: %s') % str(characters_no))
def send_single_message(self):
- if app.connections[self.account].connected <= 1:
+ if not app.account_is_connected(self.account):
# if offline or connecting
ErrorDialog(_('Connection not available'),
_('Please make sure you are connected with "%s".') % self.account)
=====================================
gajim/gtk/xml_console.py
=====================================
@@ -148,7 +148,7 @@ class XMLConsoleWindow(Gtk.Window):
self._ui.input_entry.grab_focus()
def on_send(self, *args):
- if app.connections[self.account].connected <= 1:
+ if not app.account_is_connected(self.account):
# if offline or connecting
ErrorDialog(
_('Connection not available'),
=====================================
gajim/gui_interface.py
=====================================
@@ -933,9 +933,8 @@ class Interface:
if obj.conn.get_module('MAM').available:
obj.conn.get_module('MAM').request_archive_on_signin()
- invisible_show = app.SHOW_LIST.index('invisible')
# We cannot join rooms if we are invisible
- if connected == invisible_show:
+ if app.is_invisible(account):
return
# send currently played music
if (pep_supported and sys.platform not in ('win32', 'darwin') and
@@ -1626,8 +1625,7 @@ class Interface:
self.roster.on_groupchat_maximized(None, room_jid, account)
return
- invisible_show = app.SHOW_LIST.index('invisible')
- if app.connections[account].connected == invisible_show:
+ if app.is_invisible(account):
ErrorDialog(
_('You cannot join a group chat while you are invisible'))
return
@@ -2179,7 +2177,7 @@ class Interface:
GLib.timeout_add_seconds(2, connection.reconnect)
else:
for connection in app.connections.values():
- if connection.connected > 1:
+ if connection.is_connected:
log.info('Disconnect %s', connection.name)
connection.disconnect(immediately=True)
=====================================
gajim/remote_control.py
=====================================
@@ -437,7 +437,7 @@ class GajimRemote(Server):
if not account and len(accounts) == 1:
account = accounts[0]
if account:
- if app.connections[account].connected > 1: # account is connected
+ if app.account_is_connected(account): # account is connected
connected_account = account
contact = app.contacts.get_contact_with_highest_priority(
account, jid)
@@ -445,7 +445,7 @@ class GajimRemote(Server):
for account_ in accounts:
contact = app.contacts.get_contact_with_highest_priority(
account, jid)
- if contact and app.connections[account_].connected > 1:
+ if contact and app.account_is_connected(account_):
# account is connected
connected_account = account_
break
@@ -466,14 +466,14 @@ class GajimRemote(Server):
if not account and len(accounts) == 1:
account = accounts[0]
if account:
- if app.connections[account].connected > 1 and \
+ if app.account_is_connected(account) and \
room_jid in app.gc_connected[account] and \
app.gc_connected[account][room_jid]:
# account and groupchat are connected
connected_account = account
else:
for account_ in accounts:
- if app.connections[account_].connected > 1 and \
+ if app.account_is_connected(account_) and \
room_jid in app.gc_connected[account_] and \
app.gc_connected[account_][room_jid]:
# account and groupchat are connected
@@ -590,7 +590,7 @@ class GajimRemote(Server):
connected_account = None
first_connected_acct = None
for acct in accounts:
- if app.connections[acct].connected > 1: # account is online
+ if app.account_is_connected(acct): # account is online
contact = app.contacts.get_first_contact_from_jid(acct, jid)
if app.interface.msg_win_mgr.has_window(jid, acct):
connected_account = acct
@@ -790,8 +790,7 @@ class GajimRemote(Server):
def add_contact(self, jid, account):
if account:
- if account in app.connections and \
- app.connections[account].connected > 1:
+ if app.account_is_connected(account):
# if given account is active, use it
AddNewContactWindow(account=account, jid=jid)
else:
=====================================
gajim/roster_window.py
=====================================
@@ -2063,7 +2063,7 @@ class RosterWindow:
app.config.set_per('accounts', account, 'last_status', status)
app.config.set_per('accounts', account, 'last_status_msg',
helpers.to_one_line(txt))
- if app.connections[account].connected < 2:
+ if not app.account_is_connected(account):
self.set_connecting_state(account)
self.send_status_continue(account, status, txt, auto, to)
@@ -2112,8 +2112,7 @@ class RosterWindow:
else:
if status in ('invisible', 'offline'):
self.delete_pep(app.get_jid_from_account(account), account)
- was_invisible = app.connections[account].connected == \
- app.SHOW_LIST.index('invisible')
+ was_invisible = app.is_invisible(account)
app.connections[account].change_status(status, txt, auto)
for gc_control in app.interface.msg_win_mgr.get_controls(
@@ -2409,7 +2408,7 @@ class RosterWindow:
accounts = list(app.connections.keys())
get_msg = False
for acct in accounts:
- if app.connections[acct].connected:
+ if app.account_is_connected(acct):
get_msg = True
break
@@ -2417,7 +2416,7 @@ class RosterWindow:
self.quit_on_next_offline = 0
accounts_to_disconnect = []
for acct in accounts:
- if app.connections[acct].connected > 1:
+ if app.account_is_connected(acct):
self.quit_on_next_offline += 1
accounts_to_disconnect.append(acct)
@@ -2505,7 +2504,7 @@ class RosterWindow:
GLib.timeout_add_seconds(5, self.remove_newly_added, jid,
account)
elif obj.old_show > 1 and obj.new_show == 0 and \
- obj.conn.connected > 1:
+ obj.conn.is_connected:
GLib.timeout_add_seconds(5, self.remove_to_be_removed,
jid, account)
@@ -2868,7 +2867,7 @@ class RosterWindow:
return
# account is offline, don't allow to rename
- if app.connections[account].connected < 2:
+ if not app.account_is_connected(account):
return
if row_type in ('contact', 'agent'):
# it's jid
@@ -3225,8 +3224,7 @@ class RosterWindow:
elif type_ == 'account':
account = model[path][Column.ACCOUNT]
if account != 'all':
- show = app.connections[account].connected
- if show > 1: # We are connected
+ if app.account_is_connected(account):
self.on_change_status_message_activate(widget, account)
return True
show = helpers.get_global_show()
@@ -4202,7 +4200,7 @@ class RosterWindow:
if account_dest == 'all':
return
# nothing can be done, if destination account is offline
- if app.connections[account_dest].connected < 2:
+ if not app.account_is_connected(account_dest):
return
# A file got dropped on the roster
@@ -4748,7 +4746,7 @@ class RosterWindow:
item = Gtk.MenuItem.new_with_mnemonic(uf_show)
sub_menu.append(item)
con = app.connections[account]
- if show == 'invisible' and con.connected > 1 and \
+ if show == 'invisible' and con.is_connected and \
not con.get_module('PrivacyLists').supported:
item.set_sensitive(False)
else:
@@ -4761,7 +4759,7 @@ class RosterWindow:
sub_menu.append(item)
item.connect('activate', self.on_change_status_message_activate,
account)
- if app.connections[account].connected < 2:
+ if not app.account_is_connected(account):
item.set_sensitive(False)
item = Gtk.SeparatorMenuItem.new()
@@ -4831,7 +4829,7 @@ class RosterWindow:
self.add_bookmarks_list(gc_sub_menu, account)
# make some items insensitive if account is offline
- if app.connections[account].connected < 2:
+ if not app.account_is_connected(account):
for widget in (add_contact_menuitem, service_discovery_menuitem,
join_group_chat_menuitem, execute_command_menuitem,
pep_menuitem):
@@ -4859,7 +4857,7 @@ class RosterWindow:
sub_menu.append(item)
item.connect('activate', self.on_change_status_message_activate,
account)
- if app.connections[account].connected < 2:
+ if not app.account_is_connected(account):
item.set_sensitive(False)
uf_show = helpers.get_uf_show('offline', use_mnemonic=True)
@@ -4969,7 +4967,7 @@ class RosterWindow:
if app.config.get_per('accounts', account, 'is_zeroconf'):
send_group_message_item.set_sensitive(False)
- if app.connections[account].connected < 2:
+ if not app.account_is_connected(account):
send_group_message_item.set_sensitive(False)
invite_menuitem.set_sensitive(False)
@@ -5012,7 +5010,7 @@ class RosterWindow:
group, account)
# unsensitive if account is not connected
- if app.connections[account].connected < 2:
+ if not app.account_is_connected(account):
rename_item.set_sensitive(False)
# General group cannot be changed
@@ -5052,7 +5050,7 @@ class RosterWindow:
for titer in iters:
jid = model[titer][Column.JID]
account = model[titer][Column.ACCOUNT]
- if app.connections[account].connected < 2:
+ if not app.account_is_connected(account):
one_account_offline = True
if not app.connections[account].get_module('PrivacyLists').supported:
privacy_rules_supported = False
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/519d86444a5e0d14a21b7ce38943522f83…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/519d86444a5e0d14a21b7ce38943522f83…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
9dbac0f0 by Philipp Hörist at 2019-05-17T21:38:06Z
Remove custom status per contact feature
- - - - -
f601ca0d by Philipp Hörist at 2019-05-17T23:04:11Z
Add dedicated announce/motd module
- - - - -
11 changed files:
- gajim/app_actions.py
- gajim/common/connection.py
- gajim/common/modules/__init__.py
- + gajim/common/modules/announce.py
- gajim/common/modules/privacylists.py
- gajim/data/gui/contact_context_menu.ui
- gajim/gtk/single_message.py
- gajim/gui_interface.py
- gajim/gui_menu_builder.py
- gajim/roster_window.py
- test/lib/gajim_mocks.py
Changes:
=====================================
gajim/app_actions.py
=====================================
@@ -277,9 +277,7 @@ def on_update_motd(action, param):
def on_delete_motd(action, param):
account = param.get_string()
- server = app.config.get_per('accounts', account, 'hostname')
- server += '/announce/motd/delete'
- app.connections[account].send_motd(server)
+ app.connections[account].get_module('Announce').delete_motd()
# Help Actions
=====================================
gajim/common/connection.py
=====================================
@@ -1566,14 +1566,6 @@ class Connection(CommonConnection, ConnectionHandlers):
app.nec.push_incoming_event(OurShowEvent(None, conn=self,
show=show))
- def send_motd(self, jid, subject='', msg='', xhtml=None):
- if not app.account_is_connected(self.name):
- return
- msg_iq = nbxmpp.Message(to=jid, body=msg, subject=subject,
- xhtml=xhtml)
-
- self.connection.send(msg_iq)
-
def _nec_message_outgoing(self, obj):
if obj.account != self.name:
return
=====================================
gajim/common/modules/__init__.py
=====================================
@@ -73,6 +73,7 @@ MODULES = [
'user_tune',
'vcard_avatars',
'vcard_temp',
+ 'announce',
]
_imported_modules = [] # type: List[tuple]
=====================================
gajim/common/modules/announce.py
=====================================
@@ -0,0 +1,37 @@
+# This file is part of Gajim.
+#
+# Gajim is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published
+# by the Free Software Foundation; version 3 only.
+#
+# Gajim is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
+
+# Server MOTD and Announce
+
+import nbxmpp
+
+from gajim.common.modules.base import BaseModule
+
+
+class Announce(BaseModule):
+ def __init__(self, con):
+ BaseModule.__init__(self, con)
+
+ def delete_motd(self):
+ server = self._con.get_own_jid().getDomain()
+ jid = '%s/announce/motd/delete' % server
+ self.set_announce(jid)
+
+ def set_announce(self, jid, subject=None, body=None):
+ message = nbxmpp.Message(to=jid, body=body, subject=subject)
+ self._nbxmpp().send(message)
+
+
+def get_instance(*args, **kwargs):
+ return Announce(*args, **kwargs), 'Announce'
=====================================
gajim/common/modules/privacylists.py
=====================================
@@ -242,23 +242,6 @@ class PrivacyLists(BaseModule):
def _build_invisible_rule(self):
node = nbxmpp.Node('list', {'name': 'invisible'})
iq = nbxmpp.Iq('set', nbxmpp.NS_PRIVACY, payload=[node])
- if (self._account in app.interface.status_sent_to_groups and
- app.interface.status_sent_to_groups[self._account]):
- for group in app.interface.status_sent_to_groups[self._account]:
- item = node.setTag('item', {'type': 'group',
- 'value': group,
- 'action': 'allow',
- 'order': '1'})
- item.setTag('presence-out')
-
- if (self._account in app.interface.status_sent_to_users and
- app.interface.status_sent_to_users[self._account]):
- for jid in app.interface.status_sent_to_users[self._account]:
- item = node.setTag('item', {'type': 'jid',
- 'value': jid,
- 'action': 'allow',
- 'order': '2'})
- item.setTag('presence-out')
item = node.setTag('item', {'action': 'deny', 'order': '3'})
item.setTag('presence-out')
=====================================
gajim/data/gui/contact_context_menu.ui
=====================================
@@ -51,21 +51,6 @@
<property name="can_focus">False</property>
</object>
</child>
- <child>
- <object class="GtkMenuItem" id="send_custom_status_menuitem">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Send Cus_tom Status</property>
- <property name="use_underline">True</property>
- <child type="submenu">
- <object class="GtkMenu" id="menu5">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- </object>
- </child>
- </object>
- </child>
<child>
<object class="GtkMenuItem" id="execute_command_menuitem">
<property name="visible">True</property>
=====================================
gajim/gtk/single_message.py
=====================================
@@ -308,8 +308,9 @@ class SingleMessageWindow(Gtk.ApplicationWindow):
return True
if '/announce/' in to_whom_jid:
- app.connections[self.account].send_motd(to_whom_jid, subject,
- message)
+ con = app.connections[self.account]
+ con.get_module('Announce').set_announce(
+ to_whom_jid, subject, message)
continue
recipient_list.append(to_whom_jid)
=====================================
gajim/gui_interface.py
=====================================
@@ -311,13 +311,6 @@ class Interface:
account = obj.conn.name
jid = obj.jid
- # unset custom status
- if (obj.old_show == 0 and obj.new_show > 1) or \
- (obj.old_show > 1 and obj.new_show == 0 and obj.conn.connected > 1):
- if account in self.status_sent_to_users and \
- jid in self.status_sent_to_users[account]:
- del self.status_sent_to_users[account][jid]
-
if app.jid_is_transport(jid):
# It must be an agent
@@ -2272,8 +2265,6 @@ class Interface:
# This is the manager and factory of message windows set by the module
self.msg_win_mgr = None
self.minimized_controls = {}
- self.status_sent_to_users = {}
- self.status_sent_to_groups = {}
self.pass_dialog = {}
self.db_error_dialog = None
=====================================
gajim/gui_menu_builder.py
=====================================
@@ -221,7 +221,6 @@ control=None, gc_contact=None, is_anonymous=True):
send_file_menuitem = xml.get_object('send_file_menuitem')
information_menuitem = xml.get_object('information_menuitem')
history_menuitem = xml.get_object('history_menuitem')
- send_custom_status_menuitem = xml.get_object('send_custom_status_menuitem')
send_single_message_menuitem = xml.get_object('send_single_message_menuitem')
invite_menuitem = xml.get_object('invite_menuitem')
block_menuitem = xml.get_object('block_menuitem')
@@ -327,7 +326,7 @@ control=None, gc_contact=None, is_anonymous=True):
# Zeroconf Account
if app.config.get_per('accounts', account, 'is_zeroconf'):
- for item in (send_custom_status_menuitem, send_single_message_menuitem,
+ for item in (send_single_message_menuitem,
invite_menuitem, block_menuitem, unblock_menuitem, ignore_menuitem,
unignore_menuitem, subscription_menuitem,
manage_contact_menuitem, convert_to_gc_menuitem):
@@ -348,22 +347,6 @@ control=None, gc_contact=None, is_anonymous=True):
# normal account
- # send custom status icon
- blocked = False
- if helpers.jid_is_blocked(account, jid):
- blocked = True
- else:
- for group in contact.get_shown_groups():
- if helpers.group_is_blocked(account, group):
- blocked = True
- break
- transport = app.get_transport_name_from_jid(jid, use_config_setting=False)
- if transport and transport != 'jabber':
- # Transport contact, send custom status unavailable
- send_custom_status_menuitem.set_sensitive(False)
- elif blocked:
- send_custom_status_menuitem.set_sensitive(False)
-
if gc_contact:
if not gc_contact.jid:
# it's a pm and we don't know real JID
@@ -387,16 +370,6 @@ control=None, gc_contact=None, is_anonymous=True):
if app.account_is_disconnected(account):
invite_menuitem.set_sensitive(False)
- # One or several resource, we do the same for send_custom_status
- status_menuitems = Gtk.Menu()
- send_custom_status_menuitem.set_submenu(status_menuitems)
- for s in ('online', 'chat', 'away', 'xa', 'dnd', 'offline'):
- # icon MUST be different instance for every item
- status_menuitem = Gtk.MenuItem.new_with_label(helpers.get_uf_show(s))
- status_menuitem.connect('activate', roster.on_send_custom_status,
- [(contact, account)], s)
- status_menuitems.append(status_menuitem)
-
send_single_message_menuitem.connect('activate',
roster.on_send_single_message_menuitem_activate, account, contact)
@@ -447,7 +420,7 @@ control=None, gc_contact=None, is_anonymous=True):
if app.account_is_disconnected(account):
for widget in (send_single_message_menuitem, subscription_menuitem,
add_to_roster_menuitem, remove_from_roster_menuitem,
- execute_command_menuitem, send_custom_status_menuitem):
+ execute_command_menuitem):
widget.set_sensitive(False)
@@ -507,24 +480,6 @@ def get_transport_menu(contact, account):
if helpers.jid_is_blocked(account, jid):
blocked = True
- # Send Custom Status
- send_custom_status_menuitem = Gtk.MenuItem.new_with_mnemonic(
- _('Send Cus_tom Status'))
- if blocked:
- send_custom_status_menuitem.set_sensitive(False)
- else:
- status_menuitems = Gtk.Menu()
- send_custom_status_menuitem.set_submenu(status_menuitems)
- for s in ('online', 'chat', 'away', 'xa', 'dnd', 'offline'):
- status_menuitem = Gtk.MenuItem.new_with_label(helpers.get_uf_show(
- s))
- status_menuitem.connect('activate', roster.on_send_custom_status,
- [(contact, account)], s)
- status_menuitems.append(status_menuitem)
- menu.append(send_custom_status_menuitem)
- if app.account_is_disconnected(account):
- send_custom_status_menuitem.set_sensitive(False)
-
item = Gtk.SeparatorMenuItem.new() # separator
menu.append(item)
=====================================
gajim/roster_window.py
=====================================
@@ -2113,10 +2113,6 @@ class RosterWindow:
app.SHOW_LIST.index('invisible')
app.connections[account].change_status(status, txt, auto)
- if account in app.interface.status_sent_to_users:
- app.interface.status_sent_to_users[account] = {}
- if account in app.interface.status_sent_to_groups:
- app.interface.status_sent_to_groups[account] = {}
for gc_control in app.interface.msg_win_mgr.get_controls(
message_control.TYPE_GC) + \
list(app.interface.minimized_controls[account].values()):
@@ -3362,67 +3358,6 @@ class RosterWindow:
'offline.') % jids
ConfirmationDialog(pritext, sectext, on_response_ok=on_ok2)
- def on_send_custom_status(self, widget, contact_list, show, group=None):
- """
- Send custom status
- """
- # contact_list has only one element except if group != None
- def on_response(message, pep_dict):
- if message is None: # None if user pressed Cancel
- return
- account_list = []
- for (contact, account) in contact_list:
- if account not in account_list:
- account_list.append(account)
- # 1. update status_sent_to_[groups|users] list
- if group:
- for account in account_list:
- if account not in app.interface.status_sent_to_groups:
- app.interface.status_sent_to_groups[account] = {}
- app.interface.status_sent_to_groups[account][group] = show
- else:
- for (contact, account) in contact_list:
- if account not in app.interface.status_sent_to_users:
- app.interface.status_sent_to_users[account] = {}
- app.interface.status_sent_to_users[account][contact.jid] \
- = show
-
- # 2. update privacy lists if main status is invisible
- for account in account_list:
- if app.SHOW_LIST[app.connections[account].connected] == \
- 'invisible':
- con = app.connections[account]
- con.get_module('PrivacyLists').set_invisible_rule()
-
- # 3. send directed presence
- for (contact, account) in contact_list:
- our_jid = app.get_jid_from_account(account)
- jid = contact.jid
- if jid == our_jid:
- jid += '/' + contact.resource
- self.send_status(account, show, message, to=jid)
-
- def send_it(is_checked=None):
- if is_checked is not None: # dialog has been shown
- if is_checked: # user does not want to be asked again
- app.config.set('confirm_custom_status', 'no')
- else:
- app.config.set('confirm_custom_status', 'yes')
- self.get_status_message(show, on_response, show_pep=False,
- always_ask=True)
-
- confirm_custom_status = app.config.get('confirm_custom_status')
- if confirm_custom_status == 'no':
- send_it()
- return
- pritext = _('You are about to send a custom status. Are you sure you '
- 'want to continue?')
- sectext = _('This contact will temporarily see you as %(status)s, '
- 'but only until you change your status. Then they will see '
- 'your global status.') % {'status': show}
- ConfirmationDialogCheck(pritext, sectext,
- _('_Do not ask me again'), on_response_ok=send_it)
-
def on_status_combobox_changed(self, widget):
"""
When we change our status via the combobox
@@ -5025,30 +4960,13 @@ class RosterWindow:
list_online, show_bookmarked=show_bookmarked)
menu.append(invite_menuitem)
- # Send Custom Status
- send_custom_status_menuitem = Gtk.MenuItem.new_with_mnemonic(
- _('Send Cus_tom Status'))
- if helpers.group_is_blocked(account, group):
- send_custom_status_menuitem.set_sensitive(False)
- status_menuitems = Gtk.Menu()
- send_custom_status_menuitem.set_submenu(status_menuitems)
- for s in ('online', 'chat', 'away', 'xa', 'dnd', 'offline'):
- status_menuitem = Gtk.MenuItem.new_with_label(
- helpers.get_uf_show(s))
- status_menuitem.connect('activate', self.on_send_custom_status,
- list_, s, group)
- status_menuitems.append(status_menuitem)
- menu.append(send_custom_status_menuitem)
-
# there is no singlemessage and custom status for zeroconf
if app.config.get_per('accounts', account, 'is_zeroconf'):
- send_custom_status_menuitem.set_sensitive(False)
send_group_message_item.set_sensitive(False)
if app.connections[account].connected < 2:
send_group_message_item.set_sensitive(False)
invite_menuitem.set_sensitive(False)
- send_custom_status_menuitem.set_sensitive(False)
if not group in helpers.special_groups:
item = Gtk.SeparatorMenuItem.new() # separator
=====================================
test/lib/gajim_mocks.py
=====================================
@@ -104,7 +104,6 @@ class MockInterface(Mock):
self.instances = {}
self.minimized_controls = {}
- self.status_sent_to_users = Mock()
class MockLogger(Mock):
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/9f8492ae694f6d3dbb705f9b1d84f1ecc…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/9f8492ae694f6d3dbb705f9b1d84f1ecc…
You're receiving this email because of your account on dev.gajim.org.