aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2007-04-27 04:51:09 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2007-04-27 04:51:09 +0800
commit69814b0fd3717aadde21b392c875033865903f07 (patch)
tree31af67384bdcdaacc5ea0bf23378dabe42f42474 /libempathy
parent703a7db832de5d180a6880321fcee7919eb6094e (diff)
downloadgsoc2013-empathy-69814b0fd3717aadde21b392c875033865903f07.tar
gsoc2013-empathy-69814b0fd3717aadde21b392c875033865903f07.tar.gz
gsoc2013-empathy-69814b0fd3717aadde21b392c875033865903f07.tar.bz2
gsoc2013-empathy-69814b0fd3717aadde21b392c875033865903f07.tar.lz
gsoc2013-empathy-69814b0fd3717aadde21b392c875033865903f07.tar.xz
gsoc2013-empathy-69814b0fd3717aadde21b392c875033865903f07.tar.zst
gsoc2013-empathy-69814b0fd3717aadde21b392c875033865903f07.zip
[darcs-to-svn @ Save/restore window geometry]
svn path=/trunk/; revision=6
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-tp-chat.c58
-rw-r--r--libempathy/empathy-tp-chat.h1
-rw-r--r--libempathy/gossip-telepathy-group.c2
3 files changed, 60 insertions, 1 deletions
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c
index 9ddad869d..36ac8a7a8 100644
--- a/libempathy/empathy-tp-chat.c
+++ b/libempathy/empathy-tp-chat.c
@@ -25,6 +25,7 @@
#include <libtelepathy/tp-helpers.h>
#include <libtelepathy/tp-chan-type-text-gen.h>
#include <libtelepathy/tp-chan-iface-chat-state-gen.h>
+#include <libtelepathy/tp-conn.h>
#include "empathy-tp-chat.h"
#include "empathy-contact-manager.h"
@@ -41,6 +42,9 @@
struct _EmpathyTpChatPriv {
EmpathyContactList *list;
+ McAccount *account;
+ gchar *id;
+
TpChan *tp_chan;
DBusGProxy *text_iface;
DBusGProxy *chat_state_iface;
@@ -160,6 +164,10 @@ tp_chat_finalize (GObject *object)
if (priv->list) {
g_object_unref (priv->list);
}
+ if (priv->account) {
+ g_object_unref (priv->account);
+ }
+ g_free (priv->id);
G_OBJECT_CLASS (empathy_tp_chat_parent_class)->finalize (object);
}
@@ -181,6 +189,7 @@ empathy_tp_chat_new (McAccount *account,
manager = empathy_session_get_contact_manager ();
priv->list = empathy_contact_manager_get_list (manager, account);
priv->tp_chan = g_object_ref (tp_chan);
+ priv->account = g_object_ref (account);
g_object_ref (priv->list);
priv->text_iface = tp_chan_get_interface (tp_chan,
@@ -360,6 +369,55 @@ empathy_tp_chat_send_state (EmpathyTpChat *chat,
}
}
+const gchar *
+empathy_tp_chat_get_id (EmpathyTpChat *chat)
+{
+ EmpathyTpChatPriv *priv;
+ MissionControl *mc;
+ TpConn *tp_conn;
+ GArray *handles;
+ gchar **names;
+ GError *error = NULL;
+
+ g_return_val_if_fail (EMPATHY_IS_TP_CHAT (chat), NULL);
+
+ priv = GET_PRIV (chat);
+
+ if (priv->id) {
+ return priv->id;
+ }
+
+ mc = empathy_session_get_mission_control ();
+ tp_conn = mission_control_get_connection (mc, priv->account, NULL);
+ handles = g_array_new (FALSE, FALSE, sizeof (guint));
+ g_array_append_val (handles, priv->tp_chan->handle);
+
+ if (!tp_conn_inspect_handles (DBUS_G_PROXY (tp_conn),
+ priv->tp_chan->handle_type,
+ handles,
+ &names,
+ &error)) {
+ gossip_debug (DEBUG_DOMAIN,
+ "Couldn't get id: %s",
+ error ? error->message : "No error given");
+ g_clear_error (&error);
+ g_array_free (handles, TRUE);
+ g_object_unref (tp_conn);
+
+ return NULL;
+ }
+
+ /* A handle name is unique only for a specific account */
+ priv->id = g_strdup_printf ("%s/%s",
+ mc_account_get_unique_name (priv->account),
+ *names);
+
+ g_strfreev (names);
+ g_object_unref (tp_conn);
+
+ return priv->id;
+}
+
static void
tp_chat_destroy_cb (TpChan *text_chan,
EmpathyTpChat *chat)
diff --git a/libempathy/empathy-tp-chat.h b/libempathy/empathy-tp-chat.h
index 6a1056131..5737fcee9 100644
--- a/libempathy/empathy-tp-chat.h
+++ b/libempathy/empathy-tp-chat.h
@@ -71,6 +71,7 @@ void empathy_tp_chat_send (EmpathyTpChat *chat,
GossipMessage *message);
void empathy_tp_chat_send_state (EmpathyTpChat *chat,
EmpathyTpChatState state);
+const gchar * empathy_tp_chat_get_id (EmpathyTpChat *chat);
G_END_DECLS
diff --git a/libempathy/gossip-telepathy-group.c b/libempathy/gossip-telepathy-group.c
index 4b04ac42f..3f9998c0d 100644
--- a/libempathy/gossip-telepathy-group.c
+++ b/libempathy/gossip-telepathy-group.c
@@ -418,7 +418,7 @@ gossip_telepathy_group_get_name (GossipTelepathyGroup *group)
return NULL;
}
- group_handles = g_array_new (FALSE, FALSE, sizeof (gint));
+ group_handles = g_array_new (FALSE, FALSE, sizeof (guint));
g_array_append_val (group_handles, channel_handle);
if (!tp_conn_inspect_handles (DBUS_G_PROXY (priv->tp_conn),
handle_type,