wnox 0.7.0__py3-none-any.whl → 0.8.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- wnox/__init__.py +25 -7
- {wnox-0.7.0.dist-info → wnox-0.8.0.dist-info}/METADATA +1 -1
- wnox-0.8.0.dist-info/RECORD +6 -0
- wnox-0.7.0.dist-info/RECORD +0 -6
- {wnox-0.7.0.dist-info → wnox-0.8.0.dist-info}/LICENSE.txt +0 -0
- {wnox-0.7.0.dist-info → wnox-0.8.0.dist-info}/WHEEL +0 -0
- {wnox-0.7.0.dist-info → wnox-0.8.0.dist-info}/top_level.txt +0 -0
wnox/__init__.py
CHANGED
@@ -62,7 +62,7 @@ class WSX(ClientXMPP, EventEmitter):
|
|
62
62
|
print("[bridge] connected.")
|
63
63
|
self.send_presence(ptype="presence")
|
64
64
|
await self.get_roster()
|
65
|
-
await self.emit("
|
65
|
+
await self.emit("__connect",{})
|
66
66
|
self.connected = True
|
67
67
|
|
68
68
|
|
@@ -71,7 +71,7 @@ class WSX(ClientXMPP, EventEmitter):
|
|
71
71
|
|
72
72
|
async def on_disconnect(self, event):
|
73
73
|
"""Handle disconnection and attempt reconnection."""
|
74
|
-
await self.emit("
|
74
|
+
await self.emit("__disconnect",{})
|
75
75
|
self.connected = False
|
76
76
|
asyncio.create_task(self.reconnect())
|
77
77
|
|
@@ -95,17 +95,27 @@ class WSX(ClientXMPP, EventEmitter):
|
|
95
95
|
delayed = "urn:xmpp:delay" in str(stanza)
|
96
96
|
|
97
97
|
if body and not delayed:
|
98
|
-
|
98
|
+
|
99
99
|
|
100
100
|
if body.startswith("{"):
|
101
101
|
try:
|
102
102
|
json_data = json.loads(body)
|
103
|
+
if "__connect" in json_data:
|
104
|
+
return
|
105
|
+
if "__disconnect" in json_data:
|
106
|
+
return
|
107
|
+
if "__message" in json_data:
|
108
|
+
return
|
109
|
+
|
103
110
|
if "api" in json_data:
|
111
|
+
user_uid = from_jid.split('@')[0]
|
104
112
|
data = {key: val for key, val in json_data.items() if key != "api"}
|
105
113
|
data = {key: val for key, val in data.items() if key != "mid"}
|
106
114
|
data["from"] = from_jid
|
107
|
-
|
108
|
-
if
|
115
|
+
data["app"] = None
|
116
|
+
if len(user_uid) == 24 and ObjectId.is_valid(user_uid):
|
117
|
+
data["uid"] = user_uid
|
118
|
+
data["app"] = None
|
109
119
|
result = await self.emit(json_data["api"], data)
|
110
120
|
if result == None:
|
111
121
|
result = {}
|
@@ -113,6 +123,14 @@ class WSX(ClientXMPP, EventEmitter):
|
|
113
123
|
mto=from_jid,
|
114
124
|
mbody=json.dumps({**result, "mid": json_data.get("mid")})
|
115
125
|
)
|
126
|
+
elif "conference.qepal.com" in from_jid:
|
127
|
+
pass
|
128
|
+
elif "-" in user_uid:
|
129
|
+
app = user_uid.split('-')[0]
|
130
|
+
user_uid = user_uid.split('-')[1]
|
131
|
+
data["app"] = app
|
132
|
+
data["uid"] = user_uid
|
133
|
+
|
116
134
|
else:
|
117
135
|
if "mid" in json_data:
|
118
136
|
data = {key: val for key, val in json_data.items() if key != "mid"}
|
@@ -120,12 +138,12 @@ class WSX(ClientXMPP, EventEmitter):
|
|
120
138
|
if json_data.get("mid") in eventsx:
|
121
139
|
eventsx.get(json_data.get("mid")).set()
|
122
140
|
else:
|
123
|
-
await self.emit("
|
141
|
+
await self.emit("__message", {"from": from_jid, "body": body, "itsme": itsme, "itsbro": itsbro})
|
124
142
|
|
125
143
|
except json.JSONDecodeError:
|
126
144
|
pass
|
127
145
|
else:
|
128
|
-
await self.emit("
|
146
|
+
await self.emit("__message", {"from": from_jid, "body": body, "itsme": itsme, "itsbro": itsbro})
|
129
147
|
|
130
148
|
|
131
149
|
|
@@ -0,0 +1,6 @@
|
|
1
|
+
wnox/__init__.py,sha256=-KFTQUn3x8ZUHhBSt7Tj1kIbbwZLVHmIs2zCZKF73S0,9200
|
2
|
+
wnox-0.8.0.dist-info/LICENSE.txt,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
+
wnox-0.8.0.dist-info/METADATA,sha256=eC8xu1ocMpVAPcosBDam9FS81O0IUZlKO9tArQC-sUc,805
|
4
|
+
wnox-0.8.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
5
|
+
wnox-0.8.0.dist-info/top_level.txt,sha256=Xm9SC1bx_o6zjvo2FI-3QiZX2PZ_0UBQkGlvfYsnkwc,5
|
6
|
+
wnox-0.8.0.dist-info/RECORD,,
|
wnox-0.7.0.dist-info/RECORD
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
wnox/__init__.py,sha256=0A8ZDb2AIEno90-9dYpcgWrbBfObb6PJ1xotKJFbs-g,8315
|
2
|
-
wnox-0.7.0.dist-info/LICENSE.txt,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
-
wnox-0.7.0.dist-info/METADATA,sha256=I-B2nqRwQCDlNJdPbnG4L2XXR-zZh813VyojTDGYHIM,805
|
4
|
-
wnox-0.7.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
5
|
-
wnox-0.7.0.dist-info/top_level.txt,sha256=Xm9SC1bx_o6zjvo2FI-3QiZX2PZ_0UBQkGlvfYsnkwc,5
|
6
|
-
wnox-0.7.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|