Skip to content

Commit

Permalink
Minor updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
interkosmos committed Oct 12, 2024
1 parent ae16ef8 commit c4b0466
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 22 deletions.
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,28 @@ executing the provided Makefile, or by using the
[User Guide](https://www.dabamos.de/dmpack/guide/#_installation) for complete
installation instructions.

Clone the **DMPACK** repository recursively and execute the Makefile with build
target `freebsd`, `linux`, or `linux_aarch64`:
Clone the **DMPACK** repository recursively with Git and execute the Makefile
with build target `freebsd`, `linux`, or `linux_aarch64`:

```
$ git clone --depth 1 --recursive https://github.com/dabamos/dmpack
$ make [freebsd|linux|linux_aarch64]
$ make install PREFIX=/opt
```

On 64-bit Raspberry Pi single-board computers, select target `linux_aarch64`.
If Git is not available, download the archive of the master branch instead and
run the shell script `fetchvendor.sh` to fetch the missing submodules:

```
$ curl -L -s -o dmpack-master.zip https://github.com/dabamos/dmpack/archive/refs/heads/master.zip
$ unzip dmpack-master.zip
$ cd dmpack-master/
$ sh fetchvendor.sh
$ make [freebsd|linux|linux_aarch64]
$ make install PREFIX=/opt
```

On 64-bit Raspberry Pi single-board computers running Linux, select target `linux_aarch64`.

## Library

Expand Down
4 changes: 2 additions & 2 deletions app/dmbot.f90
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ function message_callback(connection, stanza, user_data) bind(c)
type = xmpp_stanza_get_type(stanza)

if (type == JABBER_STANZA_TYPE_ERROR) then
call logger%warning('received error stanza', error=E_UNEXPECTED)
call logger%warning('received error message', error=E_UNEXPECTED)
return
end if

Expand Down Expand Up @@ -495,7 +495,7 @@ function roster_callback(connection, stanza, user_data) bind(c)
call c_f_pointer(user_data, bot)

if (xmpp_stanza_get_type(stanza) == JABBER_STANZA_TYPE_ERROR) then
call logger%error('roster query failed', error=E_XMPP)
call logger%error('roster query failed', error=E_UNEXPECTED)
return
end if

Expand Down
6 changes: 3 additions & 3 deletions guide/guide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ If Git is not available, download the archive of the master branch instead and
run the shell script `fetchvendor.sh` to fetch the missing submodules:

....
$ curl -L -s -o dmpack.zip https://github.com/dabamos/dmpack/archive/refs/heads/master.zip
$ unzip dmpack.zip
$ curl -L -s -o dmpack-master.zip https://github.com/dabamos/dmpack/archive/refs/heads/master.zip
$ unzip dmpack-master.zip
$ cd dmpack-master/
$ sh fetchvendor.sh
....
Expand Down Expand Up @@ -825,7 +825,7 @@ for testing.
| `--debug` | `-D` | off | Forward log messages of level _debug_ (if logger is set).
| `--help` | `-h` | – | Output available command-line arguments and quit.
| `--host _host_` | `-H` | – | FQDN of XMPP server (for instance, `example.com`).
| `--jid _string_` | `-J` | – | Bot Jabber ID (for example, `[email protected]`).
| `--jid _string_` | `-J` | – | Bot Jabber id (for example, `[email protected]`).
| `--logger _name_` | `-l` | – | Optional name of logger. If set, sends logs to <<dmlogger>> process of given name.
| `--name _name_` | `-n` | `dmbot` | Optional name of instance, XMPP resource, and table in configuration.
| `--node _id_` | `-N` | – | Node id.
Expand Down
21 changes: 7 additions & 14 deletions src/dm_jabber.f90
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ module dm_jabber
!! keep_alive = .true.)
!! if (dm_is_ok(rc)) call dm_jabber_run(jabber)
!!
!! call dm_jabber_disconnect(jabber)
!! call dm_jabber_destroy(jabber)
!! call dm_jabber_shutdown()
!! ```
Expand All @@ -44,21 +43,14 @@ module dm_jabber
!! type(xmpp_stream_error_t), intent(in) :: stream_error !! xmpp_stream_error_t *
!! type(c_ptr), intent(in), value :: user_data !! void *
!!
!! integer :: stat
!! type(c_ptr) :: presence
!! type(jabber_type), pointer :: jabber
!!
!! if (.not. c_associated(user_data)) return
!! call c_f_pointer(user_data, jabber)
!!
!! if (event == XMPP_CONN_CONNECT) then
!! print '("connected")'
!!
!! presence = xmpp_presence_new(jabber%ctx)
!! call xmpp_send(connection, presence)
!! stat = xmpp_stanza_release(presence)
!! call dm_jabber_send_presence(jabber, JABBER_STANZA_TEXT_ONLINE)
!! else
!! print '("disconnected")'
!! call dm_jabber_stop(jabber)
!! end if
!! end subroutine connection_callback
Expand All @@ -75,14 +67,15 @@ module dm_jabber
dm_jabber_password_callback => xmpp_password_callback, &
dm_jabber_timed_callback => xmpp_timed_handler
use :: dm_error
use :: dm_id
implicit none (type, external)
private

integer, parameter, public :: JABBER_HOST_LEN = 256 !! Max. length of host.
integer, parameter, public :: JABBER_JID_LEN = 64 !! Max. length of Jabber id.
integer, parameter, public :: JABBER_JID_FULL_LEN = 128 !! Max. length of JID with additional resource.
integer, parameter, public :: JABBER_PASSWORD_LEN = 64 !! Max. length of password.
integer, parameter, public :: JABBER_PING_ID_LEN = 32 !! Max. length of ping id.
integer, parameter, public :: JABBER_HOST_LEN = 256 !! Max. length of host.
integer, parameter, public :: JABBER_JID_LEN = 64 !! Max. length of Jabber id.
integer, parameter, public :: JABBER_JID_FULL_LEN = 128 !! Max. length of JID with additional resource.
integer, parameter, public :: JABBER_PASSWORD_LEN = 64 !! Max. length of password.
integer, parameter, public :: JABBER_PING_ID_LEN = ID_LEN !! Max. length of ping id.

integer, parameter, public :: JABBER_PORT = 5222 !! Default XMPP port (StartTLS).
integer, parameter, public :: JABBER_PORT_TLS = 5223 !! Secondary XMPP port (TLS).
Expand Down

0 comments on commit c4b0466

Please sign in to comment.