--- a/fix-receipts.diff Sun Oct 14 16:52:27 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +0,0 @@
-# HG changeset patch
-# Parent 99db5d4ed047b3dbe54727c1df311531f611f31f
-Fix receipts handling according to recent XEP updates
-
- * add lm_get_uid() @xmpp_helper.h
- * identify receipts by id attribute of 'received' subelement
- instead of stanza id
-
-diff -r 99db5d4ed047 mcabber/mcabber/hbuf.c
---- a/mcabber/mcabber/hbuf.c Thu Mar 01 20:18:00 2012 +0100
-+++ b/mcabber/mcabber/hbuf.c Mon Apr 30 23:10:28 2012 +0300
-@@ -525,7 +525,7 @@
- // hbuf_remove_receipt(hbuf, xep184)
- // Remove the Receipt Flag for the message with the given xep184 id
- // Returns TRUE if it was found and removed, otherwise FALSE
--gboolean hbuf_remove_receipt(GList *hbuf, gpointer xep184)
-+gboolean hbuf_remove_receipt(GList *hbuf, gconstpointer xep184)
- {
- hbuf_block *blk;
-
-@@ -533,7 +533,8 @@
-
- for ( ; hbuf; hbuf = g_list_previous(hbuf)) {
- blk = (hbuf_block*)(hbuf->data);
-- if (blk->prefix.xep184 == xep184) {
-+ if (!g_strcmp0 (blk->prefix.xep184, xep184)) {
-+ g_free (blk->prefix.xep184);
- blk->prefix.xep184 = NULL;
- blk->prefix.flags ^= HBB_PREFIX_RECEIPT;
- return TRUE;
-diff -r 99db5d4ed047 mcabber/mcabber/hbuf.h
---- a/mcabber/mcabber/hbuf.h Thu Mar 01 20:18:00 2012 +0100
-+++ b/mcabber/mcabber/hbuf.h Mon Apr 30 23:10:28 2012 +0300
-@@ -50,7 +50,7 @@
- GList *hbuf_jump_date(GList *hbuf, time_t t);
- GList *hbuf_jump_percent(GList *hbuf, int pc);
- GList *hbuf_jump_readmark(GList *hbuf);
--gboolean hbuf_remove_receipt(GList *hbuf, gpointer xep184);
-+gboolean hbuf_remove_receipt(GList *hbuf, gconstpointer xep184);
- void hbuf_set_readmark(GList *hbuf, gboolean action);
- void hbuf_remove_trailing_readmark(GList *hbuf);
-
-diff -r 99db5d4ed047 mcabber/mcabber/screen.c
---- a/mcabber/mcabber/screen.c Thu Mar 01 20:18:00 2012 +0100
-+++ b/mcabber/mcabber/screen.c Mon Apr 30 23:10:28 2012 +0300
-@@ -2239,7 +2239,7 @@
- scr_show_window(jidto, FALSE);
- }
-
--void scr_remove_receipt_flag(const char *bjid, gpointer xep184)
-+void scr_remove_receipt_flag(const char *bjid, gconstpointer xep184)
- {
- winbuf *win_entry = scr_search_window(bjid, FALSE);
- if (win_entry) {
-diff -r 99db5d4ed047 mcabber/mcabber/screen.h
---- a/mcabber/mcabber/screen.h Thu Mar 01 20:18:00 2012 +0100
-+++ b/mcabber/mcabber/screen.h Mon Apr 30 23:10:28 2012 +0300
-@@ -108,7 +108,7 @@
- void scr_update_main_status(int forceupdate);
- void scr_update_chat_status(int forceupdate);
- void scr_roster_visibility(int status);
--void scr_remove_receipt_flag(const char *jidto, gpointer xep184);
-+void scr_remove_receipt_flag(const char *jidto, gconstpointer xep184);
- void scr_show_buddy_window(void);
- int scr_buddy_buffer_exists(const char *jid);
- void scr_update_buddy_window(void);
-diff -r 99db5d4ed047 mcabber/mcabber/xmpp.c
---- a/mcabber/mcabber/xmpp.c Thu Mar 01 20:18:00 2012 +0100
-+++ b/mcabber/mcabber/xmpp.c Mon Apr 30 23:10:28 2012 +0300
-@@ -295,15 +295,6 @@
- g_slist_free(resources);
- }
-
--static LmHandlerResult cb_xep184(LmMessageHandler *h, LmConnection *c,
-- LmMessage *m, gpointer user_data)
--{
-- char *from = jidtodisp(lm_message_get_from(m));
-- scr_remove_receipt_flag(from, h);
-- g_free(from);
-- return LM_HANDLER_RESULT_REMOVE_MESSAGE;
--}
--
- // xmpp_send_msg(jid, text, type, subject,
- // otrinject, *encrypted, type_overwrite)
- // When encrypted is not NULL, the function set *encrypted to 1 if the
-@@ -432,7 +423,8 @@
- lm_message_node_set_attribute
- (lm_message_node_add_child(x->node, "request", NULL),
- "xmlns", NS_RECEIPTS);
-- *xep184 = lm_message_handler_new(cb_xep184, NULL, NULL);
-+ *xep184 = lm_get_uid ();
-+ lm_message_node_set_attribute (x->node, "id", (const gchar *)*xep184);
- }
- g_free(barejid);
-
-@@ -499,11 +491,7 @@
- if (mystatus != invisible)
- #endif
- update_last_use();
-- if (xep184 && *xep184) {
-- lm_connection_send_with_reply(lconnection, x, *xep184, NULL);
-- lm_message_handler_unref(*xep184);
-- } else
-- lm_connection_send(lconnection, x, NULL);
-+ lm_connection_send(lconnection, x, NULL);
- lm_message_unref(x);
- }
-
-@@ -1305,6 +1293,16 @@
- lm_message_unref(rcvd);
- }
-
-+ { // xep184 receipt confirmation
-+ LmMessageNode *received = lm_message_node_get_child (m->node, "received");
-+ if (received && !g_strcmp0 (lm_message_node_get_attribute (received, "xmlns"), NS_RECEIPTS)) {
-+ char *jid = jidtodisp(from);
-+ const char *id = lm_message_node_get_attribute (received, "id");
-+ scr_remove_receipt_flag(jid, id);
-+ g_free(jid);
-+ }
-+ }
-+
- if (from) {
- x = lm_message_node_find_xmlns(m->node, NS_MUC_USER);
- if (x && !strcmp(x->name, "x"))
-diff -r 99db5d4ed047 mcabber/mcabber/xmpp_helper.c
---- a/mcabber/mcabber/xmpp_helper.c Thu Mar 01 20:18:00 2012 +0100
-+++ b/mcabber/mcabber/xmpp_helper.c Mon Apr 30 23:10:28 2012 +0300
-@@ -72,7 +72,6 @@
- {0, NULL, NULL, NULL, NULL}
- };
-
--
- #ifdef MODULES_ENABLE
- static GSList *xmpp_additional_features = NULL;
- static char *ver, *ver_notavail;
-@@ -104,6 +103,13 @@
- }
- #endif
-
-+// The caller must g_free this after use
-+gchar *lm_get_uid ()
-+{
-+ static guint xmpp_uid = 0;
-+ return g_strdup_printf ("mc%u", ++xmpp_uid);
-+}
-+
- const gchar* lm_message_node_get_child_value(LmMessageNode *node,
- const gchar *child)
- {
-diff -r 99db5d4ed047 mcabber/mcabber/xmpp_helper.h
---- a/mcabber/mcabber/xmpp_helper.h Thu Mar 01 20:18:00 2012 +0100
-+++ b/mcabber/mcabber/xmpp_helper.h Mon Apr 30 23:10:28 2012 +0300
-@@ -29,6 +29,8 @@
- void xmpp_del_feature (const char *xmlns);
- #endif
-
-+gchar *lm_get_uid (void);
-+
- LmMessageNode *lm_message_node_new(const gchar *name, const gchar *xmlns);
- LmMessageNode *lm_message_node_find_xmlns(LmMessageNode *node,
- const char *xmlns);