~ubuntu-branches/ubuntu/precise/empathy/precise-proposed-201205180810

« back to all changes in this revision

Viewing changes to libempathy/empathy-individual-manager.c

  • Committer: Bazaar Package Importer
  • Author(s): Brian Curtis, Brian Curtis, Ken VanDine
  • Date: 2011-06-01 10:35:24 UTC
  • mfrom: (1.1.70 upstream) (6.3.44 experimental)
  • Revision ID: james.westby@ubuntu.com-20110601103524-wx3wgp71394730jt
Tags: 3.1.1-1ubuntu1
[ Brian Curtis ]
* Merge with Debian experimental, remaining Ubuntu changes:
* debian/control:
  - Drop geoclue/mapping build-depends (they are in Universe)
  - Add Vcz-Bzr link
  - Add Suggests on telepathy-idle
  - Bump telepathy-butterfly, telepathy-haze to recommends
  - Don't recommend the freedesktop sound theme we have an ubuntu one
  - Add build depend for libunity-dev
* debian/rules:
  - Use autoreconf.mk
  - Disable map and location
* debian/empathy.install:
  - Install message indicator configuration
* debian/indicators/empathy:
  - Message indicator configuration
* debian/patches/01_lpi.patch:
  - Add Launchpad integration
* debian/patches/10_use_notify_osd_icons.patch:
  - Use the notify-osd image for new messages
* debian/patches/34_start_raised_execpt_in_session.patch
  - If not started with the session, we should always raise
* debian/patches/36_chat_window_default_size.patch:
  - Make the default chat window size larger
* debian/patches/37_facebook_default.patch:
  - Make facebook the default chat account type
* debian/patches/38_lp_569289.patch
  - Set freenode as default IRC network for new IRC accounts 
* debian/patches/41_unity_launcher_progress.patch
  - Display file transfer progress in the unity launcher

[ Ken VanDine ]
* debian/control
  - build depend on libgcr-3-dev instead of libgcr-dev
  - dropped build depends for libindicate, we will use telepathy-indicator
  - Depend on dconf-gsettings-backend | gsettings-backend
  - Added a Recommends for telepathy-indicator
* +debian/empathy.gsettings-override
  - Added an override for notifications-focus
* debian/patches/series
  - commented out 23_idomessagedialog_for_voip_and_ft.patch, until ido has 
    been ported to gtk3

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
#include <extensions/extensions.h>
36
36
 
37
37
#include "empathy-individual-manager.h"
38
 
#include "empathy-contact-manager.h"
39
 
#include "empathy-contact-list.h"
40
38
#include "empathy-marshal.h"
41
39
#include "empathy-utils.h"
 
40
#include "empathy-contact-manager.h"
42
41
 
43
42
#define DEBUG_FLAG EMPATHY_DEBUG_CONTACT
44
43
#include "empathy-debug.h"
52
51
typedef struct
53
52
{
54
53
  FolksIndividualAggregator *aggregator;
55
 
  EmpathyContactManager *contact_manager;
56
54
  GHashTable *individuals; /* Individual.id -> Individual */
57
55
} EmpathyIndividualManagerPriv;
58
56
 
223
221
  EmpathyIndividualManagerPriv *priv = GET_PRIV (object);
224
222
 
225
223
  g_hash_table_destroy (priv->individuals);
226
 
  tp_clear_object (&priv->contact_manager);
227
224
  tp_clear_object (&priv->aggregator);
228
225
 
229
226
  G_OBJECT_CLASS (empathy_individual_manager_parent_class)->dispose (object);
317
314
      EMPATHY_TYPE_INDIVIDUAL_MANAGER, EmpathyIndividualManagerPriv);
318
315
 
319
316
  self->priv = priv;
320
 
  priv->contact_manager = empathy_contact_manager_dup_singleton ();
321
317
  priv->individuals = g_hash_table_new_full (g_str_hash, g_str_equal,
322
318
      NULL, g_object_unref);
