plugin events: fixed invitation + set name and thumb_url from event element
This commit is contained in:
parent
56c14723df
commit
ff1a025650
2 changed files with 17 additions and 10 deletions
|
|
@ -143,7 +143,7 @@ class Events(object):
|
|||
"""Helper method to parse event element
|
||||
|
||||
@param (domish.Element): event_elt
|
||||
@return (tupple[int, dict[unicode, unicode]): timestamp, event_data
|
||||
@return (tuple[int, dict[unicode, unicode]): timestamp, event_data
|
||||
"""
|
||||
try:
|
||||
timestamp = date_utils.date_parse(next(event_elt.elements(NS_EVENT, "date")))
|
||||
|
|
@ -232,9 +232,9 @@ class Events(object):
|
|||
raise exceptions.NotFound(_(u"No event with this id has been found"))
|
||||
defer.returnValue(event_elt)
|
||||
|
||||
def register(self, client, name, extra, service, node, event_id, event_elt,
|
||||
def register(self, client, name, extra, service, node, event_id, item_elt,
|
||||
creator=False):
|
||||
"""register evenement in personal events list
|
||||
"""Register evenement in personal events list
|
||||
|
||||
@param service(jid.JID): pubsub service of the event
|
||||
@param node(unicode): event node
|
||||
|
|
@ -243,14 +243,20 @@ class Events(object):
|
|||
note that this element will be modified in place
|
||||
@param creator(bool): True if client's profile is the creator of the node
|
||||
"""
|
||||
# FIXME: name and extra are unused
|
||||
event_elt = item_elt.event
|
||||
link_elt = event_elt.addElement("link")
|
||||
link_elt["service"] = service.full()
|
||||
link_elt["node"] = node
|
||||
link_elt["item"] = event_id
|
||||
__, event_data = self._parseEventElt(event_elt)
|
||||
name = event_data.get(u'name')
|
||||
if u'image' in event_data:
|
||||
extra = {u'thumb_url': event_data[u'image']}
|
||||
else:
|
||||
extra = None
|
||||
return self.host.plugins[u'LIST_INTEREST'].registerPubsub(
|
||||
client, NS_EVENT, service, node, event_id, creator,
|
||||
element=event_elt)
|
||||
name=name, element=event_elt, extra=extra)
|
||||
|
||||
def _eventGet(self, service, node, id_=u"", profile_key=C.PROF_KEY_NONE):
|
||||
service = jid.JID(service) if service else None
|
||||
|
|
@ -431,9 +437,10 @@ class Events(object):
|
|||
for item in items:
|
||||
try:
|
||||
event_elt = next(item.interest.pubsub.elements(NS_EVENT, u"event"))
|
||||
except IndexError:
|
||||
except StopIteration:
|
||||
log.warning(
|
||||
_(u"No event found in item {item_id}").format(item_id=item["id"])
|
||||
_(u"No event found in item {item_id}, ignoring").format(
|
||||
item_id=item["id"])
|
||||
)
|
||||
else:
|
||||
timestamp, data = self._parseEventElt(event_elt)
|
||||
|
|
@ -595,9 +602,9 @@ class Events(object):
|
|||
log.debug(_(u"affiliation set on blog and comments nodes"))
|
||||
|
||||
# now we send the invitation
|
||||
pubsub_invitation = self.host.plugins[u'PUBSUB_INVITATION']
|
||||
pubsub_invitation = self.host.plugins[u'INVITATION']
|
||||
pubsub_invitation.sendPubsubInvitation(client, invitee_jid, service, node,
|
||||
item_id, name, extra)
|
||||
item_id, name, extra)
|
||||
|
||||
def _inviteByEmail(self, service, node, id_=NS_EVENT, email=u"", emails_extra=None,
|
||||
name=u"", host_name=u"", language=u"", url_template=u"",
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ class Invitation(object):
|
|||
return mess_data, invitation_elt
|
||||
|
||||
def sendPubsubInvitation(self, client, invitee_jid, service, node,
|
||||
item_id, name, extra):
|
||||
item_id, name, extra):
|
||||
"""Send an pubsub invitation in a <message> stanza
|
||||
|
||||
@param invitee_jid(jid.JID): entitee to send invitation to
|
||||
|
|
|
|||
Loading…
Reference in a new issue