aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorChandni Verma <chandniverma2112@gmail.com>2011-03-08 16:06:05 +0800
committerChandni Verma <chandniverma2112@gmail.com>2011-03-09 09:49:19 +0800
commit81ba0edc73b6a226a054b76539645b7b4e5e2a99 (patch)
tree10c83abc415c266b5fc58020f5da3492d7ab54f6 /libempathy
parent3ff78cbfcfe5dd8cbda7263764d3a8d93995bc20 (diff)
downloadgsoc2013-empathy-81ba0edc73b6a226a054b76539645b7b4e5e2a99.tar
gsoc2013-empathy-81ba0edc73b6a226a054b76539645b7b4e5e2a99.tar.gz
gsoc2013-empathy-81ba0edc73b6a226a054b76539645b7b4e5e2a99.tar.bz2
gsoc2013-empathy-81ba0edc73b6a226a054b76539645b7b4e5e2a99.tar.lz
gsoc2013-empathy-81ba0edc73b6a226a054b76539645b7b4e5e2a99.tar.xz
gsoc2013-empathy-81ba0edc73b6a226a054b76539645b7b4e5e2a99.tar.zst
gsoc2013-empathy-81ba0edc73b6a226a054b76539645b7b4e5e2a99.zip
Use Contact Manager flags instead of Individual Manager flags
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-individual-manager.c48
-rw-r--r--libempathy/empathy-individual-manager.h11
2 files changed, 11 insertions, 48 deletions
diff --git a/libempathy/empathy-individual-manager.c b/libempathy/empathy-individual-manager.c
index fd74e4bbe..71d15bb34 100644
--- a/libempathy/empathy-individual-manager.c
+++ b/libempathy/empathy-individual-manager.c
@@ -37,6 +37,7 @@
#include "empathy-individual-manager.h"
#include "empathy-marshal.h"
#include "empathy-utils.h"
+#include "empathy-contact-manager.h"
#define DEBUG_FLAG EMPATHY_DEBUG_CONTACT
#include "empathy-debug.h"
@@ -510,15 +511,19 @@ empathy_individual_manager_supports_blocking (EmpathyIndividualManager *self,
{
TpfPersona *persona = l->data;
TpConnection *conn;
+ EmpathyContactManager *manager;
if (!TPF_IS_PERSONA (persona))
continue;
conn = tp_contact_get_connection (tpf_persona_get_contact (persona));
+ manager = empathy_contact_manager_dup_singleton ();
- if (empathy_individual_manager_get_flags_for_connection (self, conn) &
- EMPATHY_INDIVIDUAL_MANAGER_CAN_BLOCK)
+ if (empathy_contact_manager_get_flags_for_connection (manager, conn) &
+ EMPATHY_CONTACT_LIST_CAN_BLOCK)
return TRUE;
+
+ g_object_unref (manager);
}
return FALSE;
@@ -542,6 +547,7 @@ empathy_individual_manager_set_blocked (EmpathyIndividualManager *self,
{
TpfPersona *persona = l->data;
EmpathyContact *contact;
+ EmpathyContactManager *manager;
if (!TPF_IS_PERSONA (persona))
continue;
@@ -549,10 +555,12 @@ empathy_individual_manager_set_blocked (EmpathyIndividualManager *self,
contact = empathy_contact_dup_from_tp_contact (
tpf_persona_get_contact (persona));
empathy_contact_set_persona (contact, FOLKS_PERSONA (persona));
+ manager = empathy_contact_manager_dup_singleton ();
empathy_contact_list_set_blocked (
- EMPATHY_CONTACT_LIST (priv->contact_manager),
+ EMPATHY_CONTACT_LIST (manager),
contact, blocked);
+ g_object_unref (manager);
g_object_unref (contact);
}
}
@@ -600,40 +608,6 @@ empathy_individual_manager_remove_group (EmpathyIndividualManager *manager,
(gpointer) group);
}
-EmpathyIndividualManagerFlags
-empathy_individual_manager_get_flags_for_connection (
- EmpathyIndividualManager *self,
- TpConnection *connection)
-{
- EmpathyIndividualManagerPriv *priv;
- EmpathyContactListFlags list_flags;
- EmpathyIndividualManagerFlags flags;
-
- g_return_val_if_fail (EMPATHY_IS_INDIVIDUAL_MANAGER (self),
- EMPATHY_INDIVIDUAL_MANAGER_NO_FLAGS);
-
- priv = GET_PRIV (self);
-
- list_flags = empathy_contact_manager_get_flags_for_connection (
- priv->contact_manager, connection);
-
- flags = EMPATHY_INDIVIDUAL_MANAGER_NO_FLAGS;
- if (list_flags & EMPATHY_CONTACT_LIST_CAN_ADD)
- flags |= EMPATHY_INDIVIDUAL_MANAGER_CAN_ADD;
- if (list_flags & EMPATHY_CONTACT_LIST_CAN_REMOVE)
- flags |= EMPATHY_INDIVIDUAL_MANAGER_CAN_REMOVE;
- if (list_flags & EMPATHY_CONTACT_LIST_CAN_ALIAS)
- flags |= EMPATHY_INDIVIDUAL_MANAGER_CAN_ALIAS;
- if (list_flags & EMPATHY_CONTACT_LIST_CAN_GROUP)
- flags |= EMPATHY_INDIVIDUAL_MANAGER_CAN_GROUP;
- if (list_flags & EMPATHY_CONTACT_LIST_CAN_BLOCK)
- flags |= EMPATHY_INDIVIDUAL_MANAGER_CAN_BLOCK;
- if (list_flags & EMPATHY_CONTACT_LIST_CAN_REPORT_ABUSIVE)
- flags |= EMPATHY_INDIVIDUAL_MANAGER_CAN_REPORT_ABUSIVE;
-
- return flags;
-}
-
static void
link_personas_cb (FolksIndividualAggregator *aggregator,
GAsyncResult *async_result,
diff --git a/libempathy/empathy-individual-manager.h b/libempathy/empathy-individual-manager.h
index 12f8ccdb0..75411b49c 100644
--- a/libempathy/empathy-individual-manager.h
+++ b/libempathy/empathy-individual-manager.h
@@ -36,17 +36,6 @@ G_BEGIN_DECLS
#define EMPATHY_IS_INDIVIDUAL_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_INDIVIDUAL_MANAGER))
#define EMPATHY_INDIVIDUAL_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_INDIVIDUAL_MANAGER, EmpathyIndividualManagerClass))
-typedef enum
-{
- EMPATHY_INDIVIDUAL_MANAGER_NO_FLAGS = 0,
- EMPATHY_INDIVIDUAL_MANAGER_CAN_ADD = 1 << 0,
- EMPATHY_INDIVIDUAL_MANAGER_CAN_REMOVE = 1 << 1,
- EMPATHY_INDIVIDUAL_MANAGER_CAN_ALIAS = 1 << 2,
- EMPATHY_INDIVIDUAL_MANAGER_CAN_GROUP = 1 << 3,
- EMPATHY_INDIVIDUAL_MANAGER_CAN_BLOCK = 1 << 4,
- EMPATHY_INDIVIDUAL_MANAGER_CAN_REPORT_ABUSIVE = 1 << 5,
-} EmpathyIndividualManagerFlags;
-
typedef struct _EmpathyIndividualManager EmpathyIndividualManager;
typedef struct _EmpathyIndividualManagerClass EmpathyIndividualManagerClass;