diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2009-03-06 19:52:01 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2009-03-06 19:52:01 +0800 |
commit | 80d1a3ed0b043624bf814fa6150bd22fedef80ad (patch) | |
tree | 526f3c4e1a798b412c636c78b1a532d624cd32ac /src/empathy.c | |
parent | 79697ab1fc4f90646bc3495514d6e30585a2f97f (diff) | |
download | gsoc2013-empathy-80d1a3ed0b043624bf814fa6150bd22fedef80ad.tar gsoc2013-empathy-80d1a3ed0b043624bf814fa6150bd22fedef80ad.tar.gz gsoc2013-empathy-80d1a3ed0b043624bf814fa6150bd22fedef80ad.tar.bz2 gsoc2013-empathy-80d1a3ed0b043624bf814fa6150bd22fedef80ad.tar.lz gsoc2013-empathy-80d1a3ed0b043624bf814fa6150bd22fedef80ad.tar.xz gsoc2013-empathy-80d1a3ed0b043624bf814fa6150bd22fedef80ad.tar.zst gsoc2013-empathy-80d1a3ed0b043624bf814fa6150bd22fedef80ad.zip |
Pass the channel to received_message_cb and use tp_channel_get_identifier.
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
svn path=/trunk/; revision=2591
Diffstat (limited to 'src/empathy.c')
-rw-r--r-- | src/empathy.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/empathy.c b/src/empathy.c index 9357b2cb7..5ad38a9e8 100644 --- a/src/empathy.c +++ b/src/empathy.c @@ -132,27 +132,29 @@ dispatch_cb (EmpathyDispatcher *dispatcher, static void received_message_cb (EmpathyTpChat *tp_chat, EmpathyMessage *message, - gboolean is_chatroom) + TpChannel *channel) { EmpathyLogManager *log_manager; - EmpathyContact *contact; GError *error = NULL; + TpHandleType handle_type; - contact = empathy_tp_chat_get_remote_contact (tp_chat); + tp_channel_get_handle (channel, &handle_type); log_manager = empathy_log_manager_dup_singleton (); if (!empathy_log_manager_add_message (log_manager, - empathy_contact_get_id (contact), - is_chatroom, + tp_channel_get_identifier (channel), + handle_type == TP_HANDLE_TYPE_ROOM, message, &error)) { DEBUG ("Failed to write message: %s", error ? error->message : "No error message"); - } + if (error) { + g_error_free (error); + } + } - g_object_unref (contact); g_object_unref (log_manager); } @@ -168,19 +170,14 @@ observe_cb (EmpathyDispatcher *dispatcher, if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_TEXT) { EmpathyTpChat *tp_chat; TpChannel *channel; - TpHandleType handle_type; - gboolean is_chatroom; tp_chat = EMPATHY_TP_CHAT ( empathy_dispatch_operation_get_channel_wrapper (operation)); channel = empathy_dispatch_operation_get_channel (operation); - tp_channel_get_handle (channel, &handle_type); - - is_chatroom = (handle_type == TP_HANDLE_TYPE_ROOM); g_signal_connect (tp_chat, "message-received", - G_CALLBACK (received_message_cb), GINT_TO_POINTER (is_chatroom)); + G_CALLBACK (received_message_cb), channel); } } |