~ubuntu-branches/ubuntu/utopic/gnome-online-accounts/utopic

« back to all changes in this revision

Viewing changes to src/daemon/goatpaccountlinker.c

  • Committer: Package Import Robot
  • Author(s): Andreas Henriksson, Laurent Bigonville, Andreas Henriksson
  • Date: 2014-05-16 11:42:52 UTC
  • mfrom: (1.1.28) (0.1.12 sid)
  • Revision ID: package-import@ubuntu.com-20140516114252-u5ect6mk6ht8i38x
Tags: 3.12.2-1
[ Laurent Bigonville ]
* debian/control.in: Recommends realmd package (Closes: #725965)

[ Andreas Henriksson ]
* New upstream release.
  - Removes chat support from Windows Live provider (XMPP gateway gone).
* Bump Standards-Version to 3.9.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 * Lesser General Public License for more details.
15
15
 *
16
16
 * You should have received a copy of the GNU Lesser General
17
 
 * Public License along with this library; if not, write to the
18
 
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
19
 
 * Boston, MA 02111-1307, USA.
 
17
 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
20
18
 *
21
19
 * Author: Marco Barisione <marco.barisione@collabora.co.uk>
22
20
 */
33
31
 
34
32
#include "goatpaccountlinker.h"
35
33
#include "goa/goa.h"
36
 
#include "goabackend/goalogging.h"
37
34
#include "goabackend/goautils.h"
38
35
 
39
36
#define GOA_TP_ACCOUNT_LINKER_GET_PRIVATE(obj) \
92
89
  tp_enabled = tp_account_is_enabled (tp_account);
93
90
  if (tp_enabled != goa_enabled)
94
91
    {
95
 
      goa_info ("The GOA account %s (Telepathy object path: %s) has been %s, "
 
92
      g_info ("The GOA account %s (Telepathy object path: %s) has been %s, "
96
93
          "propagating to Telepathy",
97
94
          goa_account_get_id (goa_account), id,
98
95
          goa_enabled ? "enabled" : "disabled");
122
119
  tp_enabled = tp_account_is_enabled (tp_account);
123
120
  if (tp_enabled != goa_enabled)
124
121
    {
125
 
      goa_info ("The Telepathy account %s has been %s, propagating to GOA",
 
122
      g_info ("The Telepathy account %s has been %s, propagating to GOA",
126
123
          id, tp_enabled ? "enabled" : "disabled");
127
124
      /* When we set this property, the autogenerated code emits a notify
128
125
       * signal immediately even if the property hasn't changed, so
150
147
  if (!goa_manager_call_add_account_finish (manager,
151
148
        &goa_account_object_path, res, &error))
152
149
    {
153
 
      goa_error ("Failed to create a GOA account for %s: %s (%s, %d)",
 
150
      g_critical ("Failed to create a GOA account for %s: %s (%s, %d)",
154
151
          get_id_from_tp_account (tp_account),
155
152
          error->message,
156
153
          g_quark_to_string (error->domain),
159
156
      goto out;
160
157
    }
161
158
 
162
 
  goa_info ("Created new %s GOA account for Telepathy account %s",
 
159
  g_info ("Created new %s GOA account for Telepathy account %s",
163
160
      goa_account_object_path, get_id_from_tp_account (tp_account));
164
161
 
165
162
 out:
175
172
  GVariantBuilder details;
176
173
  gchar *provider;
177
174
 
178
 
  goa_info ("Creating new GOA account for Telepathy account %s",
 
175
  g_info ("Creating new GOA account for Telepathy account %s",
179
176
      get_id_from_tp_account (tp_account));
180
177
 
181
178
  g_variant_builder_init (&credentials, G_VARIANT_TYPE_VARDICT);
228
225
  if (g_strcmp0 (tp_account_get_storage_provider (tp_account),
229
226
        "org.gnome.OnlineAccounts") == 0)
230
227
    {
231
 
      goa_debug ("Skipping Telepathy account %s as it's handled directly by GOA", id);
 
228
      g_debug ("Skipping Telepathy account %s as it's handled directly by GOA", id);
232
229
      return;
233
230
    }
234
231
 
235
232
  if (is_account_filtered (tp_account))
236
233
    {
237
 
      goa_debug ("The account %s is ignored for debugging reasons", id);
 
234
      g_debug ("The account %s is ignored for debugging reasons", id);
238
235
      return;
239
236
    }
240
237
 
241
 
  goa_debug ("Telepathy account found: %s", id);
 
238
  g_debug ("Telepathy account found: %s", id);
242
239
 
243
240
  g_hash_table_replace (priv->tp_accounts, g_strdup (id),
244
241
      g_object_ref (tp_account));
250
247
  goa_object = g_hash_table_lookup (priv->goa_accounts, id);
251
248
  if (goa_object == NULL)
252
249
    {
253
 
      goa_debug ("Found a Telepathy account with no corresponding "
 
250
      g_debug ("Found a Telepathy account with no corresponding "
254
251
          "GOA account: %s", id);
255
252
      create_goa_account (self, tp_account);
256
253
    }
257
254
  else
258
255
    {
259
 
      goa_debug ("Found a Telepathy account with a matching "
 
256
      g_debug ("Found a Telepathy account with a matching "
260
257
          "GOA account: %s", id);
261
258
      /* Make sure the initial state is synced. */
262
259
      tp_account_chat_enabled_changed_cb (tp_account, NULL, self);
274
271
 
275
272
  if (!goa_account_call_remove_finish (goa_account, res, &error))
276
273
    {
277
 
      goa_error ("Error removing GOA account %s (Telepathy object path: %s): "
 
274
      g_critical ("Error removing GOA account %s (Telepathy object path: %s): "
278
275
          "%s (%s, %d)",
279
276
          goa_account_get_id (goa_account),
280
277
          get_id_from_goa_account (goa_account),
303
300
       * 3 - "account-removed" is emitted by the account manager
304
301
       * 4 - tp_account_removed_cb is called for an unknown account
305
302
       */
306
 
      goa_debug ("Ignoring removal of Telepathy account we asked to "
 
303
      g_debug ("Ignoring removal of Telepathy account we asked to "
307
304
          "remove (%s)", id);
308
305
      return;
309
306
    }
310
307
 
311
 
  goa_info ("Telepathy account %s removed, removing corresponding "
 
308
  g_info ("Telepathy account %s removed, removing corresponding "
312
309
      "GOA account", id);
313
310
 
314
311
  goa_object = g_hash_table_lookup (priv->goa_accounts, id);
315
312
  if (goa_object == NULL)
316
313
    {
317
 
      goa_error ("There is no GOA account for removed Telepathy "
 
314
      g_critical ("There is no GOA account for removed Telepathy "
318
315
          "account %s", id);
319
316
      return;
320
317
    }
351
348
    return;
352
349
 
353
350
  id = get_id_from_goa_account (goa_account);
354
 
  goa_debug ("GOA account %s for Telepathy account %s added",
 
351
  g_debug ("GOA account %s for Telepathy account %s added",
355
352
      goa_account_get_id (goa_account), id);
356
353
 
357
354
  g_signal_connect_object (goa_account, "notify::chat-disabled",
380
377
 
381
378
  if (!tp_account_remove_finish (tp_account, res, &error))
382
379
    {
383
 
      goa_error ("Error removing Telepathy account %s: %s (%s, %d)",
 
380
      g_critical ("Error removing Telepathy account %s: %s (%s, %d)",
384
381
          get_id_from_tp_account (tp_account),
385
382
          error->message,
386
383
          g_quark_to_string (error->domain),
412
409
       * 3 - "account-removed" is emitted by the GOA client
413
410
       * 4 - goa_account_removed_cb is called for an unknown account
414
411
       */
415
 
      goa_debug ("Ignoring removal of GOA account we asked to remove "
 
412
      g_debug ("Ignoring removal of GOA account we asked to remove "
416
413
          "(%s, Telepathy object path: %s)",
417
414
          goa_account_get_id (goa_account),
418
415
          id);
419
416
      return;
420
417
    }
421
418
 
422
 
  goa_info ("GOA account %s for Telepathy account %s removed, "
 
419
  g_info ("GOA account %s for Telepathy account %s removed, "
423
420
      "removing Telepathy account",
424
421
      goa_account_get_id (goa_account), id);
425
422
 
426
423
  tp_account = g_hash_table_lookup (priv->tp_accounts, id);
427
424
  if (tp_account == NULL)
428
425
    {
429
 
      goa_error ("There is no Telepathy account for removed GOA "
 
426
      g_critical ("There is no Telepathy account for removed GOA "
430
427
          "account %s (Telepathy object path: %s)",
431
428
          goa_account_get_id (goa_account), id);
432
429
      return;
454
451
      return;
455
452
    }
456
453
 
457
 
  goa_debug ("Both GOA and Tp are ready, starting tracking of accounts");
 
454
  g_debug ("Both GOA and Tp are ready, starting tracking of accounts");
458
455
 
459
456
  /* GOA */
460
457
  goa_accounts = goa_client_get_accounts (priv->goa_client);
488
485
 
489
486
      if (!g_hash_table_lookup (priv->tp_accounts, id))
490
487
        {
491
 
          goa_warning ("The Telepathy account %s was removed while the daemon "
 
488
          g_warning ("The Telepathy account %s was removed while the daemon "
492
489
              "was not running, removing the corresponding GOA account", id);
493
490
          goa_account_call_remove (goa_object_peek_account (goa_object),
494
491
              NULL, /* cancellable */
508
505
 
509
506
  if (!tp_proxy_prepare_finish (object, res, &error))
510
507
    {
511
 
      goa_error ("Error preparing AM: %s", error->message);
 
508
      g_critical ("Error preparing AM: %s", error->message);
512
509
      g_clear_error (&error);
513
510
      return;
514
511
    }
515
512
 
516
 
  goa_debug("Telepathy account manager prepared");
 
513
  g_debug("Telepathy account manager prepared");
517
514
  start_if_ready (self);
518
515
}
519
516
 
529
526
  priv->goa_client = goa_client_new_finish (result, &error);
530
527
  if (priv->goa_client == NULL)
531
528
    {
532
 
      goa_error ("Error connecting to GOA: %s", error->message);
 
529
      g_critical ("Error connecting to GOA: %s", error->message);
533
530
      g_clear_error (&error);
534
531
      return;
535
532
    }
536
533
 
537
 
  goa_debug("GOA client ready");
 
534
  g_debug("GOA client ready");
538
535
  start_if_ready (self);
539
536
}
540
537
 
558
555
{
559
556
  GoaTpAccountLinkerPrivate *priv;
560
557
 
561
 
  goa_debug ("Starting GOA <-> Telepathy account linker");
 
558
  g_debug ("Starting GOA <-> Telepathy account linker");
562
559
 
563
560
  self->priv = GOA_TP_ACCOUNT_LINKER_GET_PRIVATE (self);
564
561
  priv = self->priv;