#include <libempathy/empathy-utils.h>
#include <libempathy/empathy-request-util.h>
#include <libempathy/empathy-chatroom-manager.h>
-#include <src/empathy-chat-window.h>
#include "empathy-chat.h"
#include "empathy-spell.h"
enum {
COMPOSING,
NEW_MESSAGE,
+ PART_COMMAND_ENTERED,
LAST_SIGNAL
};
EMP_IFACE_QUARK_CONNECTION_INTERFACE_RENAMING);
}
-#if 0
static gboolean
part_command_supported (EmpathyChat *chat)
{
return tp_proxy_has_interface_by_id (channel,
TP_IFACE_QUARK_CHANNEL_INTERFACE_GROUP);
}
-#endif
static void
chat_command_clear (EmpathyChat *chat,
g_strfreev (rooms);
}
-void
-empathy_chat_leave_chat (EmpathyChat *chat)
-{
- EmpathyChatPriv *priv = GET_PRIV (chat);
-
- empathy_tp_chat_leave (priv->tp_chat, "");
-}
-
-#if 0
static void
chat_command_part (EmpathyChat *chat,
GStrv strv)
{
- EmpathyChatPriv *priv = GET_PRIV (chat);
- EmpathyChat *chat_to_be_parted;
-
- if (strv[1] == NULL) {
- empathy_tp_chat_leave (priv->tp_chat, "");
- return;
- }
- chat_to_be_parted = empathy_chat_window_find_chat (priv->account, strv[1]);
-
- if (chat_to_be_parted != NULL) {
- empathy_tp_chat_leave (empathy_chat_get_tp_chat (chat_to_be_parted), strv[2]);
- } else {
- empathy_tp_chat_leave (priv->tp_chat, strv[1]);
- }
+ g_signal_emit (chat, signals[PART_COMMAND_ENTERED], 0, strv);
}
-#endif
static void
chat_command_msg_internal (EmpathyChat *chat,
{"j", 2, 2, chat_command_join, NULL,
N_("/j <chat room ID>: join a new chat room")},
-#if 0
/* FIXME: https://bugzilla.gnome.org/show_bug.cgi?id=643295 */
{"part", 1, 3, chat_command_part, part_command_supported,
N_("/part [<chat room ID>] [<reason>]: leave the chat room, "
"by default the current one")},
-#endif
{"query", 2, 3, chat_command_query, NULL,
N_("/query <contact ID> [<message>]: open a private chat")},
G_TYPE_NONE,
2, EMPATHY_TYPE_MESSAGE, G_TYPE_BOOLEAN);
+ signals[PART_COMMAND_ENTERED] =
+ g_signal_new ("part-command-entered",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE,
+ 1, G_TYPE_STRV);
+
g_type_class_add_private (object_class, sizeof (EmpathyChatPriv));
}
chat_window_icon_update (priv, TRUE);
}
+static void
+chat_window_command_part (EmpathyChat *chat,
+ GStrv strv)
+{
+ EmpathyChat *chat_to_be_parted;
+
+ if (strv[1] == NULL) {
+ empathy_tp_chat_leave (empathy_chat_get_tp_chat (chat), "");
+ return;
+ }
+ chat_to_be_parted = empathy_chat_window_find_chat (
+ empathy_chat_get_account (chat), strv[1]);
+
+ if (chat_to_be_parted != NULL) {
+ empathy_tp_chat_leave (empathy_chat_get_tp_chat (chat_to_be_parted),
+ strv[2]);
+ } else {
+ empathy_tp_chat_leave (empathy_chat_get_tp_chat (chat), strv[1]);
+ }
+}
+
static GtkNotebook *
notebook_create_window_cb (GtkNotebook *source,
GtkWidget *page,
g_signal_connect (chat, "new-message",
G_CALLBACK (chat_window_new_message_cb),
window);
+ g_signal_connect (chat, "part-command-entered",
+ G_CALLBACK (chat_window_command_part),
+ NULL);
g_signal_connect (chat, "notify::tp-chat",
G_CALLBACK (chat_window_update_chat_tab),
window);