diff --git a/telegram-purple.c b/telegram-purple.c index 4815c1a..ea5fd20 100755 --- a/telegram-purple.c +++ b/telegram-purple.c @@ -255,10 +255,8 @@ static void update_marked_read (struct tgl_state *TLS, int num, struct tgl_messa PurpleConversation *conv = p2tgl_find_conversation_with_account (TLS, to_id); if (conv) { conv = p2tgl_conversation_new (TLS, to_id); - gchar *who = p2tgl_strdup_id (to_id); - purple_conversation_write (conv, who, "Messages marked as read.", - PURPLE_MESSAGE_NO_LOG | PURPLE_MESSAGE_SYSTEM, time (NULL)); - g_free (who); + p2tgl_conversation_write (conv, to_id, "Messages marked as read.", + PURPLE_MESSAGE_NO_LOG | PURPLE_MESSAGE_SYSTEM, (int)time (NULL)); } } } diff --git a/tgp-2prpl.c b/tgp-2prpl.c index 80a8392..d45b5e6 100644 --- a/tgp-2prpl.c +++ b/tgp-2prpl.c @@ -127,7 +127,7 @@ void p2tgl_got_im_combo (struct tgl_state *TLS, tgl_peer_id_t who, const char *m /* Outgoing messages are not well supported in different libpurple clients, - p2tgl_conversation_write should have the best among different versions. Unfortunately + p2tgl_conv_im_write should have the best among different versions. Unfortunately this causes buggy formatting in Adium, so we don't use this workaround in that case. NOTE: Outgoing messages will not work in Adium <= 1.6.0, there is no way to print outgoing @@ -139,7 +139,7 @@ void p2tgl_got_im_combo (struct tgl_state *TLS, tgl_peer_id_t who, const char *m if (!conv) { conv = p2tgl_conversation_new(TLS, who); } - p2tgl_conversation_write (conv, who, msg, PURPLE_MESSAGE_SEND, when); + p2tgl_conv_im_write (conv, who, msg, PURPLE_MESSAGE_SEND, when); return; } #endif @@ -182,12 +182,19 @@ PurpleConversation *p2tgl_find_conversation_with_account (struct tgl_state *TLS, void p2tgl_conversation_write (PurpleConversation *conv, tgl_peer_id_t who, const char *message, int flags, int date) { char *name = p2tgl_strdup_id (who); - purple_conv_im_write(purple_conversation_get_im_data(conv), name, message, flags, date); - // purple_conversation_write (conv, name, message, flags, date); + purple_conversation_write (conv, name, message, flags, date); g_free (name); } +void p2tgl_conv_im_write (PurpleConversation *conv, tgl_peer_id_t who, const char *message, int flags, int date) { + char *name = p2tgl_strdup_id (who); + + purple_conv_im_write(purple_conversation_get_im_data(conv), name, message, flags, date); + + g_free (name); +} + PurpleConversation *p2tgl_conversation_new (struct tgl_state *TLS, tgl_peer_id_t who) { int type = tgl_get_peer_type (who) == TGL_PEER_CHAT ? PURPLE_CONV_TYPE_CHAT : PURPLE_CONV_TYPE_IM;