2024-02-07 01:26:42 +01:00
|
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
NOTE
|
|
|
|
|
|
|
|
|
|
Accept symbols 🉑️ 👍️ ✍
|
|
|
|
|
|
2024-02-07 23:24:59 +01:00
|
|
|
|
TODO
|
|
|
|
|
|
2024-03-03 15:13:01 +01:00
|
|
|
|
Remove subscription from JID that do not (i.e. has stopped) share presence.
|
2024-02-07 23:24:59 +01:00
|
|
|
|
|
2024-02-07 01:26:42 +01:00
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
class XmppPresence:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def send(self, jid, status_message, presence_type=None, status_type=None):
|
2024-02-14 18:09:54 +01:00
|
|
|
|
jid_from = str(self.boundjid) if self.is_component else None
|
2024-02-07 01:26:42 +01:00
|
|
|
|
self.send_presence(pto=jid,
|
2024-02-14 18:09:54 +01:00
|
|
|
|
pfrom=jid_from,
|
2024-02-07 01:26:42 +01:00
|
|
|
|
pshow=status_type,
|
|
|
|
|
pstatus=status_message,
|
|
|
|
|
ptype=presence_type)
|
|
|
|
|
|
|
|
|
|
|
2024-02-07 23:24:59 +01:00
|
|
|
|
def subscription(self, jid, presence_type):
|
2024-02-07 01:26:42 +01:00
|
|
|
|
self.send_presence_subscription(pto=jid,
|
|
|
|
|
pfrom=self.boundjid.bare,
|
2024-02-07 23:24:59 +01:00
|
|
|
|
ptype=presence_type,
|
2024-02-07 01:26:42 +01:00
|
|
|
|
pnick=self.alias)
|