diff options
author | Link Mauve <linkmauve@linkmauve.fr> | 2020-12-10 19:45:30 +0100 |
---|---|---|
committer | Link Mauve <linkmauve@linkmauve.fr> | 2020-12-10 19:45:30 +0100 |
commit | 1e2d15b8f58249b31dd5882772d58add1369fc37 (patch) | |
tree | 6d39e5fc8241884acf30b209a07ef4cabd80c323 /docs/howto | |
parent | d37182804102682a715df43c48a6d874835cd71a (diff) | |
parent | 155fc58a22d631746436a81119a94c80d6ea2d2b (diff) | |
download | slixmpp-1e2d15b8f58249b31dd5882772d58add1369fc37.tar.gz slixmpp-1e2d15b8f58249b31dd5882772d58add1369fc37.tar.bz2 slixmpp-1e2d15b8f58249b31dd5882772d58add1369fc37.tar.xz slixmpp-1e2d15b8f58249b31dd5882772d58add1369fc37.zip |
Merge branch 'docs-event-sphinx-plugins' into 'master'
Docs: add more events, add plugins to the doc
See merge request poezio/slixmpp!84
Diffstat (limited to 'docs/howto')
-rw-r--r-- | docs/howto/make_plugin_extension_for_message_and_iq.pl.rst | 172 | ||||
-rw-r--r-- | docs/howto/make_plugin_extension_for_message_and_iq.rst | 172 |
2 files changed, 172 insertions, 172 deletions
diff --git a/docs/howto/make_plugin_extension_for_message_and_iq.pl.rst b/docs/howto/make_plugin_extension_for_message_and_iq.pl.rst index fb00cbf7..811de8b1 100644 --- a/docs/howto/make_plugin_extension_for_message_and_iq.pl.rst +++ b/docs/howto/make_plugin_extension_for_message_and_iq.pl.rst @@ -76,49 +76,49 @@ Plik zawiera prostą strukturę, która pozwoli nam zapisać dane logowania. .. code-block:: python
-#!/usr/bin/python3
-#File: /usr/bin/test_slixmpp & permissions rwx--x--x (711)
-
-import subprocess
-import time
-
-if __name__ == "__main__":
- #~ prefix = ["x-terminal-emulator", "-e"] # Osobny terminal dla kazdego klienta, może być zastąpiony inną konsolą.
- #~ prefix = ["xterm", "-e"]
- prefix = []
- #~ suffix = ["-d"] # Debug
- #~ suffix = ["-q"] # Quiet
- suffix = []
-
- sender_path = "./example/sender.py"
- sender_jid = "SENDER_JID"
- sender_password = "SENDER_PASSWORD"
-
- example_file = "./test_example_tag.xml"
-
- responder_path = "./example/responder.py"
- responder_jid = "RESPONDER_JID"
- responder_password = "RESPONDER_PASSWORD"
-
- # Remember about the executable permission. (`chmod +x ./file.py`)
- SENDER_TEST = prefix + [sender_path, "-j", sender_jid, "-p", sender_password, "-t", responder_jid, "--path", example_file] + suffix
- RESPON_TEST = prefix + [responder_path, "-j", responder_jid, "-p", responder_password] + suffix
-
- try:
- responder = subprocess.Popen(RESPON_TEST)
- sender = subprocess.Popen(SENDER_TEST)
- responder.wait()
- sender.wait()
- except:
- try:
- responder.terminate()
- except NameError:
- pass
- try:
- sender.terminate()
- except NameError:
- pass
- raise
+ #!/usr/bin/python3
+ #File: /usr/bin/test_slixmpp & permissions rwx--x--x (711)
+
+ import subprocess
+ import time
+
+ if __name__ == "__main__":
+ #~ prefix = ["x-terminal-emulator", "-e"] # Osobny terminal dla kazdego klienta, może być zastąpiony inną konsolą.
+ #~ prefix = ["xterm", "-e"]
+ prefix = []
+ #~ suffix = ["-d"] # Debug
+ #~ suffix = ["-q"] # Quiet
+ suffix = []
+
+ sender_path = "./example/sender.py"
+ sender_jid = "SENDER_JID"
+ sender_password = "SENDER_PASSWORD"
+
+ example_file = "./test_example_tag.xml"
+
+ responder_path = "./example/responder.py"
+ responder_jid = "RESPONDER_JID"
+ responder_password = "RESPONDER_PASSWORD"
+
+ # Remember about the executable permission. (`chmod +x ./file.py`)
+ SENDER_TEST = prefix + [sender_path, "-j", sender_jid, "-p", sender_password, "-t", responder_jid, "--path", example_file] + suffix
+ RESPON_TEST = prefix + [responder_path, "-j", responder_jid, "-p", responder_password] + suffix
+
+ try:
+ responder = subprocess.Popen(RESPON_TEST)
+ sender = subprocess.Popen(SENDER_TEST)
+ responder.wait()
+ sender.wait()
+ except:
+ try:
+ responder.terminate()
+ except NameError:
+ pass
+ try:
+ sender.terminate()
+ except NameError:
+ pass
+ raise
Skrypt uruchamiający powinien być dostosowany do potrzeb urzytkownika: można w nim pobierać ścieżki do projektu z linii komend (przez `'sys.argv[...]'` lub `'os.getcwd()'`), wybierać z jaką flagą mają zostać uruchomione programy oraz wiele innych. Jego należyte przygotowanie pozwoli zaoszczędzić czas i nerwy podczas późniejszych prac.
@@ -1263,49 +1263,49 @@ W poniższym kodzie zostały pozostawione oryginalne komentarze w języku angiel .. code-block:: python
-#!/usr/bin/python3
-#File: /usr/bin/test_slixmpp & permissions rwx--x--x (711)
-
-import subprocess
-import time
-
-if __name__ == "__main__":
- #~ prefix = ["x-terminal-emulator", "-e"] # Separate terminal for every client; can be replaced with other terminal
- #~ prefix = ["xterm", "-e"]
- prefix = []
- #~ suffix = ["-d"] # Debug
- #~ suffix = ["-q"] # Quiet
- suffix = []
-
- sender_path = "./example/sender.py"
- sender_jid = "SENDER_JID"
- sender_password = "SENDER_PASSWORD"
-
- example_file = "./test_example_tag.xml"
-
- responder_path = "./example/responder.py"
- responder_jid = "RESPONDER_JID"
- responder_password = "RESPONDER_PASSWORD"
-
- # Remember about the executable permission. (`chmod +x ./file.py`)
- SENDER_TEST = prefix + [sender_path, "-j", sender_jid, "-p", sender_password, "-t", responder_jid, "--path", example_file] + suffix
- RESPON_TEST = prefix + [responder_path, "-j", responder_jid, "-p", responder_password] + suffix
-
- try:
- responder = subprocess.Popen(RESPON_TEST)
- sender = subprocess.Popen(SENDER_TEST)
- responder.wait()
- sender.wait()
- except:
- try:
- responder.terminate()
- except NameError:
- pass
- try:
- sender.terminate()
- except NameError:
- pass
- raise
+ #!/usr/bin/python3
+ #File: /usr/bin/test_slixmpp & permissions rwx--x--x (711)
+
+ import subprocess
+ import time
+
+ if __name__ == "__main__":
+ #~ prefix = ["x-terminal-emulator", "-e"] # Separate terminal for every client; can be replaced with other terminal
+ #~ prefix = ["xterm", "-e"]
+ prefix = []
+ #~ suffix = ["-d"] # Debug
+ #~ suffix = ["-q"] # Quiet
+ suffix = []
+
+ sender_path = "./example/sender.py"
+ sender_jid = "SENDER_JID"
+ sender_password = "SENDER_PASSWORD"
+
+ example_file = "./test_example_tag.xml"
+
+ responder_path = "./example/responder.py"
+ responder_jid = "RESPONDER_JID"
+ responder_password = "RESPONDER_PASSWORD"
+
+ # Remember about the executable permission. (`chmod +x ./file.py`)
+ SENDER_TEST = prefix + [sender_path, "-j", sender_jid, "-p", sender_password, "-t", responder_jid, "--path", example_file] + suffix
+ RESPON_TEST = prefix + [responder_path, "-j", responder_jid, "-p", responder_password] + suffix
+
+ try:
+ responder = subprocess.Popen(RESPON_TEST)
+ sender = subprocess.Popen(SENDER_TEST)
+ responder.wait()
+ sender.wait()
+ except:
+ try:
+ responder.terminate()
+ except NameError:
+ pass
+ try:
+ sender.terminate()
+ except NameError:
+ pass
+ raise
.. code-block:: python
diff --git a/docs/howto/make_plugin_extension_for_message_and_iq.rst b/docs/howto/make_plugin_extension_for_message_and_iq.rst index 3a7784b8..54a9949c 100644 --- a/docs/howto/make_plugin_extension_for_message_and_iq.rst +++ b/docs/howto/make_plugin_extension_for_message_and_iq.rst @@ -76,49 +76,49 @@ This file contains a simple structure for logging credentials: .. code-block:: python -#!/usr/bin/python3 -#File: /usr/bin/test_slixmpp & permissions rwx--x--x (711) - -import subprocess -import time - -if __name__ == "__main__": - #~ prefix = ["x-terminal-emulator", "-e"] # Separate terminal for every client; can be replaced with other terminal - #~ prefix = ["xterm", "-e"] - prefix = [] - #~ suffix = ["-d"] # Debug - #~ suffix = ["-q"] # Quiet - suffix = [] - - sender_path = "./example/sender.py" - sender_jid = "SENDER_JID" - sender_password = "SENDER_PASSWORD" - - example_file = "./test_example_tag.xml" - - responder_path = "./example/responder.py" - responder_jid = "RESPONDER_JID" - responder_password = "RESPONDER_PASSWORD" - - # Remember about the executable permission. (`chmod +x ./file.py`) - SENDER_TEST = prefix + [sender_path, "-j", sender_jid, "-p", sender_password, "-t", responder_jid, "--path", example_file] + suffix - RESPON_TEST = prefix + [responder_path, "-j", responder_jid, "-p", responder_password] + suffix - - try: - responder = subprocess.Popen(RESPON_TEST) - sender = subprocess.Popen(SENDER_TEST) - responder.wait() - sender.wait() - except: - try: - responder.terminate() - except NameError: - pass - try: - sender.terminate() - except NameError: - pass - raise + #!/usr/bin/python3 + #File: /usr/bin/test_slixmpp & permissions rwx--x--x (711) + + import subprocess + import time + + if __name__ == "__main__": + #~ prefix = ["x-terminal-emulator", "-e"] # Separate terminal for every client; can be replaced with other terminal + #~ prefix = ["xterm", "-e"] + prefix = [] + #~ suffix = ["-d"] # Debug + #~ suffix = ["-q"] # Quiet + suffix = [] + + sender_path = "./example/sender.py" + sender_jid = "SENDER_JID" + sender_password = "SENDER_PASSWORD" + + example_file = "./test_example_tag.xml" + + responder_path = "./example/responder.py" + responder_jid = "RESPONDER_JID" + responder_password = "RESPONDER_PASSWORD" + + # Remember about the executable permission. (`chmod +x ./file.py`) + SENDER_TEST = prefix + [sender_path, "-j", sender_jid, "-p", sender_password, "-t", responder_jid, "--path", example_file] + suffix + RESPON_TEST = prefix + [responder_path, "-j", responder_jid, "-p", responder_password] + suffix + + try: + responder = subprocess.Popen(RESPON_TEST) + sender = subprocess.Popen(SENDER_TEST) + responder.wait() + sender.wait() + except: + try: + responder.terminate() + except NameError: + pass + try: + sender.terminate() + except NameError: + pass + raise The launch script should be convenient in use and easy to reconfigure again. The proper preparation of it now, can help saving time in the future. Logging credentials, the project paths (from `'sys.argv[...]'` or `'os.getcwd()'`), set the parameters for the debugging purposes, mock the testing xml file and many more things can be defined inside. Whichever parameters are used, the script testing itself should be fast and effortless. The proper preparation of it now, can help saving time in the future. @@ -1260,49 +1260,49 @@ Complete code from tutorial .. code-block:: python -#!/usr/bin/python3 -#File: /usr/bin/test_slixmpp & permissions rwx--x--x (711) - -import subprocess -import time - -if __name__ == "__main__": - #~ prefix = ["x-terminal-emulator", "-e"] # Separate terminal for every client; can be replaced with other terminal - #~ prefix = ["xterm", "-e"] - prefix = [] - #~ suffix = ["-d"] # Debug - #~ suffix = ["-q"] # Quiet - suffix = [] - - sender_path = "./example/sender.py" - sender_jid = "SENDER_JID" - sender_password = "SENDER_PASSWORD" - - example_file = "./test_example_tag.xml" - - responder_path = "./example/responder.py" - responder_jid = "RESPONDER_JID" - responder_password = "RESPONDER_PASSWORD" - - # Remember about the executable permission. (`chmod +x ./file.py`) - SENDER_TEST = prefix + [sender_path, "-j", sender_jid, "-p", sender_password, "-t", responder_jid, "--path", example_file] + suffix - RESPON_TEST = prefix + [responder_path, "-j", responder_jid, "-p", responder_password] + suffix - - try: - responder = subprocess.Popen(RESPON_TEST) - sender = subprocess.Popen(SENDER_TEST) - responder.wait() - sender.wait() - except: - try: - responder.terminate() - except NameError: - pass - try: - sender.terminate() - except NameError: - pass - raise + #!/usr/bin/python3 + #File: /usr/bin/test_slixmpp & permissions rwx--x--x (711) + + import subprocess + import time + + if __name__ == "__main__": + #~ prefix = ["x-terminal-emulator", "-e"] # Separate terminal for every client; can be replaced with other terminal + #~ prefix = ["xterm", "-e"] + prefix = [] + #~ suffix = ["-d"] # Debug + #~ suffix = ["-q"] # Quiet + suffix = [] + + sender_path = "./example/sender.py" + sender_jid = "SENDER_JID" + sender_password = "SENDER_PASSWORD" + + example_file = "./test_example_tag.xml" + + responder_path = "./example/responder.py" + responder_jid = "RESPONDER_JID" + responder_password = "RESPONDER_PASSWORD" + + # Remember about the executable permission. (`chmod +x ./file.py`) + SENDER_TEST = prefix + [sender_path, "-j", sender_jid, "-p", sender_password, "-t", responder_jid, "--path", example_file] + suffix + RESPON_TEST = prefix + [responder_path, "-j", responder_jid, "-p", responder_password] + suffix + + try: + responder = subprocess.Popen(RESPON_TEST) + sender = subprocess.Popen(SENDER_TEST) + responder.wait() + sender.wait() + except: + try: + responder.terminate() + except NameError: + pass + try: + sender.terminate() + except NameError: + pass + raise .. code-block:: python |