Simplify PEP module inits
This commit is contained in:
parent
9d8b56bc0f
commit
c61bd65607
|
@ -58,11 +58,6 @@ class Atom(AbstractPEPModule):
|
|||
store_publish = False
|
||||
_log = log
|
||||
|
||||
def __init__(self, con):
|
||||
AbstractPEPModule.__init__(self, con, con.name)
|
||||
|
||||
self.handlers = []
|
||||
|
||||
def _extract_info(self, item):
|
||||
entry = item.getTag('entry', namespace=nbxmpp.NS_ATOM)
|
||||
if entry is None:
|
||||
|
|
|
@ -153,11 +153,11 @@ class AbstractPEPModule:
|
|||
store_publish = True
|
||||
_log = log
|
||||
|
||||
def __init__(self,
|
||||
con: ConnectionT,
|
||||
account: str) -> None:
|
||||
self._account = account
|
||||
def __init__(self, con: ConnectionT) -> None:
|
||||
self._con = con
|
||||
self._account = con.name
|
||||
|
||||
self.handlers = [] # type: List[Tuple[Any, ...]]
|
||||
|
||||
self._stored_publish = None
|
||||
|
||||
|
|
|
@ -30,9 +30,6 @@ class UserActivityData(AbstractPEPData):
|
|||
|
||||
type_ = PEPEventType.ACTIVITY
|
||||
|
||||
def __init__(self, activity):
|
||||
self.data = activity
|
||||
|
||||
def as_markup_text(self):
|
||||
pep = self.data
|
||||
activity = pep['activity']
|
||||
|
@ -62,11 +59,6 @@ class UserActivity(AbstractPEPModule):
|
|||
store_publish = True
|
||||
_log = log
|
||||
|
||||
def __init__(self, con):
|
||||
AbstractPEPModule.__init__(self, con, con.name)
|
||||
|
||||
self.handlers = []
|
||||
|
||||
def _extract_info(self, item):
|
||||
activity_dict = {}
|
||||
activity_tag = item.getTag('activity', namespace=self.namespace)
|
||||
|
|
|
@ -32,9 +32,6 @@ class UserAvatarData(AbstractPEPData):
|
|||
|
||||
type_ = PEPEventType.AVATAR
|
||||
|
||||
def __init__(self, avatar):
|
||||
self.data = avatar
|
||||
|
||||
|
||||
class UserAvatar(AbstractPEPModule):
|
||||
|
||||
|
@ -44,11 +41,6 @@ class UserAvatar(AbstractPEPModule):
|
|||
store_publish = False
|
||||
_log = log
|
||||
|
||||
def __init__(self, con):
|
||||
AbstractPEPModule.__init__(self, con, con.name)
|
||||
|
||||
self.handlers = []
|
||||
|
||||
def get_pubsub_avatar(self, jid, item_id):
|
||||
log.info('Request: %s %s', jid, item_id)
|
||||
self._con.get_module('PubSub').send_pb_retrieve(
|
||||
|
|
|
@ -30,11 +30,6 @@ class UserLocationData(AbstractPEPData):
|
|||
|
||||
type_ = PEPEventType.LOCATION
|
||||
|
||||
def __init__(self, location):
|
||||
# set_location plugin uses self._pep_specific_data
|
||||
self._pep_specific_data = location
|
||||
self.data = location
|
||||
|
||||
def as_markup_text(self):
|
||||
location = self.data
|
||||
location_string = ''
|
||||
|
@ -58,11 +53,6 @@ class UserLocation(AbstractPEPModule):
|
|||
store_publish = True
|
||||
_log = log
|
||||
|
||||
def __init__(self, con):
|
||||
AbstractPEPModule.__init__(self, con, con.name)
|
||||
|
||||
self.handlers = []
|
||||
|
||||
def _extract_info(self, item):
|
||||
location_dict = {}
|
||||
location_tag = item.getTag('geoloc', namespace=nbxmpp.NS_LOCATION)
|
||||
|
|
|
@ -37,9 +37,6 @@ class UserMoodData(AbstractPEPData):
|
|||
|
||||
type_ = PEPEventType.MOOD
|
||||
|
||||
def __init__(self, mood: Optional[Dict[str, str]]) -> None:
|
||||
self.data = mood
|
||||
|
||||
def as_markup_text(self) -> str:
|
||||
if self.data is None:
|
||||
return ''
|
||||
|
@ -65,11 +62,6 @@ class UserMood(AbstractPEPModule):
|
|||
store_publish = True
|
||||
_log = log
|
||||
|
||||
def __init__(self, con: ConnectionT) -> None:
|
||||
AbstractPEPModule.__init__(self, con, con.name)
|
||||
|
||||
self.handlers = [] # type: List[Tuple[Any, ...]]
|
||||
|
||||
def _extract_info(self, item: nbxmpp.Node) -> Optional[Dict[str, str]]:
|
||||
mood_dict = {}
|
||||
mood_tag = item.getTag('mood', namespace=nbxmpp.NS_MOOD)
|
||||
|
|
|
@ -36,9 +36,6 @@ class UserNicknameData(AbstractPEPData):
|
|||
|
||||
type_ = PEPEventType.NICKNAME
|
||||
|
||||
def __init__(self, nickname: Optional[str]) -> None:
|
||||
self.data = nickname
|
||||
|
||||
def get_nick(self) -> str:
|
||||
return self.data or ''
|
||||
|
||||
|
@ -51,11 +48,6 @@ class UserNickname(AbstractPEPModule):
|
|||
store_publish = True
|
||||
_log = log
|
||||
|
||||
def __init__(self, con: ConnectionT) -> None:
|
||||
AbstractPEPModule.__init__(self, con, con.name)
|
||||
|
||||
self.handlers = [] # type: List[Tuple[Any, ...]]
|
||||
|
||||
def _extract_info(self, item: nbxmpp.Node) -> Optional[str]:
|
||||
nick = ''
|
||||
child = item.getTag('nick', namespace=nbxmpp.NS_NICK)
|
||||
|
|
|
@ -39,9 +39,6 @@ class UserTuneData(AbstractPEPData):
|
|||
|
||||
type_ = PEPEventType.TUNE
|
||||
|
||||
def __init__(self, tune: Optional[Dict[str, str]]) -> None:
|
||||
self.data = tune
|
||||
|
||||
def as_markup_text(self) -> str:
|
||||
if self.data is None:
|
||||
return ''
|
||||
|
@ -72,11 +69,6 @@ class UserTune(AbstractPEPModule):
|
|||
store_publish = True
|
||||
_log = log
|
||||
|
||||
def __init__(self, con: ConnectionT) -> None:
|
||||
AbstractPEPModule.__init__(self, con, con.name)
|
||||
|
||||
self.handlers = [] # type: List[Tuple[Any, ...]]
|
||||
|
||||
def _extract_info(self, item: nbxmpp.Node) -> Optional[Dict[str, str]]:
|
||||
tune_dict = {}
|
||||
tune_tag = item.getTag('tune', namespace=self.namespace)
|
||||
|
|
Loading…
Reference in New Issue