De Goffiwiki
Aller à : navigation, rechercher


Jp is Salut à Toi's non-interactive command-line interface. It allows one to send or receive files directly from a shell, pipe commands to or from XMPP, use XMPP easily in a script, etc.

The following sub-commands are supported:

messages handling
Save/load parameters template
File sending/receiving
Profile commands
Manage an entity's roster
Get various pieces of information on entities
stream piping through XMPP
blog/microblog management
Ad-hoc commands
manage bookmarks

For getting some help about a command, type e.g.:

 jp message --help

If the command message contains subcommands, this will only list those subcommands without giving a lot of information about them. Then you can type e.g:

 jp message send --help

This will display all the arguments that you need to know in order to use the subcommand send.

Examples of usage

  • Send a message to a contact:
 cat "Salut" > test
 jp message send -p -c --pwd MyPassWord < test

Explanation : sends a chat message with the content of the file test to The argument -c means "connect the profile, if not already connected". MyPassWord is the password of (and you ought to think twice before using this option because it makes your password directly readable from the screen and it also saves it to your shell history).

Of course you can also use the pipe operator to feed your messages:

 env | grep PYTHON | jp message send -p -c --pwd MyPassWord

Send a file to a contact

 jp file send -p -c --pwd MyPassWord test

This will send the file test to the contact. This is completely different than jp message send as you really send a file and not a message, your contact can choose in which directory it will be saved on his drive. You can send binary file such as images or videos.

Receive files

The following command allows to receive a file in the /tmp directory.

$ jp file receive -p sat --path /tmp

Get information about a server

$ jp info version
Client name: Prosody
Client version: 0.10.0
Operating System: Linux

Get disco information

Query a Server

$ jp info disco



│catego │ typ │ name   │
│pubsub │ pep │        │
│server │ im  │ Prosody│


│entity                  │  │ │
│       │  │ │
│      │  │ │
│ │  │ │
│        │  │ │
│      │  │ │
│     │  │ │

Query an account

$ jp info disco


│categor │ type       │ │
│pubsub  │ pep        │ │
│account │ registered │ │

Manage pubsub nodes

The following examples show how to manage pubsub nodes on the service .

Create a node

$ jp pubsub node create -s node_name

Subscribe to a node

$ jp pubsub subscribe -s node_name


The edit command allows to edit an item under a node.

$ jp pubsub edit -s node_name

The default text editor is opened. It is possible to directly edit a XML file. This command is useful for debugging purpose.

If you want to edit a post without having to edit xml directly, use jp blog edit.

As an example, you can try to edit the following xml file.

<source lang="xml"><entry xmlns="">

 <generator>JP (SàT)</generator>
 <title>I am a pubsub post !</title>
 <content>This is the content of this great post.</content>


Manage your XMPP Blog

It is possible to manage a post with XMPP. It is based on PEP, a simplified version of pubsub. If your server support PEP, JP can help you to manage this blog easily.

Publish a post

First, you need to define your preferred syntax. In this example, I select markdown. This option can also be set in any other frontend (e.g. Primitivus). Whereafter you can edit a new post with the syntax jp blog edit.

$ jp param set Composition Syntax markdown -p sat
$ jp blog edit

Your favorite editor open and you can edit your blog post with markdown syntax. When you save and close it, another file open. You can edit your settings:

    "allow_comments": "true",

You can verify the accessibility of your post with the following command:

$ jp blog get 
Great test !
Make testing great again !
Yuuuuuuge publication.

It is also possible to modify your last blog post simply with jp blog edit --last-item.

Your blog post are also visible on other clients like Movim and interfaces like Livervia.

Use jp shell:

In order to ease debugging of services, JP comes with a shell interface. You only need to launch jp shell. You can obtain help by typing ?.

$ jp shell
cmd pubsub
pubsub> ?
Shell commands:
Documented commands (type help <topic>):
cmd    do    help  shell  use_clear  version
debug  exit  quit  use    verbose    whoami 

Action commands:
positional arguments:
    get                 get pubsub item(s)
    delete              delete an item
    edit                edit an existing or new pubsub item
    subscribe           subscribe to a node
    unsubscribe         unsubscribe from a node
    subscriptions       retrieve all subscriptions on a service
    node                node handling
    affiliations        retrieve all affiliations on a service
    search              search items corresponding to filters
    hook                trigger action on Pubsub notifications
    uri                 build URI

Select a command

> cmd pubsub
pubsub> use node urn:xmpp:microblog:0

Navigate into commands

> cmd bookmarks/list
bookmarks/list> -c
... CMD result
bookmarks/list> cmd ..
bookmarks> cmd

Example: List bookmarks

$  jp shell
> cmd bookmarks
bookmarks> cmd list
bookmarks/list> ?
Shell commands:
Documented commands (type help <topic>):
cmd    do    help  shell  use_clear  version
debug  exit  quit  use    verbose    whoami 

Action commands:
optional arguments:
  -h, --help            show this help message and exit
  -p PROFILE, --profile PROFILE
                        Use PROFILE profile key (default: @DEFAULT@)
  --pwd PASSWORD        Password used to connect profile, if necessary
  -c, --connect         Connect the profile before doing anything else
  -l {all,local,private,pubsub}, --location {all,local,private,pubsub}
                        storage location (default: all)
  -t {muc,url}, --type {muc,url}
                        bookmarks type (default: muc)
bookmarks/list> -t muc
    Movim [] (*)
    Archlinux - blah blah []
    bot [] (*)

Example: get disco information

> cmd info
info> use 
info> use 
info> disco


│catego │ type    │ name                  │
│pubsub │ service │ Prosody PubSub Service│