You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
This repository was intended to contain tools that allow you toquickly test and automate XMPP related things.
The sourceable bash scriptxmppcmd.bash allows you to quicklyinteract with raw xmpp or xmpp pubsub from the bash command line(or scripts).Once sourced in bash, the function can be interacted with like shellnative commands. The functions are easily discoverable using thexmpphelp command. The usage of such functions can be learned byusing the-h flag in the command arguments.
The other goal of this project was to create a tool that allowed theuser to easily interact and learn the xmpp protocol. This is why thedefault debugging level is configured to emit the XML that is beingsent and received. The tool automatically formats and color codes theXML stanzas in the terminal.
Looking though the script, you will notice that the functions build oneach other in a structured manor. The level of abstraction from rawxmpp/xml to pubsub operations has been built up using the pipe operation.This same strategy can be used to create compact user defined functions.Users can add new functionality on-the-fly by combining parts of the corexmpp functions with readily accessible coreutils.
xmppcmd.bash - BASH sourceable library of functions to control XMPP and XEP-0060
xmppsend.c - The utility program that is used to send stanzas to the XMPP server and wait for responses
xmpprecv.c - The utility program that is used to receive stanzas from the XMPP server
Features
Pretty print XML output
BASH tab completions for node names and node item names (queries pubsub in background)
Global config and local config options
Setup
Compilation You need to build thexmppsend andxmpprecv executables for use by the xmppcmd.bash library.
The build system assumes that you have the development files for libstrophe installed.
To install these on Debian, do asudo apt-get install libstrophe-dev.
To install these on OSX with homebrew, do abrew install libstropheand uncomment the two lines noted in the Makefile.
A simplemake in the xmpptools directory will build the binaries. If everything goes ok, you should seetwo new binaries, xmppsend and xmpprecv.
Setting Defaults [optional] Setting the default JID and password makes using this tool even more convenient.You can set a default JID and password in the xmpprc file.The variables of interest areDEFAULT_XMPP_USER,DEFAULT_XMPP_HOST, andDEFAULT_XMPP_PASS.You will need to separate the JID into the USER and HOST parts.
Of course, I am obligated to tell you that saving passwords in plain text is a bad idea, so take necessary precautions.
Basic Usage
One of the quickest ways to initialize the library is to supply the JID and Password on the commandline, as in the following example.
Step 1
Load and initialize the utility.
. xmppcmd.bash"craig@example.com""mypassword"
Step 2
Run any command in the library.
Example:
get_nodes
How To*s / Examples
Below, I will show a few common commands.Look in theexamples directory for scripting examples.
Get list of commands
xmpphelp
Note: Running any command with the-h argument will present it's usage options.
Create a node
create craignode
Publish to node
publish craignode RandomItemId7"<entry><head><title>Amazing Title</title></head><body>Some good website content</body></entry>"