323
319
 
389
385
    EmpathyContact *contact)
390
386
{
391
387
  EmpathyIndividualManagerPriv *priv;
392
 
  EmpathyContactManager *contact_manager;
393
388
  FolksBackendStore *backend_store;
394
389
  FolksBackend *backend;
395
390
  FolksPersonaStore *persona_store;
444
439
 
445
440
  g_hash_table_destroy (details);
446
441
 
447
 
  /* unblock the EmpathyContact */
448
 
  contact_manager = empathy_contact_manager_dup_singleton ();
449
 
 
450
 
  if (empathy_contact_manager_get_flags_for_connection (contact_manager,
451
 
        empathy_contact_get_connection (contact)) &
452
 
      EMPATHY_CONTACT_LIST_CAN_BLOCK)
453
 
    {
454
 
      empathy_contact_list_set_blocked (EMPATHY_CONTACT_LIST (contact_manager),
455
 
          contact, FALSE, FALSE);
456
 
    }
457
 
 
458
 
  g_object_unref (contact_manager);
459
 
 
460
442
finish:
461
443
  tp_clear_object (&backend);
462
444
  tp_clear_object (&backend_store);
503
485
      aggregator_remove_individual_cb, self);
504
486
}
505
487
 
 
488
/* FIXME: The parameter @self is not required and the method can be placed in
 
489
 * utilities. I left it as it is to stay coherent with empathy-2.34 */
