summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2012-05-08 13:08:45 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2012-05-08 17:40:18 +0100
commitcb8783c25ac8228ae5248bfa8bc8596fa6968879 (patch)
treecebc50b3a008120d10a1fbeef14270e636999386
parent0deffb0262f2c33b582df25e06c931f0693ded3e (diff)
Remove unused support for a magical auto-away flag set by embedders
Less code, fewer bugs. Also, people should have stopped embedding MC by now, and an earlier patch in this series made it impossible.
-rw-r--r--src/mcd-account.c14
-rw-r--r--src/mcd-master.c79
-rw-r--r--src/mcd-master.h4
-rw-r--r--tests/twisted/Makefile.am1
-rw-r--r--tests/twisted/account-manager/auto-away.py208
-rw-r--r--tests/twisted/mc-debug-server.c52
6 files changed, 0 insertions, 358 deletions
diff --git a/src/mcd-account.c b/src/mcd-account.c
index 9e9574e4..5aedce6d 100644
--- a/src/mcd-account.c
+++ b/src/mcd-account.c
@@ -4393,20 +4393,6 @@ _mcd_account_set_has_been_online (McdAccount *account)
}
}
-void
-_mcd_account_request_temporary_presence (McdAccount *self,
- TpConnectionPresenceType type,
- const gchar *status)
-{
- if (self->priv->connection != NULL)
- {
- _mcd_account_set_changing_presence (self, TRUE);
-
- _mcd_connection_request_presence (self->priv->connection,
- type, status, "");
- }
-}
-
/**
* mcd_account_connection_bind_transport:
* @account: the #McdAccount.
diff --git a/src/mcd-master.c b/src/mcd-master.c
index 5c176d8e..c9c6e2b8 100644
--- a/src/mcd-master.c
+++ b/src/mcd-master.c
@@ -697,82 +697,3 @@ _mcd_master_account_replace_transport (McdMaster *master,
g_hash_table_unref (conditions);
return connected;
}
-
-gboolean
-mcd_master_has_low_memory (McdMaster *master)
-{
- McdMasterPrivate *priv = MCD_MASTER_PRIV (master);
-
- return priv->low_memory;
-}
-
-/* For the moment, this is implemented in terms of McdSystemFlags. */
-void
-mcd_master_set_low_memory (McdMaster *master,
- gboolean low_memory)
-{
- McdMasterPrivate *priv = MCD_MASTER_PRIV (master);
-
- priv->low_memory = low_memory;
-}
-
-/* For the moment, this is implemented in terms of McdSystemFlags. When
- * McdSystemFlags are abolished, move the processing from set_flags to
- * this function. */
-void
-mcd_master_set_idle (McdMaster *master,
- gboolean idle)
-{
- McdMasterPrivate *priv = MCD_MASTER_PRIV (master);
- gboolean idle_flag_old;
-
- idle_flag_old = priv->idle;
- priv->idle = idle != 0;
-
- if (idle_flag_old != priv->idle)
- {
- GHashTableIter iter;
- gpointer v;
-
- g_hash_table_iter_init (&iter,
- _mcd_account_manager_get_accounts (priv->account_manager));
-
- while (g_hash_table_iter_next (&iter, NULL, &v))
- {
- McdAccount *account = MCD_ACCOUNT (v);
-
- if (priv->idle)
- {
- TpConnectionPresenceType presence;
-
- /* If the current presence is not Available then we don't go
- * auto-away - this avoids (a) manipulating offline accounts
- * and (b) messing up people's busy or invisible status */
- mcd_account_get_current_presence (account, &presence, NULL,
- NULL);
-
- if (presence != TP_CONNECTION_PRESENCE_TYPE_AVAILABLE)
- {
- continue;
- }
-
- /* Set the Connection to be "away" if the CM supports it
- * (if not, it'll just fail - no harm done) */
- _mcd_account_request_temporary_presence (account,
- TP_CONNECTION_PRESENCE_TYPE_AWAY, "away");
- }
- else
- {
- TpConnectionPresenceType presence;
- const gchar *status;
- const gchar *message;
-
- /* Go back to the requested presence */
- mcd_account_get_requested_presence (account, &presence,
- &status, &message);
- mcd_account_request_presence (account, presence, status,
- message);
- }
- }
- }
-}
diff --git a/src/mcd-master.h b/src/mcd-master.h
index 666b96cf..6223fb15 100644
--- a/src/mcd-master.h
+++ b/src/mcd-master.h
@@ -69,9 +69,5 @@ McdMaster *mcd_master_get_default (void);
McdDispatcher *mcd_master_get_dispatcher (McdMaster *master);
TpDBusDaemon *mcd_master_get_dbus_daemon (McdMaster *master);
-gboolean mcd_master_has_low_memory (McdMaster *master);
-void mcd_master_set_low_memory (McdMaster *master, gboolean low_memory);
-void mcd_master_set_idle (McdMaster *master, gboolean idle);
-
G_END_DECLS
#endif /* MCD_MASTER_H */
diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index 06b00107..8cb78774 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -71,7 +71,6 @@ TWISTED_BASIC_TESTS = \
# For simplicity, these are also separate tests: at least
# account-storage/*.py need their own instances.
TWISTED_SPECIAL_BUILD_TESTS = \
- account-manager/auto-away.py \
account-manager/connectivity.py \
account-manager/hidden.py \
account-storage/default-keyring-storage.py \
diff --git a/tests/twisted/account-manager/auto-away.py b/tests/twisted/account-manager/auto-away.py
deleted file mode 100644
index 6d2fc81b..00000000
--- a/tests/twisted/account-manager/auto-away.py
+++ /dev/null
@@ -1,208 +0,0 @@
-# Copyright (C) 2009 Nokia Corporation
-# Copyright (C) 2009 Collabora Ltd.
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library 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
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-# 02110-1301 USA
-
-import dbus
-import dbus.service
-
-from servicetest import EventPattern, tp_name_prefix, tp_path_prefix
-from mctest import exec_test, SimulatedConnection, create_fakecm_account,\
- SimulatedChannel
-import constants as cs
-
-def test(q, bus, mc):
- cm_name_ref = dbus.service.BusName(
- tp_name_prefix + '.ConnectionManager.fakecm', bus=bus)
-
- # Create an account
- params = dbus.Dictionary({"account": "someguy@example.com",
- "password": "secrecy"}, signature='sv')
- (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
-
- # The account is initially valid but disabled
- assert not account.Get(cs.ACCOUNT, 'Enabled',
- dbus_interface=cs.PROPERTIES_IFACE)
- assert account.Get(cs.ACCOUNT, 'Valid',
- dbus_interface=cs.PROPERTIES_IFACE)
-
- # Enable the account
- account.Set(cs.ACCOUNT, 'Enabled', True,
- dbus_interface=cs.PROPERTIES_IFACE)
- q.expect('dbus-signal',
- path=account.object_path,
- signal='AccountPropertyChanged',
- interface=cs.ACCOUNT)
-
- assert account.Get(cs.ACCOUNT, 'Enabled',
- dbus_interface=cs.PROPERTIES_IFACE)
- assert account.Get(cs.ACCOUNT, 'Valid',
- dbus_interface=cs.PROPERTIES_IFACE)
-
- # Check the requested presence is offline
- properties = account.GetAll(cs.ACCOUNT,
- dbus_interface=cs.PROPERTIES_IFACE)
- assert properties is not None
- assert properties.get('RequestedPresence') == \
- dbus.Struct((dbus.UInt32(cs.PRESENCE_TYPE_OFFLINE),
- 'offline', '')), \
- properties.get('RequestedPresence')
-
- # Go online
- requested_presence = dbus.Struct((dbus.UInt32(cs.PRESENCE_TYPE_AVAILABLE),
- dbus.String(u'available'), dbus.String(u'staring at the sea')))
- account.Set(cs.ACCOUNT,
- 'RequestedPresence', requested_presence,
- dbus_interface=cs.PROPERTIES_IFACE)
-
- e = q.expect('dbus-method-call', method='RequestConnection',
- args=['fakeprotocol', params],
- destination=tp_name_prefix + '.ConnectionManager.fakecm',
- path=tp_path_prefix + '/ConnectionManager/fakecm',
- interface=tp_name_prefix + '.ConnectionManager',
- handled=False)
-
- conn = SimulatedConnection(q, bus, 'fakecm', 'fakeprotocol', '_',
- 'myself', has_presence=True)
- conn.statuses = dbus.Dictionary({
- 'available': (cs.PRESENCE_TYPE_AVAILABLE, True, True),
- 'away': (cs.PRESENCE_TYPE_AWAY, True, True),
- 'busy': (cs.PRESENCE_TYPE_BUSY, True, True),
- 'offline': (cs.PRESENCE_TYPE_OFFLINE, False, False),
- }, signature='s(ubb)')
-
- q.dbus_return(e.message, conn.bus_name, conn.object_path, signature='so')
-
- # MC calls GetStatus (maybe) and then Connect
-
- q.expect('dbus-method-call', method='Connect',
- path=conn.object_path, handled=True)
-
- # Connect succeeds
- conn.StatusChanged(cs.CONN_STATUS_CONNECTED, cs.CONN_STATUS_REASON_NONE)
- conn.presence = dbus.Struct((cs.PRESENCE_TYPE_AVAILABLE, 'available', ''),
- signature='uss')
-
- # MC does some setup, including fetching the list of Channels
-
- get_statuses = q.expect('dbus-method-call',
- interface=cs.PROPERTIES_IFACE, method='Get',
- args=[cs.CONN_IFACE_SIMPLE_PRESENCE, 'Statuses'],
- path=conn.object_path, handled=True)
-
- call, signal = q.expect_many(
- EventPattern('dbus-method-call',
- path=conn.object_path,
- interface=cs.CONN_IFACE_SIMPLE_PRESENCE, method='SetPresence',
- args=['available', 'staring at the sea'],
- handled=True),
- EventPattern('dbus-signal',
- path=account.object_path,
- interface=cs.ACCOUNT, signal='AccountPropertyChanged',
- predicate = lambda e: 'CurrentPresence' in e.args[0]),
- )
- assert signal.args[0]['CurrentPresence'] == (cs.PRESENCE_TYPE_AVAILABLE,
- 'available', '')
-
- e = q.expect('dbus-signal',
- path=account.object_path,
- interface=cs.ACCOUNT, signal='AccountPropertyChanged',
- predicate = lambda e: 'CurrentPresence' in e.args[0])
- assert e.args[0]['CurrentPresence'] == requested_presence
-
- # Check the requested presence is online
- properties = account.GetAll(cs.ACCOUNT,
- dbus_interface=cs.PROPERTIES_IFACE)
- assert properties is not None
- assert properties.get('RequestedPresence') == requested_presence, \
- properties.get('RequestedPresence')
-
- # This is normally a C API, only exposed to D-Bus here for testing
- secret_debug_api = dbus.Interface(bus.get_object(cs.AM, "/"),
- 'org.freedesktop.Telepathy.MissionControl5.RegressionTests')
- MCD_SYSTEM_IDLE = 32
-
- # Set the idle flag
- secret_debug_api.ChangeSystemFlags(dbus.UInt32(MCD_SYSTEM_IDLE),
- dbus.UInt32(0))
-
- e = q.expect('dbus-method-call',
- path=conn.object_path,
- interface=cs.CONN_IFACE_SIMPLE_PRESENCE, method='SetPresence',
- args=['away', ''],
- handled=True)
-
- # Unset the idle flag
- secret_debug_api.ChangeSystemFlags(dbus.UInt32(0),
- dbus.UInt32(MCD_SYSTEM_IDLE))
-
- # MC puts the account back online
-
- e = q.expect('dbus-method-call',
- path=conn.object_path,
- interface=cs.CONN_IFACE_SIMPLE_PRESENCE, method='SetPresence',
- args=['available', 'staring at the sea'],
- handled=True)
-
- # Go to a non-Available status
- requested_presence = dbus.Struct((dbus.UInt32(cs.PRESENCE_TYPE_BUSY),
- dbus.String(u'busy'), dbus.String(u'in the great below')))
- account.Set(cs.ACCOUNT,
- 'RequestedPresence', requested_presence,
- dbus_interface=cs.PROPERTIES_IFACE)
- e = q.expect('dbus-method-call',
- path=conn.object_path,
- interface=cs.CONN_IFACE_SIMPLE_PRESENCE, method='SetPresence',
- args=['busy', 'in the great below'],
- handled=True)
-
- forbidden = [EventPattern('dbus-method-call',
- path=conn.object_path,
- interface=cs.CONN_IFACE_SIMPLE_PRESENCE, method='SetPresence')]
- q.forbid_events(forbidden)
-
- # Set the idle flag
- secret_debug_api.ChangeSystemFlags(dbus.UInt32(MCD_SYSTEM_IDLE),
- dbus.UInt32(0))
-
- # MC does not put the account away
-
- # Unset the idle flag
- secret_debug_api.ChangeSystemFlags(dbus.UInt32(0),
- dbus.UInt32(MCD_SYSTEM_IDLE))
-
- # MC does not put the account back online
-
- q.unforbid_events(forbidden)
-
- # Put the account offline
- requested_presence = (dbus.UInt32(cs.PRESENCE_TYPE_OFFLINE), 'offline', '')
- account.Set(cs.ACCOUNT,
- 'RequestedPresence', requested_presence,
- dbus_interface=cs.PROPERTIES_IFACE)
-
- # In response, MC tells us to Disconnect, and we do
- q.expect('dbus-method-call', method='Disconnect',
- path=conn.object_path, handled=True)
-
- properties = account.GetAll(cs.ACCOUNT, dbus_interface=cs.PROPERTIES_IFACE)
- assert properties['Connection'] == '/'
- assert properties['ConnectionStatus'] == cs.CONN_STATUS_DISCONNECTED
- assert properties['CurrentPresence'] == requested_presence
- assert properties['RequestedPresence'] == requested_presence
-
-if __name__ == '__main__':
- exec_test(test, {})
diff --git a/tests/twisted/mc-debug-server.c b/tests/twisted/mc-debug-server.c
index c1a485fe..b6f07984 100644
--- a/tests/twisted/mc-debug-server.c
+++ b/tests/twisted/mc-debug-server.c
@@ -120,58 +120,6 @@ dbus_filter_function (DBusConnection *connection,
}
else if (dbus_message_is_method_call (message,
"org.freedesktop.Telepathy.MissionControl5.RegressionTests",
- "ChangeSystemFlags"))
- {
- DBusMessage *reply;
- DBusError e;
- dbus_uint32_t set, unset;
-
- dbus_error_init (&e);
-
- if (!dbus_message_get_args (message, &e,
- 'u', &set,
- 'u', &unset,
- DBUS_TYPE_INVALID))
- {
- reply = dbus_message_new_error (message, e.name, e.message);
- dbus_error_free (&e);
- }
- else
- {
- McdMaster *master = mcd_master_get_default ();
-
- if (set & MCD_SYSTEM_IDLE)
- {
- mcd_master_set_idle (master, TRUE);
- }
-
- if (set & MCD_SYSTEM_MEMORY_CONSERVED)
- {
- mcd_master_set_low_memory (master, TRUE);
- }
-
- if (unset & MCD_SYSTEM_IDLE)
- {
- mcd_master_set_idle (master, FALSE);
- }
-
- if (unset & MCD_SYSTEM_MEMORY_CONSERVED)
- {
- mcd_master_set_low_memory (master, FALSE);
- }
-
- reply = dbus_message_new_method_return (message);
- }
-
- if (reply == NULL || !dbus_connection_send (connection, reply, NULL))
- g_error ("Out of memory");
-
- dbus_message_unref (reply);
-
- return DBUS_HANDLER_RESULT_HANDLED;
- }
- else if (dbus_message_is_method_call (message,
- "org.freedesktop.Telepathy.MissionControl5.RegressionTests",
"BillyIdle"))
{
/* Used to drive a souped-up version of sync_dbus(), where we need to