diff options
author | Danielle Madeley <danielle.madeley@collabora.co.uk> | 2009-12-16 15:09:55 +0800 |
---|---|---|
committer | Danielle Madeley <danielle.madeley@collabora.co.uk> | 2009-12-21 17:55:02 +0800 |
commit | b39e12f74ac06de310870a54b08e7fb32d2d2fe0 (patch) | |
tree | 4ef1eca7205a83cccca1f88ff9a40241b302a443 /src/empathy-chat-window.c | |
parent | d8d74645987b0188f437b967c7d88dd3fda2db13 (diff) | |
download | gsoc2013-empathy-b39e12f74ac06de310870a54b08e7fb32d2d2fe0.tar gsoc2013-empathy-b39e12f74ac06de310870a54b08e7fb32d2d2fe0.tar.gz gsoc2013-empathy-b39e12f74ac06de310870a54b08e7fb32d2d2fe0.tar.bz2 gsoc2013-empathy-b39e12f74ac06de310870a54b08e7fb32d2d2fe0.tar.lz gsoc2013-empathy-b39e12f74ac06de310870a54b08e7fb32d2d2fe0.tar.xz gsoc2013-empathy-b39e12f74ac06de310870a54b08e7fb32d2d2fe0.tar.zst gsoc2013-empathy-b39e12f74ac06de310870a54b08e7fb32d2d2fe0.zip |
Add a rudimentry UI to select a 3rd contact to invite
Needs support for inviting in MUCs added
Diffstat (limited to 'src/empathy-chat-window.c')
-rw-r--r-- | src/empathy-chat-window.c | 67 |
1 files changed, 55 insertions, 12 deletions
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c index 26829a3bb..17662b115 100644 --- a/src/empathy-chat-window.c +++ b/src/empathy-chat-window.c @@ -57,6 +57,7 @@ #include "empathy-chat-window.h" #include "empathy-about-dialog.h" +#include "empathy-invite-participant-dialog.h" #define DEBUG_FLAG EMPATHY_DEBUG_CHAT #include <libempathy/empathy-debug.h> @@ -820,10 +821,9 @@ chat_window_contacts_toggled_cb (GtkToggleAction *toggle_action, } static void -chat_window_invite_participant_activate_cb (GtkAction *action, - EmpathyChatWindow *window) +chat_window_upgrade_to_muc (EmpathyChat *chat, + EmpathyContact *invitee) { - EmpathyChatWindowPriv *priv; EmpathyDispatcher *dispatcher = empathy_dispatcher_dup_singleton (); EmpathyTpChat *tp_chat; TpConnection *connection; @@ -832,14 +832,7 @@ chat_window_invite_participant_activate_cb (GtkAction *action, GPtrArray *channels; char *invitees[3] = { NULL, }; - priv = GET_PRIV (window); - - g_return_if_fail (priv->current_chat != NULL); - - /* FIXME: this is for upgrading a 1-to-1 channel to a MUC, inviting - * a user to a MUC is much easier, and needs to be written */ - - tp_chat = empathy_chat_get_tp_chat (priv->current_chat); + tp_chat = empathy_chat_get_tp_chat (chat); connection = empathy_tp_chat_get_connection (tp_chat); channel = empathy_tp_chat_get_channel (tp_chat); @@ -848,7 +841,7 @@ chat_window_invite_participant_activate_cb (GtkAction *action, g_ptr_array_add (channels, (char *) tp_proxy_get_object_path (channel)); invitees[0] = (char *) tp_channel_get_identifier (channel); - // invitees[1] = /* FIXME: ask for this */ + invitees[1] = (char *) empathy_contact_get_id (invitee); props = tp_asv_new ( TP_IFACE_CHANNEL ".ChannelType", G_TYPE_STRING, @@ -873,6 +866,56 @@ chat_window_invite_participant_activate_cb (GtkAction *action, } static void +chat_window_invite_participant_activate_cb (GtkAction *action, + EmpathyChatWindow *window) +{ + EmpathyChatWindowPriv *priv; + GtkWidget *dialog; + EmpathyTpChat *tp_chat; + TpChannel *channel; + int response; + + priv = GET_PRIV (window); + + g_return_if_fail (priv->current_chat != NULL); + + tp_chat = empathy_chat_get_tp_chat (priv->current_chat); + channel = empathy_tp_chat_get_channel (tp_chat); + + /* FIXME: should filter out the existing participants from the + * list */ + dialog = empathy_invite_participant_dialog_new ( + GTK_WINDOW (priv->dialog)); + gtk_widget_show (dialog); + + response = gtk_dialog_run (GTK_DIALOG (dialog)); + + if (response == GTK_RESPONSE_OK) + { + EmpathyContact *contact; + TpHandleType handle_type; + + contact = empathy_invite_participant_dialog_dup_selected_contact (EMPATHY_INVITE_PARTICIPANT_DIALOG (dialog)); + tp_channel_get_handle (channel, &handle_type); + + if (handle_type == TP_HANDLE_TYPE_CONTACT) + { + chat_window_upgrade_to_muc (priv->current_chat, + contact); + } + else + { + /* FIXME: do something with MUC */ + g_warning ("Not implemented yet"); + } + + g_object_unref (contact); + } + + gtk_widget_destroy (dialog); +} + +static void chat_window_close_activate_cb (GtkAction *action, EmpathyChatWindow *window) { |