Add installation instruction file;
Order directories.
This commit is contained in:
parent
766e51af4c
commit
3ac005708d
49 changed files with 61 additions and 0 deletions
11
rivista/xmpp/instance.py
Normal file
11
rivista/xmpp/instance.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from slixmpp import ClientXMPP
|
||||
|
||||
class XmppInstance(ClientXMPP):
|
||||
def __init__(self, jid, password):
|
||||
super().__init__(jid, password)
|
||||
self.register_plugin('xep_0060')
|
||||
self.connect()
|
||||
# self.process(forever=False)
|
14
rivista/xmpp/utilities.py
Normal file
14
rivista/xmpp/utilities.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
class XmppUtilities:
|
||||
|
||||
def form_a_node_link(pubsub, node):
|
||||
link = 'xmpp:{pubsub}?;node={node}'.format(pubsub=pubsub, node=node)
|
||||
return link
|
||||
|
||||
def form_an_item_link(pubsub, node, item_id):
|
||||
link = 'xmpp:{pubsub}?;node={node};item={item}'.format(
|
||||
pubsub=pubsub, node=node, item=item_id)
|
||||
return link
|
27
rivista/xmpp/xep_0060.py
Normal file
27
rivista/xmpp/xep_0060.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from slixmpp.exceptions import IqError, IqTimeout
|
||||
|
||||
class XmppXep0060:
|
||||
|
||||
async def get_node_item(self, pubsub, node, item_id):
|
||||
try:
|
||||
iq = await self.plugin['xep_0060'].get_item(pubsub, node, item_id, timeout=5)
|
||||
return iq
|
||||
except (IqError, IqTimeout) as e:
|
||||
print(e)
|
||||
|
||||
async def get_node_items(self, pubsub, node):
|
||||
try:
|
||||
iq = await self.plugin['xep_0060'].get_items(pubsub, node, timeout=5)
|
||||
return iq
|
||||
except (IqError, IqTimeout) as e:
|
||||
print(e)
|
||||
|
||||
async def get_nodes(self, pubsub):
|
||||
try:
|
||||
iq = await self.plugin['xep_0060'].get_nodes(pubsub, timeout=5)
|
||||
return iq
|
||||
except (IqError, IqTimeout) as e:
|
||||
print(e)
|
Loading…
Add table
Add a link
Reference in a new issue