comparison libervia/backend/plugins/plugin_xep_0033.py @ 4313:530f86f078cc

plugin XEP-0033: formatting.
author Goffi <goffi@goffi.org>
date Sat, 28 Sep 2024 15:52:14 +0200
parents 94e0968987cd
children
comparison
equal deleted inserted replaced
4312:e39c8e805488 4313:530f86f078cc
128 def check_minimal_data(self) -> Self: 128 def check_minimal_data(self) -> Self:
129 assert self.to or self.cc or self.bcc, "At least one recipent must be set" 129 assert self.to or self.cc or self.bcc, "At least one recipent must be set"
130 if self.noreply and (self.replyto is not None or self.replyroom is not None): 130 if self.noreply and (self.replyto is not None or self.replyroom is not None):
131 log.warning( 131 log.warning(
132 '"noreply" can\'t be used with "replyto" or "replyroom". Ignoring reply ' 132 '"noreply" can\'t be used with "replyto" or "replyroom". Ignoring reply '
133 f'fields ({self.replyto=}, {self.replyroom=}).' 133 f"fields ({self.replyto=}, {self.replyroom=})."
134 ) 134 )
135 # We reset instead of raising a ValueError, because this can happen in 135 # We reset instead of raising a ValueError, because this can happen in
136 # incoming messages and we should not discard them. 136 # incoming messages and we should not discard them.
137 self.replyto = self.replyroom = None 137 self.replyto = self.replyroom = None
138 return self 138 return self
514 514
515 post_treat.addCallback(post_treat_addr) 515 post_treat.addCallback(post_treat_addr)
516 return True 516 return True
517 517
518 def get_handler(self, client): 518 def get_handler(self, client):
519 return XEP_0033_handler(self, client.profile) 519 return XEP_0033_handler()
520 520
521 521
522 @implementer(iwokkel.IDisco) 522 @implementer(iwokkel.IDisco)
523 class XEP_0033_handler(XMPPHandler): 523 class XEP_0033_handler(XMPPHandler):
524
525 def __init__(self, plugin_parent, profile):
526 self.plugin_parent = plugin_parent
527 self.host = plugin_parent.host
528 self.profile = profile
529 524
530 def getDiscoInfo( 525 def getDiscoInfo(
531 self, requestor: jid.JID, target: jid.JID, nodeIdentifier: str = "" 526 self, requestor: jid.JID, target: jid.JID, nodeIdentifier: str = ""
532 ) -> list[disco.DiscoFeature]: 527 ) -> list[disco.DiscoFeature]:
533 return [disco.DiscoFeature(NS_ADDRESS)] 528 return [disco.DiscoFeature(NS_ADDRESS)]