aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-chat.c
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2011-05-18 13:56:40 +0800
committerDanielle Madeley <danielle.madeley@collabora.co.uk>2011-06-12 14:57:53 +0800
commit97efba6e5ce4eb5d85005281b2b8b0a95f8c0dd8 (patch)
treee9569caed40ef59a3f2e8d2ed5338976308791b7 /libempathy-gtk/empathy-chat.c
parenta4e44071b6bf128f4150a19e5b60975cae9218b2 (diff)
downloadgsoc2013-empathy-97efba6e5ce4eb5d85005281b2b8b0a95f8c0dd8.tar
gsoc2013-empathy-97efba6e5ce4eb5d85005281b2b8b0a95f8c0dd8.tar.gz
gsoc2013-empathy-97efba6e5ce4eb5d85005281b2b8b0a95f8c0dd8.tar.bz2
gsoc2013-empathy-97efba6e5ce4eb5d85005281b2b8b0a95f8c0dd8.tar.lz
gsoc2013-empathy-97efba6e5ce4eb5d85005281b2b8b0a95f8c0dd8.tar.xz
gsoc2013-empathy-97efba6e5ce4eb5d85005281b2b8b0a95f8c0dd8.tar.zst
gsoc2013-empathy-97efba6e5ce4eb5d85005281b2b8b0a95f8c0dd8.zip
Pass edited messages through to the ChatView
Diffstat (limited to 'libempathy-gtk/empathy-chat.c')
-rw-r--r--libempathy-gtk/empathy-chat.c43
1 files changed, 28 insertions, 15 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index 3c391c864..47f1e6815 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -1332,27 +1332,40 @@ chat_message_received (EmpathyChat *chat,
gboolean pending)
{
EmpathyChatPriv *priv = GET_PRIV (chat);
- EmpathyContact *sender;
- sender = empathy_message_get_sender (message);
+ if (empathy_message_is_edit (message)) {
+ DEBUG ("Editing message '%s' to '%s'",
+ empathy_message_get_supersedes (message),
+ empathy_message_get_body (message));
- DEBUG ("Appending new message from %s (%d)",
- empathy_contact_get_alias (sender),
- empathy_contact_get_handle (sender));
+ empathy_chat_view_edit_message (chat->view, message);
- empathy_chat_view_append_message (chat->view, message);
+ /* FIXME: do we need to do things like edit the chat state? */
+ } else {
+ EmpathyContact *sender;
- /* We received a message so the contact is no longer composing */
- chat_state_changed_cb (priv->tp_chat, sender,
- TP_CHANNEL_CHAT_STATE_ACTIVE,
- chat);
+ sender = empathy_message_get_sender (message);
- if (empathy_message_is_incoming (message)) {
- priv->unread_messages++;
- g_object_notify (G_OBJECT (chat), "nb-unread-messages");
- }
+ DEBUG ("Appending new message '%s' from %s (%d)",
+ empathy_message_get_token (message),
+ empathy_contact_get_alias (sender),
+ empathy_contact_get_handle (sender));
+
+ empathy_chat_view_append_message (chat->view, message);
- g_signal_emit (chat, signals[NEW_MESSAGE], 0, message, pending);
+ /* We received a message so the contact is no longer
+ * composing */
+ chat_state_changed_cb (priv->tp_chat, sender,
+ TP_CHANNEL_CHAT_STATE_ACTIVE,
+ chat);
+
+ if (empathy_message_is_incoming (message)) {
+ priv->unread_messages++;
+ g_object_notify (G_OBJECT (chat), "nb-unread-messages");
+ }
+
+ g_signal_emit (chat, signals[NEW_MESSAGE], 0, message, pending);
+ }
}
static void