aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--libempathy-gtk/empathy-chat-window.c12
-rw-r--r--libempathy-gtk/empathy-contact-list-view.c59
-rw-r--r--libempathy/Makefile.am12
-rw-r--r--libempathy/empathy-tp-group.c2
-rw-r--r--src/Makefile.am11
6 files changed, 76 insertions, 28 deletions
diff --git a/ChangeLog b/ChangeLog
index 17a687988..9a716210d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2007-09-28 Xavier Claessens <xclaesse@gmail.com>
+ * libempathy-gtk/empathy-contact-list-view.c:
+ * libempathy-gtk/empathy-chat-window.c:
+ * src/Makefile.am:
+ * libempathy/empathy-tp-group.c:
+ * libempathy/Makefile.am: Ported from VOIP branch.
+
+2007-09-28 Xavier Claessens <xclaesse@gmail.com>
+
* configure.ac: Bump version to 0.14.
* doc/*: Updated.
diff --git a/libempathy-gtk/empathy-chat-window.c b/libempathy-gtk/empathy-chat-window.c
index 468c3236e..29fe5a521 100644
--- a/libempathy-gtk/empathy-chat-window.c
+++ b/libempathy-gtk/empathy-chat-window.c
@@ -877,21 +877,15 @@ chat_window_call_activate_cb (GtkWidget *menuitem,
priv = GET_PRIV (window);
if (!empathy_chat_is_group_chat (priv->current_chat)) {
- MissionControl *mc;
EmpathyPrivateChat *chat;
EmpathyContact *contact;
chat = EMPATHY_PRIVATE_CHAT (priv->current_chat);
contact = empathy_private_chat_get_contact (chat);
- mc = empathy_mission_control_new ();
- mission_control_request_channel (mc,
- empathy_contact_get_account (contact),
- TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA,
- empathy_contact_get_handle (contact),
- TP_HANDLE_TYPE_CONTACT,
- NULL, NULL);
- g_object_unref (mc);
+ /* FIXME: See contact_list_view_voip_activated() to know how to
+ * call a contact. We need a function to call a contact and use
+ * it here and in EmpathyContactListView. */
}
}
diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c
index 27688602c..c959eec01 100644
--- a/libempathy-gtk/empathy-contact-list-view.c
+++ b/libempathy-gtk/empathy-contact-list-view.c
@@ -31,12 +31,15 @@
#include <gtk/gtk.h>
#include <glade/glade.h>
+#include <libtelepathy/tp-helpers.h>
+
#include <libmissioncontrol/mc-account.h>
#include <libmissioncontrol/mission-control.h>
#include <libempathy/empathy-contact-factory.h>
#include <libempathy/empathy-contact-list.h>
#include <libempathy/empathy-log-manager.h>
+#include <libempathy/empathy-tp-group.h>
#include <libempathy/empathy-debug.h>
#include <libempathy/empathy-utils.h>
#include <libempathy/empathy-marshal.h>
@@ -1436,14 +1439,58 @@ contact_list_view_voip_activated (EmpathyContactListView *view,
EmpathyContact *contact)
{
MissionControl *mc;
+ McAccount *account;
+ TpConn *tp_conn;
+ gchar *object_path;
+ const gchar *bus_name;
+ TpChan *new_chan;
+ EmpathyTpGroup *group;
+ GError *error;
+
+ /* StreamedMedia channels must have handle=0 and handle_type=none.
+ * To call a contact we have to add him in the group interface of the
+ * channel. MissionControl will detect the channel creation and
+ * dispatch it to the VoIP chandler automatically. */
mc = empathy_mission_control_new ();
- mission_control_request_channel (mc,
- empathy_contact_get_account (contact),
- TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA,
- empathy_contact_get_handle (contact),
- TP_HANDLE_TYPE_CONTACT,
- NULL, NULL);
+ account = empathy_contact_get_account (contact);
+ tp_conn = mission_control_get_connection (mc, account, NULL);
+ /* FIXME: Should be async */
+ if (!tp_conn_request_channel (DBUS_G_PROXY (tp_conn),
+ TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA,
+ TP_HANDLE_TYPE_NONE,
+ 0,
+ FALSE,
+ &object_path,
+ &error)) {
+ empathy_debug (DEBUG_DOMAIN,
+ "Couldn't request channel: %s",
+ error ? error->message : "No error given");
+ g_clear_error (&error);
+ g_object_unref (mc);
+ g_object_unref (tp_conn);
+ return;
+ }
+
+ bus_name = dbus_g_proxy_get_bus_name (DBUS_G_PROXY (tp_conn));
+ new_chan = tp_chan_new (tp_get_bus (),
+ bus_name,
+ object_path,
+ TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA,
+ TP_HANDLE_TYPE_NONE,
+ 0);
+
+ /* FIXME: group is leaked, we can't unref it directly because
+ * _add_member is async so we have to wait for it to return before
+ * finalizing the group. I think EmpathyTpGroup should ref itself
+ * when it does async calls to avoid finalizing when there is calls
+ * in fligth like that we could unref it here. */
+ group = empathy_tp_group_new (account, new_chan);
+ empathy_tp_group_add_member (group, contact, "");
+
g_object_unref (mc);
+ g_object_unref (tp_conn);
+ g_object_unref (new_chan);
+ g_free (object_path);
}
diff --git a/libempathy/Makefile.am b/libempathy/Makefile.am
index 639d22ecb..9dc4021e2 100644
--- a/libempathy/Makefile.am
+++ b/libempathy/Makefile.am
@@ -78,21 +78,21 @@ libempathy_include_HEADERS = \
$(libempathy_headers) \
empathy-enum-types.h
-%-marshal.h: %-marshal.list Makefile.am
+%-marshal.h: %-marshal.list Makefile
$(GLIB_GENMARSHAL) --header --prefix=$(subst -,_,$*)_marshal $< > $*-marshal.h
-%-marshal.c: %-marshal.list Makefile.am
+%-marshal.c: %-marshal.list Makefile
echo "#include \"empathy-marshal.h\"" > $@ && \
$(GLIB_GENMARSHAL) --body --prefix=$(subst -,_,$*)_marshal $< >> $*-marshal.c
-empathy-chandler-glue.h: empathy-chandler.xml
+empathy-chandler-glue.h: empathy-chandler.xml Makefile
$(LIBTOOL) --mode=execute $(DBUS_BINDING_TOOL) --prefix=empathy_chandler --mode=glib-server --output=$@ $<
-empathy-filter-glue.h: empathy-filter.xml
+empathy-filter-glue.h: empathy-filter.xml Makefile
$(LIBTOOL) --mode=execute $(DBUS_BINDING_TOOL) --prefix=empathy_filter --mode=glib-server --output=$@ $<
empathy-enum-types.h: stamp-empathy-enum-types.h
@true
-stamp-empathy-enum-types.h: Makefile $(libempathy_headers)
+stamp-empathy-enum-types.h: $(libempathy_headers) Makefile
(cd $(srcdir) \
&& glib-mkenums \
--fhead "#ifndef __LIBEMPATHY_ENUM_TYPES_H__\n" \
@@ -109,7 +109,7 @@ stamp-empathy-enum-types.h: Makefile $(libempathy_headers)
&& rm -f xgen-gth \
&& echo timestamp > $(@F)
-empathy-enum-types.c: Makefile $(libempathy_headers)
+empathy-enum-types.c: $(libempathy_headers) Makefile
(cd $(srcdir) \
&& glib-mkenums \
--fhead "#include <config.h>\n" \
diff --git a/libempathy/empathy-tp-group.c b/libempathy/empathy-tp-group.c
index c4f7583e9..dbc2d228e 100644
--- a/libempathy/empathy-tp-group.c
+++ b/libempathy/empathy-tp-group.c
@@ -777,7 +777,7 @@ empathy_tp_group_get_name (EmpathyTpGroup *group)
priv = GET_PRIV (group);
/* Lazy initialisation */
- if (!priv->group_name) {
+ if (!priv->group_name && priv->tp_chan->handle != 0) {
priv->group_name = empathy_inspect_channel (priv->account, priv->tp_chan);
}
diff --git a/src/Makefile.am b/src/Makefile.am
index c7344c8c8..d81601ed0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -22,15 +22,14 @@ empathy_accounts_SOURCES = empathy-accounts.c
# Dbus service file
servicedir = $(datadir)/dbus-1/services
-service_in_files = org.gnome.Empathy.Chat.service.in
-service_DATA = $(service_in_files:.service.in=.service)
-
-# Rule to make the service file with bindir expanded
-$(service_DATA): $(service_in_files) Makefile
+service_DATA = \
+ org.gnome.Empathy.Chat.service
+%.service: %.service.in Makefile
@sed -e "s|\@bindir\@|$(bindir)|" $< > $@
chandlerdir = $(datadir)/telepathy/managers
-chandler_DATA = empathy-chat.chandler
+chandler_DATA = \
+ empathy-chat.chandler
BUILT_SOURCES = \
org.gnome.Empathy.Chat.service