506
490
/**
507
491
 * empathy_individual_manager_supports_blocking
508
492
 * @self: the #EmpathyIndividualManager
516
500
empathy_individual_manager_supports_blocking (EmpathyIndividualManager *self,
517
501
    FolksIndividual *individual)
518
502
{
519
 
  EmpathyIndividualManagerPriv *priv;
520
503
  GList *personas, *l;
521
504
 
522
505
  g_return_val_if_fail (EMPATHY_IS_INDIVIDUAL_MANAGER (self), FALSE);
523
506
 
524
 
  priv = GET_PRIV (self);
525
 
 
526
507
  personas = folks_individual_get_personas (individual);
527
508
 
528
509
  for (l = personas; l != NULL; l = l->next)
529
510
    {
530
511
      TpfPersona *persona = l->data;
531
512
      TpConnection *conn;
 
513
      EmpathyContactManager *manager;
532
514
 
533
515
      if (!TPF_IS_PERSONA (persona))
534
516
        continue;
535
517
 
536
518
      conn = tp_contact_get_connection (tpf_persona_get_contact (persona));
 
519
      manager = empathy_contact_manager_dup_singleton ();
537
520
 
538
 
      if (empathy_individual_manager_get_flags_for_connection (self, conn) &
539
 
          EMPATHY_INDIVIDUAL_MANAGER_CAN_BLOCK)
 
521
      if (empathy_contact_manager_get_flags_for_connection (manager, conn) &
 
522
          EMPATHY_CONTACT_LIST_CAN_BLOCK)
540
523
        return TRUE;
 
524
 
 
525
      g_object_unref (manager);
541
526
    }
542
527
 
543
528
  return FALSE;
549
534
    gboolean blocked,
550
535
    gboolean abusive)
551
536
{
552
 
  EmpathyIndividualManagerPriv *priv;
553
537
  GList *personas, *l;
554
538
 
555
539
  g_return_if_fail (EMPATHY_IS_INDIVIDUAL_MANAGER (self));
556
540
 
557
 
  priv = GET_PRIV (self);
558
 
 
559
541
  personas = folks_individual_get_personas (individual);
560
542
 
561
543
  for (l = personas; l != NULL; l = l->next)
562
544
    {
563
545
      TpfPersona *persona = l->data;
564
546
      EmpathyContact *contact;
565
 
      EmpathyIndividualManagerFlags flags;
 
547
      EmpathyContactManager *manager;
 
548
      EmpathyContactListFlags flags;
566
549
 
567
550
      if (!TPF_IS_PERSONA (persona))
568
551
        continue;
569
552
 
570
553
      contact = empathy_contact_dup_from_tp_contact (
571
554
          tpf_persona_get_contact (persona));
572
 
      flags = empathy_individual_manager_get_flags_for_connection (self,
 
555
      empathy_contact_set_persona (contact, FOLKS_PERSONA (persona));
 
556
      manager = empathy_contact_manager_dup_singleton ();
 
557
      flags = empathy_contact_manager_get_flags_for_connection (manager,
573
558
          empathy_contact_get_connection (contact));
574
559
 
575
 
      if (flags & EMPATHY_INDIVIDUAL_MANAGER_CAN_BLOCK)
576
 
        {
577
 
          empathy_contact_set_persona (contact, FOLKS_PERSONA (persona));
578
 
          empathy_contact_list_set_blocked (
579
 
              EMPATHY_CONTACT_LIST (priv->contact_manager),
580
 
              contact, blocked, abusive);
581
 
        }
 
560
      if (flags & EMPATHY_CONTACT_LIST_CAN_BLOCK)
 
561
        empathy_contact_list_set_blocked (
 
562
            EMPATHY_CONTACT_LIST (manager),
 
563
            contact, blocked, abusive);
582
564
 
 
565
      g_object_unref (manager);
583
566
      g_object_unref (contact);
584
567
    }
585
568
}
627
610
      (gpointer) group);
628
611
}
629
612
 
630
 
EmpathyIndividualManagerFlags
631
 
empathy_individual_manager_get_flags_for_connection (
632
 
    EmpathyIndividualManager *self,
633
 
    TpConnection *connection)
634
 
{
635
 
  EmpathyIndividualManagerPriv *priv;
636
 
  EmpathyContactListFlags list_flags;
637
 
  EmpathyIndividualManagerFlags flags;
638
 
 
639
 
  g_return_val_if_fail (EMPATHY_IS_INDIVIDUAL_MANAGER (self),
640
 
      EMPATHY_INDIVIDUAL_MANAGER_NO_FLAGS);
641
 
 
642
 
  priv = GET_PRIV (self);
643
 
 
644
 
  list_flags = empathy_contact_manager_get_flags_for_connection (
645
 
    priv->contact_manager, connection);
646
 
 
647
 
  flags = EMPATHY_INDIVIDUAL_MANAGER_NO_FLAGS;
648
 
  if (list_flags & EMPATHY_CONTACT_LIST_CAN_ADD)
649
 
    flags |= EMPATHY_INDIVIDUAL_MANAGER_CAN_ADD;
650
 
  if (list_flags & EMPATHY_CONTACT_LIST_CAN_REMOVE)
651
 
    flags |= EMPATHY_INDIVIDUAL_MANAGER_CAN_REMOVE;
652
 
  if (list_flags & EMPATHY_CONTACT_LIST_CAN_ALIAS)
653
 
    flags |= EMPATHY_INDIVIDUAL_MANAGER_CAN_ALIAS;
654
 
  if (list_flags & EMPATHY_CONTACT_LIST_CAN_GROUP)
655
 
    flags |= EMPATHY_INDIVIDUAL_MANAGER_CAN_GROUP;
656
 
  if (list_flags & EMPATHY_CONTACT_LIST_CAN_BLOCK)
657
 
    flags |= EMPATHY_INDIVIDUAL_MANAGER_CAN_BLOCK;
658
 
  if (list_flags & EMPATHY_CONTACT_LIST_CAN_REPORT_ABUSIVE)
659
 
    flags |= EMPATHY_INDIVIDUAL_MANAGER_CAN_REPORT_ABUSIVE;
660
 
 
661
 
  return flags;
662
 
}
663
 
 
664
613
static void
665
614
link_personas_cb (FolksIndividualAggregator *aggregator,
666
615
    GAsyncResult *async_result,