diff options
Diffstat (limited to 'libempathy/empathy-tp-chat.c')
-rw-r--r-- | libempathy/empathy-tp-chat.c | 121 |
1 files changed, 74 insertions, 47 deletions
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index 430014759..34fcf64dc 100644 --- a/libempathy/empathy-tp-chat.c +++ b/libempathy/empathy-tp-chat.c @@ -796,7 +796,7 @@ tp_chat_channel_ready_cb (EmpathyTpChat *chat) } tp_cli_channel_type_text_call_list_pending_messages (priv->channel, -1, - priv->acknowledge, + FALSE, tp_chat_list_pending_messages_cb, NULL, NULL, G_OBJECT (chat)); @@ -1075,48 +1075,6 @@ empathy_tp_chat_new (TpChannel *channel, NULL); } -void -empathy_tp_chat_send (EmpathyTpChat *chat, - EmpathyMessage *message) -{ - EmpathyTpChatPriv *priv = GET_PRIV (chat); - const gchar *message_body; - EmpathyMessageType message_type; - - g_return_if_fail (EMPATHY_IS_TP_CHAT (chat)); - g_return_if_fail (EMPATHY_IS_MESSAGE (message)); - g_return_if_fail (priv->ready); - - message_body = empathy_message_get_body (message); - message_type = empathy_message_get_type (message); - - empathy_debug (DEBUG_DOMAIN, "Sending message: %s", message_body); - tp_cli_channel_type_text_call_send (priv->channel, -1, - message_type, - message_body, - tp_chat_async_cb, - "sending message", NULL, - G_OBJECT (chat)); -} - -void -empathy_tp_chat_set_state (EmpathyTpChat *chat, - TpChannelChatState state) -{ - EmpathyTpChatPriv *priv = GET_PRIV (chat); - - g_return_if_fail (EMPATHY_IS_TP_CHAT (chat)); - g_return_if_fail (priv->ready); - - empathy_debug (DEBUG_DOMAIN, "Set state: %d", state); - tp_cli_channel_interface_chat_state_call_set_chat_state (priv->channel, -1, - state, - tp_chat_async_cb, - "setting chat state", - NULL, - G_OBJECT (chat)); -} - const gchar * empathy_tp_chat_get_id (EmpathyTpChat *chat) { @@ -1138,6 +1096,16 @@ empathy_tp_chat_get_remote_contact (EmpathyTpChat *chat) return priv->remote_contact; } +McAccount * +empathy_tp_chat_get_account (EmpathyTpChat *chat) +{ + EmpathyTpChatPriv *priv = GET_PRIV (chat); + + g_return_val_if_fail (EMPATHY_IS_TP_CHAT (chat), FALSE); + + return priv->account; +} + gboolean empathy_tp_chat_is_ready (EmpathyTpChat *chat) { @@ -1158,13 +1126,72 @@ empathy_tp_chat_get_members_count (EmpathyTpChat *chat) return priv->members_count; } -McAccount * -empathy_tp_chat_get_account (EmpathyTpChat *chat) +void +empathy_tp_chat_set_acknowledge (EmpathyTpChat *chat, + gboolean acknowledge) { EmpathyTpChatPriv *priv = GET_PRIV (chat); - g_return_val_if_fail (EMPATHY_IS_TP_CHAT (chat), FALSE); + g_return_if_fail (EMPATHY_IS_TP_CHAT (chat)); - return priv->account; + priv->acknowledge = acknowledge; + g_object_notify (G_OBJECT (chat), "acknowledge"); +} + +void +empathy_tp_chat_emit_pendings (EmpathyTpChat *chat) +{ + EmpathyTpChatPriv *priv = GET_PRIV (chat); + + g_return_if_fail (EMPATHY_IS_TP_CHAT (chat)); + g_return_if_fail (priv->ready); + + tp_cli_channel_type_text_call_list_pending_messages (priv->channel, -1, + FALSE, + tp_chat_list_pending_messages_cb, + NULL, NULL, + G_OBJECT (chat)); +} + +void +empathy_tp_chat_send (EmpathyTpChat *chat, + EmpathyMessage *message) +{ + EmpathyTpChatPriv *priv = GET_PRIV (chat); + const gchar *message_body; + EmpathyMessageType message_type; + + g_return_if_fail (EMPATHY_IS_TP_CHAT (chat)); + g_return_if_fail (EMPATHY_IS_MESSAGE (message)); + g_return_if_fail (priv->ready); + + message_body = empathy_message_get_body (message); + message_type = empathy_message_get_type (message); + + empathy_debug (DEBUG_DOMAIN, "Sending message: %s", message_body); + tp_cli_channel_type_text_call_send (priv->channel, -1, + message_type, + message_body, + tp_chat_async_cb, + "sending message", NULL, + G_OBJECT (chat)); +} + +void +empathy_tp_chat_set_state (EmpathyTpChat *chat, + TpChannelChatState state) +{ + EmpathyTpChatPriv *priv = GET_PRIV (chat); + + g_return_if_fail (EMPATHY_IS_TP_CHAT (chat)); + g_return_if_fail (priv->ready); + + empathy_debug (DEBUG_DOMAIN, "Set state: %d", state); + tp_cli_channel_interface_chat_state_call_set_chat_state (priv->channel, -1, + state, + tp_chat_async_cb, + "setting chat state", + NULL, + G_OBJECT (chat)); } |