Skip to content

Commit

Permalink
chg: [MAS] Added subscription handlers for the probe agent.
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricbonhomme committed Dec 28, 2023
1 parent 1ee193c commit c74bdea
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions scandale/probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,26 @@ async def run(self):
# set exit_code for the behaviour
self.exit_code = 10

def on_subscribed(self, jid):
print(
"[{}] Agent {} has accepted the subscription.".format(
self.agent.name, jid.split("@")[0]
)
)
print(
"[{}] Contacts List: {}".format(
self.agent.name, self.agent.presence.get_contacts()
)
)

def on_subscribe(self, jid):
print(
"[{}] Agent {} asked for subscription. Let's aprove it.".format(
self.agent.name, jid.split("@")[0]
)
)
self.presence.approve(jid)

async def setup(self):
print("Agent starting . . .")

Expand Down

0 comments on commit c74bdea

Please sign in to comment.