Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/python-nbxmpp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorlovetox <philipp@hoerist.com>2020-02-23 17:30:10 +0300
committerlovetox <philipp@hoerist.com>2020-02-29 09:59:36 +0300
commitaca509f45842dc801bc0f74c89a9abb2bd36f229 (patch)
tree130f50b4736dfffb499f24ce912427dc51ff98b6 /doc
parent50fed1be6df30fa0bab14aa7eb2433a9ed42fbe3 (diff)
Remove modules
Diffstat (limited to 'doc')
-rw-r--r--doc/epydoc.conf26
-rwxr-xr-xdoc/examples/xsend.py158
2 files changed, 0 insertions, 184 deletions
diff --git a/doc/epydoc.conf b/doc/epydoc.conf
deleted file mode 100644
index 018bffb..0000000
--- a/doc/epydoc.conf
+++ /dev/null
@@ -1,26 +0,0 @@
-[epydoc]
-
-# Information about the project.
-name: python-nbxmpp
-url: http://python-nbxmpp.gajim.org
-
-verbosity: 3
-imports: yes
-redundant-details: yes
-docformat: restructuredtext
-
-# The list of modules to document. Modules can be named using
-# dotted names, module filenames, or package directory names.
-# This option may be repeated.
-modules: nbxmpp/*
-
-# Write html output to the directory "apidocs"
-output: html
-target: doc/apidocs/
-
-# Include all automatically generated graphs. These graphs are
-# generated using Graphviz dot.
-graph: all
-dotpath: /usr/bin/dot
-graph-font: Sans
-graph-font-size: 10
diff --git a/doc/examples/xsend.py b/doc/examples/xsend.py
deleted file mode 100755
index 743f191..0000000
--- a/doc/examples/xsend.py
+++ /dev/null
@@ -1,158 +0,0 @@
-#!/usr/bin/python3
-
-import sys
-import os
-import logging
-
-import nbxmpp
-from nbxmpp.const import Realm
-from nbxmpp.const import Event
-from gi.repository import GLib
-
-if sys.platform in ('win32', 'darwin'):
- import certifi
-
-consoleloghandler = logging.StreamHandler()
-log = logging.getLogger('nbxmpp')
-log.setLevel('INFO')
-log.addHandler(consoleloghandler)
-
-if len(sys.argv) < 2:
- print("Syntax: xsend JID text")
- sys.exit(0)
-
-to_jid = sys.argv[1]
-text = ' '.join(sys.argv[2:])
-
-jidparams = {}
-if os.access(os.environ['HOME'] + '/.xsend', os.R_OK):
- for ln in open(os.environ['HOME'] + '/.xsend').readlines():
- if not ln[0] in ('#', ';'):
- key, val = ln.strip().split('=', 1)
- jidparams[key.lower()] = val
-for mandatory in ['jid', 'password']:
- if mandatory not in jidparams.keys():
- open(os.environ['HOME']+'/.xsend','w').write('#Uncomment fields before use and type in correct credentials.\n#JID=romeo@montague.net/resource (/resource is optional)\n#PASSWORD=juliet\n')
- print('Please point ~/.xsend config file to valid JID for sending messages.')
- sys.exit(0)
-
-
-class Connection:
- def __init__(self):
- self.jid = nbxmpp.protocol.JID(jidparams['jid'])
- self.password = jidparams['password']
- self.client_cert = None
- self.idle_queue = nbxmpp.idlequeue.get_idlequeue()
- self.client = None
-
- def _on_auth_successful(self):
- print('authenticated')
- self.client.bind()
-
- def _on_connection_active(self):
- print('Connection active')
- self.client.RegisterHandler('message', self._on_message)
- self.send_presence()
-
- def _on_auth_failed(self, reason, text):
- log.debug("Couldn't authenticate")
- log.error(reason, text)
- exit()
-
- def _on_message(self, con, stanza):
- print('message received')
- print(stanza.getBody())
-
- def _on_connected(self, con, con_type):
- print('connected with ' + con_type)
- self.client.auth(self.jid.getNode(),
- get_password=self._get_password,
- resource=self.jid.getResource())
-
- def _get_password(self, mech, password_cb):
- password_cb(self.password)
-
- def _on_connection_failed(self):
- print('could not connect!')
-
- def _event_dispatcher(self, realm, event, data):
- if realm == Realm.CONNECTING:
- if event == Event.AUTH_SUCCESSFUL:
- log.info(event)
- self._on_auth_successful()
-
- elif event == Event.AUTH_FAILED:
- log.error(event)
- log.error(data)
- self._on_auth_failed(*data)
-
- elif event == Event.SESSION_FAILED:
- log.error(event)
-
- elif event == Event.BIND_FAILED:
- log.error(event)
-
- elif event == Event.CONNECTION_ACTIVE:
- log.info(event)
- self._on_connection_active()
- return
-
- def connect(self):
- cacerts = ''
- if sys.platform in ('win32', 'darwin'):
- cacerts = certifi.where()
-
- self.client = nbxmpp.NonBlockingClient(self.jid.getDomain(),
- self.idle_queue,
- caller=self)
-
- self.client.connect(self._on_connected,
- self._on_connection_failed,
- secure_tuple=('tls', cacerts, '', None, None, False))
-
- if sys.platform == 'win32':
- timeout, in_seconds = 20, None
- else:
- timeout, in_seconds = 100, False
-
- if in_seconds:
- GLib.timeout_add_seconds(timeout, self.process_connections)
- else:
- GLib.timeout_add(timeout, self.process_connections)
-
- def send_presence(self):
- presence = nbxmpp.Presence()
- self.client.send(presence)
-
- def quit(self):
- self.disconnect()
- ml.quit()
-
- def disconnect(self):
- self.client.start_disconnect()
-
- def process_connections(self):
- try:
- self.idle_queue.process()
- except Exception:
- # Otherwise, an exception will stop our loop
-
- if sys.platform == 'win32':
- # On Windows process() calls select.select(), so we need this
- # executed as often as possible.
- timeout, in_seconds = 1, None
- else:
- timeout, in_seconds = 100, False
-
- if in_seconds:
- GLib.timeout_add_seconds(timeout, self.process_connections)
- else:
- GLib.timeout_add(timeout, self.process_connections)
- raise
- return True # renew timeout (loop for ever)
-
-
-con = Connection()
-con.connect()
-ml = GLib.MainLoop()
-ml.run()