From 8520bc8c18dd377137b95e382e183127ea64e273 Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Thu, 18 Aug 2011 19:03:31 +0200
Subject: [PATCH] do not set an id when we publish a new item on pubsub. Fixes
 #6947

---
 src/common/pubsub.py | 7 +++++--
 src/groups.py        | 1 -
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/common/pubsub.py b/src/common/pubsub.py
index 50a69928bb..2779265994 100644
--- a/src/common/pubsub.py
+++ b/src/common/pubsub.py
@@ -76,7 +76,7 @@ class ConnectionPubSub:
 
         self.__callbacks[id_] = (cb, args, kwargs)
 
-    def send_pb_publish(self, jid, node, item, id_, options=None):
+    def send_pb_publish(self, jid, node, item, id_=None, options=None):
         """
         Publish item to a node
         """
@@ -85,7 +85,10 @@ class ConnectionPubSub:
         query = xmpp.Iq('set', to=jid)
         e = query.addChild('pubsub', namespace=xmpp.NS_PUBSUB)
         p = e.addChild('publish', {'node': node})
-        p.addChild('item', {'id': id_}, [item])
+        attrs = {}
+        if id_:
+            attrs = {'id': id_}
+        p.addChild('item', attrs, [item])
         if options:
             p = e.addChild('publish-options')
             p.addChild(node=options)
diff --git a/src/groups.py b/src/groups.py
index f38cce2381..422950f585 100644
--- a/src/groups.py
+++ b/src/groups.py
@@ -61,7 +61,6 @@ class GroupsPostWindow:
         author.addChild('name', {}, [self.from_entry.get_text()])
         item.addChild('generator', {}, ['Gajim'])
         item.addChild('title', {}, [self.subject_entry.get_text()])
-        item.addChild('id', {}, ['0'])
 
         buf = self.contents_textview.get_buffer()
         item.addChild('content', {}, [buf.get_text(buf.get_start_iter(), buf.get_end_iter())])
-- 
GitLab