Skip to content
Snippets Groups Projects
Commit abcb48d1 authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

improve pubsub support. fixes #3103

parent fc153017
No related branches found
No related tags found
No related merge requests found
...@@ -63,10 +63,11 @@ class OldEntry(xmpp.Node, object): ...@@ -63,10 +63,11 @@ class OldEntry(xmpp.Node, object):
else: else:
main_feed = None main_feed = None
if self.getTag('source-feed') is not None: if self.getTag('feed') is not None:
source_feed = self.getTag('source-feed').getTagData('title') source_feed = self.getTag('feed').getTagData('title')
else: else:
source_feed = None source_feed = None
if main_feed is not None and source_feed is not None: if main_feed is not None and source_feed is not None:
return u'%s: %s' % (main_feed, source_feed) return u'%s: %s' % (main_feed, source_feed)
...@@ -78,14 +79,13 @@ class OldEntry(xmpp.Node, object): ...@@ -78,14 +79,13 @@ class OldEntry(xmpp.Node, object):
return u'' return u''
feed_title = property(get_feed_title, None, None, feed_title = property(get_feed_title, None, None,
''' Title of feed. It is built from entry's original feed title and title of feed ''' Title of feed. It is built from entry''s original feed title and title of feed
which delivered this entry. ''') which delivered this entry. ''')
def get_feed_link(self): def get_feed_link(self):
''' Get a link to main page of feed (in pubsub.com: second link of rel='alternate', ''' Get source link '''
first contains raw xml data). '''
try: try:
return self.getTag('source-feed').getTags('link', {'rel':'alternate'})[1].getData() return self.getTag('feed').getTags('link',{'rel':'alternate'})[1].getData()
except: except:
return None return None
......
...@@ -1557,20 +1557,13 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco, ...@@ -1557,20 +1557,13 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
if items is None: return if items is None: return
for item in items.getTags('item'): for item in items.getTags('item'):
# check for event type (for now only one type supported: pubsub.com events) entry = item.getTag('entry')
child = item.getTag('pubsub-message') if entry is not None:
if child is not None: # for each entry in feed (there shouldn't be more than one,
# we have pubsub.com notification # but to be sure...
child = child.getTag('feed') self.dispatch('ATOM_ENTRY', (atom.OldEntry(node=entry),))
if child is None: continue
for entry in child.getTags('entry'):
# for each entry in feed (there shouldn't be more than one,
# but to be sure...
self.dispatch('ATOM_ENTRY', (atom.OldEntry(node=entry),))
continue continue
# unknown type... probably user has another client who understands that event # unknown type... probably user has another client who understands that event
raise common.xmpp.NodeProcessed raise common.xmpp.NodeProcessed
def _presenceCB(self, con, prs): def _presenceCB(self, con, prs):
......
...@@ -76,7 +76,7 @@ def _gen_agent_type_info(): ...@@ -76,7 +76,7 @@ def _gen_agent_type_info():
('_jid', 'weather'): (False, 'weather.png'), ('_jid', 'weather'): (False, 'weather.png'),
('gateway', 'sip'): (False, 'sip.png'), ('gateway', 'sip'): (False, 'sip.png'),
('directory', 'user'): (None, 'jud.png'), ('directory', 'user'): (None, 'jud.png'),
('pubsub', 'generic'): (None, 'pubsub.png'), ('pubsub', 'generic'): (PubSubBrowser, 'pubsub.png'),
('pubsub', 'service'): (PubSubBrowser, 'pubsub.png'), ('pubsub', 'service'): (PubSubBrowser, 'pubsub.png'),
('proxy', 'bytestreams'): (None, 'bytestreams.png'), # Socks5 FT proxy ('proxy', 'bytestreams'): (None, 'bytestreams.png'), # Socks5 FT proxy
...@@ -1792,7 +1792,8 @@ class DiscussionGroupsBrowser(AgentBrowser): ...@@ -1792,7 +1792,8 @@ class DiscussionGroupsBrowser(AgentBrowser):
''' Create treemodel for the window. ''' ''' Create treemodel for the window. '''
# JID, node, name (with description) - pango markup, dont have info?, subscribed? # JID, node, name (with description) - pango markup, dont have info?, subscribed?
self.model = gtk.ListStore(str, str, str, bool, bool) self.model = gtk.ListStore(str, str, str, bool, bool)
self.model.set_sort_column_id(3, gtk.SORT_ASCENDING) # sort by name
self.model.set_sort_column_id(2, gtk.SORT_ASCENDING)
self.window.services_treeview.set_model(self.model) self.window.services_treeview.set_model(self.model)
# Name column # Name column
...@@ -1803,7 +1804,8 @@ class DiscussionGroupsBrowser(AgentBrowser): ...@@ -1803,7 +1804,8 @@ class DiscussionGroupsBrowser(AgentBrowser):
col.pack_start(renderer) col.pack_start(renderer)
col.set_attributes(renderer, markup=2) col.set_attributes(renderer, markup=2)
col.set_resizable(True) col.set_resizable(True)
self.window.services_treeview.insert_column(col, -1) self.window.services_treeview.insert_column(col, -1)
self.window.services_treeview.set_headers_visible(True)
# Subscription state # Subscription state
renderer = gtk.CellRendererToggle() renderer = gtk.CellRendererToggle()
...@@ -1813,7 +1815,13 @@ class DiscussionGroupsBrowser(AgentBrowser): ...@@ -1813,7 +1815,13 @@ class DiscussionGroupsBrowser(AgentBrowser):
col.set_resizable(False) col.set_resizable(False)
self.window.services_treeview.insert_column(col, -1) self.window.services_treeview.insert_column(col, -1)
self.window.services_treeview.set_headers_visible(True) # Node Column
renderer = gtk.CellRendererText()
col = gtk.TreeViewColumn(_('Node'))
col.pack_start(renderer)
col.set_attributes(renderer, markup=1)
col.set_resizable(True)
self.window.services_treeview.insert_column(col, -1)
def _add_item(self, jid, node, item, force): def _add_item(self, jid, node, item, force):
''' Called when we got basic information about new node from query. ''' Called when we got basic information about new node from query.
...@@ -1829,7 +1837,7 @@ class DiscussionGroupsBrowser(AgentBrowser): ...@@ -1829,7 +1837,7 @@ class DiscussionGroupsBrowser(AgentBrowser):
name = gobject.markup_escape_text(name) name = gobject.markup_escape_text(name)
name = '<b>%s</b>' % name name = '<b>%s</b>' % name
self.model.append((jid, node, name, dunno, subscribed)) self.model.append((jid, node, name, dunno, subscribed))
def _add_actions(self): def _add_actions(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment