go-xmpp/_examples/xmpp_chat_client
remicorniere 947fcf0432 PubSub protocol support (#142)
* PubSub protocol support
Added support for :
- XEP-0050   (Command))
- XEP-0060   (PubSub)
- XEP-0004   (Forms)

Fixed the NewClient function by adding parsing of the domain from the JID if no domain is provided in transport config.
Updated xmpp_jukebox example

* Delete useless pubsub errors

* README.md update
Fixed import in echo example

* Typo

* Fixed raw send on client example

* Fixed jukebox example and added a README.md
2020-01-09 15:33:11 +01:00
..
config.yml Changed "Disconnect" to wait for the closing stream tag. (#141) 2019-12-26 14:47:02 +01:00
go.mod Added roster update to chat client example 2019-12-23 10:05:27 +01:00
interface.go PubSub protocol support (#142) 2020-01-09 15:33:11 +01:00
README.md Changed "Disconnect" to wait for the closing stream tag. (#141) 2019-12-26 14:47:02 +01:00
xmpp_chat_client.go Changed "Disconnect" to wait for the closing stream tag. (#141) 2019-12-26 14:47:02 +01:00

Chat TUI example

This is a simple chat example, with a TUI.
It shows the library usage and a few of its capabilities.

How to run

Build

You can build the client using :

    go build -o example_client

and then run with (on unix for example):

    ./example_client

or you can simply build + run in one command while at the example directory root, like this:

    go run xmpp_chat_client.go interface.go 

Configuration

The example needs a configuration file to run. A sample file is provided.
By default, the example will look for a file named "config" in the current directory. To provide a different configuration file, pass the following argument to the example :

    go run xmpp_chat_client.go interface.go -c /path/to/config

where /path/to/config is the path to the directory containing the configuration file. The configuration file must be named "config" and be using the yaml format.

Required fields are :

Server :
  - full_address: "localhost:5222"
Client : # This is you
  - jid: "testuser2@localhost"
  - pass: "pass123" #Password in a config file yay

# Contacts list, ";" separated
Contacts : "testuser1@localhost;testuser3@localhost"
# Should we log stanzas ?  
LogStanzas:
  - logger_on: "true"
  - logfile_path: "./logs" # Path to directory, not file.

How to use

Shortcuts :
- ctrl+space : switch between input window and menu window.
- While in input window :
- enter : sends a message if in message mode (see menu options)
- ctrl+e : sends a raw stanza when in raw mode (see menu options)
- ctrl+c : quit