Friday, April 03, 2026
lighthouse@conference.lightwitch.org
April
Mon Tue Wed Thu Fri Sat Sun
    1
2
3
4
5
6
7
8 9
10
11
12
13
14 15 16
17
18
19
20 21 22 23 24 25 26
27 28 29 30      
             
Aria Network's and LW.Org main lounge - join, have a look, share your day.

See our sites:
==========================
Aria Network - https://aria-net.org
LW.Org - https://lightwitch.org

This room is on Matrix (https://matrix.to/#/#lighthouse:aria-net.org) and XMPP

[11:46:00] <duck.001> hello :)
[11:58:01] <duck.001> Claude: What's your name?
[11:58:24] <Claude> duck.001: I'm Claude, an AI assistant created by Anthropic.
[12:02:36] <saklas> Claude, write an XMPP client
[12:03:26] <Claude> saklas: Вот простой XMPP-клиент на Python с использованием библиотеки `slixmpp`:

```bash
pip install slixmpp
```

*xmpp_client.py:*

```python
import asyncio
import logging
import sys
from slixmpp import ClientXMPP

logging.basicConfig(level=logging.INFO)

class SimpleXMPPClient(ClientXMPP):
def *init*(self, jid, password):
super().*init*(jid, password)

self.add_event_handler("session_start", self._on_session_start)
self.add_event_handler("message", self._on_message)

async def _on_session_start(self, event):
await self.send_presence()
roster = await self.get_roster()
print("=== Roster ===")
for contact in roster:
print(f" {contact}")
print("===============")
print("Client ready. Type messages or use .quit to exit.")

async def _on_message(self, msg):
if msg["type"] in ("chat", "normal") and msg["body"]:
print(f"\n[{msg['from']}] {msg['body']}")
print("> ", end="", flush=True)

async def send_msg(self, to, body):
msg = self.make_message(mto=to, mbody=body, mtype="chat")
await msg.send()

async def run(self):
await self.connect()
await self.process(forever=False)

loop = asyncio.get_event_loop()
reader = asyncio.StreamReader()
protocol = asyncio.StreamReaderProtocol(reader)
await loop.connect_read_pipe(lambda: protocol, sys.stdin)

while True:
line = (await reader.readline()).decode().strip()
if not line:
continue
if line == ".quit":
break
parts = line.split(" ", 1)
if len(parts) == 2:
to, body = parts
await self.send_msg(to, body)
else:
print("Usage: <jid> <message>")

await self.disconnect()


async def main():
jid = input("JID (user@domain): ")
password = input("Password: ")

client = SimpleXMPPClient(jid, password)
await client.run()


if *name* == "*main*":
asyncio.run(main())
```

*Использование:*
- Запустите скрипт, введите JID и пароль
- Отправка: `user@example.com Привет!`
- Выход: `.quit`

*Возможности:*
- Подключение и авторизация
- Отображение ростера (контактов)
- Отправка и получение сообщений
- Асинхронная работа через `asyncio`
[20:20:53] <Ettacent> Claude: test
[20:21:28] <Claude> Ettacent: Тест прошёл успешно! Я на связи. Чем могу помочь?