Skip to content

Latest commit

 

History

History
151 lines (100 loc) · 3.27 KB

README.md

File metadata and controls

151 lines (100 loc) · 3.27 KB

xmppy

tag commit license

status status

The repository is no longer being developed

Python module for receiving and sending message using XMPP protocol.

Requires python >=3.8, <3.10

Attention: Module DO NOT provide any layers of encryption. You use it at your own risk.

Repos: GitHub GitLab


Table of Contents


Installation

From source

# using poetry
user@host:~$ poetry install 
# using pip
user@host:~$ pip install .

Using pip

user@host:~$ pip install xmppy

AUR (TODO)

user@host:~$ makepkg xmppy

Usage

Sending and receiving messages

example 1

(using classmethod)

import xmppy.Messenger as xb
import subprocess as sp

def monitor():
	return "Example message"

def reply(msg):
	return sp.check_output(msg, shell=True).decode()

#send monitor() every 60 seconds and keep receiving reply()
Client = xb.Client.initialize("[email protected]", "password",
				"[email protected]", monitor, reply, freq=60)

example 1

example 2

(only sending messages)

#send one message (for looping add freq param)
Client = xb.Client.sendMessage("[email protected]", "password",
						"[email protected]", monitor)

example 3

(only receiving messages)

Client = xb.Client.receiveMessage("[email protected]", "password", reply)

Data input

Instead od entering data as parameters xmppy.Client("jid","pass","recipient"...) you can use .ini file:

#example.ini
[configfile]
jid = [email protected]
password = qwerty123
# recipient input is optional.
# In order to use entry below you should mark recipient as None in Client constructor
# i.e. xmppy.Client("file", "example.ini", None, ...) Otherwise, this input will be ignored.
recipient = [email protected]

and change function call from .Client("[email protected]", "password", "[email protected]", ...) to .Client("file", "<.ini file>", <None or [email protected]>, ...). Feature works with all calls from examples (1,2,3).

Console script

user@host:~$ xmppy -j <Jabber ID> -p <password> -t <recipient> -m <message>

Encryption

GPG

(in progress...)

Client = xb.Client.initialize("[email protected]", "password",
				"[email protected]", monitor, reply, freq=60, wait=True)
#temporarily doesn't support signing and receiving encrypted messages TODO!
Client.enableGPG("UID", "gnupghome_dir")

Client.run(wait=False)

OMEMO

TODO!