import asyncio, json from e2e import Client async def main(): alice = Client("alice@localhost", "alicepass") bob = Client("bob@localhost", "bobpass") await alice.login(); await bob.login() await alice.call("Notifications", "ajaxAdd", [{"searchjid": {"value": "bob@localhost"}, "alias": {"value": "Bob"}, "group": {"value": "Friends"}}]) await bob.recv_until(lambda m: m.get("func") == "Notifications.setCounters" and m["p"][0] not in ("", 0), timeout=10) print("bob got the request") await bob.call("Notifications", "ajaxAccept", ["alice@localhost"]) await asyncio.sleep(3) await alice.call("Search", "ajaxHttpInitRoster") m = await alice.recv_until(lambda m: m.get("func") == "MovimTpl.fill" and m["p"][0] == "#roster") print("alice roster has bob:", "bob@localhost" in m["p"][1], "online:", "status online" in m["p"][1]) asyncio.run(main())