dm_im Module

Instant messaging module for Jabber/XMPP connectivity, based on libstrophe.

Link this module against pkg-config --libs libstrophe expat openssl zlib.

The following example just connects to an XMPP server on port 5222 and sends a presence stanza:

integer               :: rc !! Return code.
type(im_type), target :: im !! IM context type.

call dm_im_init()
call dm_im_create(im)

rc = dm_im_connect(im         = im, &
                   host       = 'example.com', &
                   port       = IM_PORT, &
                   jid        = 'user@example.com', &
                   password   = 'secret', &
                   callback   = connection_callback, &
                   user_data  = c_loc(im), &
                   keep_alive = .true.)
if (dm_is_ok(rc)) call dm_im_run(im)

call dm_im_destroy(im)
call dm_im_shutdown()

The callback passed to the connect function must be of C-interoperable abstract interface dm_im_connection_callback(), which is an alias for xmpp_conn_handler() from module xmpp, for example:

subroutine connection_callback(connection, event, error, stream_error, user_data) bind(c)
    use :: xmpp

    type(c_ptr),               intent(in), value :: connection   !! xmpp_conn_t *
    integer(kind=c_int),       intent(in), value :: event        !! xmpp_conn_event_t
    integer(kind=c_int),       intent(in), value :: error        !! int
    type(xmpp_stream_error_t), intent(in)        :: stream_error !! xmpp_stream_error_t *
    type(c_ptr),               intent(in), value :: user_data    !! void *

    type(im_type), pointer :: im

    if (.not. c_associated(user_data)) return
    call c_f_pointer(user_data, im)

    if (event == XMPP_CONN_CONNECT) then
        call dm_im_send_presence(im, IM_STANZA_TEXT_ONLINE)
    else
        call dm_im_stop(im)
    end if
end subroutine connection_callback

XMPP protocol handling is covered by module xmpp from library vendor/fortran-xmpp.


Uses

  • module~~dm_im~~UsesGraph module~dm_im dm_im iso_c_binding iso_c_binding module~dm_im->iso_c_binding module~dm_error dm_error module~dm_im->module~dm_error module~dm_file dm_file module~dm_im->module~dm_file module~dm_id dm_id module~dm_im->module~dm_id module~dm_kind dm_kind module~dm_im->module~dm_kind module~dm_mime dm_mime module~dm_im->module~dm_mime module~dm_sem dm_sem module~dm_im->module~dm_sem module~dm_uuid dm_uuid module~dm_im->module~dm_uuid xmpp xmpp module~dm_im->xmpp module~dm_error->module~dm_kind module~dm_ascii dm_ascii module~dm_error->module~dm_ascii module~dm_file->module~dm_error module~dm_file->module~dm_kind iso_fortran_env iso_fortran_env module~dm_kind->iso_fortran_env module~dm_sem->module~dm_error module~dm_sem->module~dm_id unix unix module~dm_sem->unix

Used by

  • module~~dm_im~~UsedByGraph module~dm_im dm_im module~dmpack dmpack module~dmpack->module~dm_im

Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: IM_HOST_LEN = 255

Max. length of host (XEP-0029).

integer, public, parameter :: IM_JID_LEN = 256

Max. length of Jabber id (XEP-0029).

integer, public, parameter :: IM_JID_FULL_LEN = 768

Max. length of JID with additional resource (XEP-0029).

integer, public, parameter :: IM_PASSWORD_LEN = 256

Max. length of password.

integer, public, parameter :: IM_ID_LEN = ID_LEN

Max. length of id.

integer, public, parameter :: IM_URL_LEN = 2048

Max. length of URL.

integer, public, parameter :: IM_PORT = 5222

Default XMPP port (StartTLS).

integer, public, parameter :: IM_PORT_TLS = 5223

Secondary XMPP port (TLS).

integer, public, parameter :: IM_LL_NONE = -1

Logging disabled.

integer, public, parameter :: IM_LL_DEBUG = XMPP_LEVEL_DEBUG
integer, public, parameter :: IM_LL_INFO = XMPP_LEVEL_INFO
integer, public, parameter :: IM_LL_WARNING = XMPP_LEVEL_WARN
integer, public, parameter :: IM_LL_ERROR = XMPP_LEVEL_ERROR
character(len=*), public, parameter :: IM_STANZA_ATTR_ASK = 'ask'
character(len=*), public, parameter :: IM_STANZA_ATTR_AUTOJOIN = 'autojoin'
character(len=*), public, parameter :: IM_STANZA_ATTR_CATEGORY = 'category'
character(len=*), public, parameter :: IM_STANZA_ATTR_CODE = 'code'
character(len=*), public, parameter :: IM_STANZA_ATTR_CONTENT_TYPE = 'content-type'
character(len=*), public, parameter :: IM_STANZA_ATTR_DATE = 'date'
character(len=*), public, parameter :: IM_STANZA_ATTR_FILENAME = 'filename'
character(len=*), public, parameter :: IM_STANZA_ATTR_FROM = 'from'
character(len=*), public, parameter :: IM_STANZA_ATTR_HASH = 'hash'
character(len=*), public, parameter :: IM_STANZA_ATTR_ID = 'id'
character(len=*), public, parameter :: IM_STANZA_ATTR_JID = 'jid'
character(len=*), public, parameter :: IM_STANZA_ATTR_LABEL = 'label'
character(len=*), public, parameter :: IM_STANZA_ATTR_NAME = 'name'
character(len=*), public, parameter :: IM_STANZA_ATTR_NICK = 'nick'
character(len=*), public, parameter :: IM_STANZA_ATTR_NODE = 'node'
character(len=*), public, parameter :: IM_STANZA_ATTR_PASSWORD = 'password'
character(len=*), public, parameter :: IM_STANZA_ATTR_REASON = 'reason'
character(len=*), public, parameter :: IM_STANZA_ATTR_SECONDS = 'seconds'
character(len=*), public, parameter :: IM_STANZA_ATTR_SIZE = 'size'
character(len=*), public, parameter :: IM_STANZA_ATTR_STAMP = 'stamp'
character(len=*), public, parameter :: IM_STANZA_ATTR_STATUS = 'status'
character(len=*), public, parameter :: IM_STANZA_ATTR_SUBSCRIPTION = 'subscription'
character(len=*), public, parameter :: IM_STANZA_ATTR_TO = 'to'
character(len=*), public, parameter :: IM_STANZA_ATTR_TYPE = 'type'
character(len=*), public, parameter :: IM_STANZA_ATTR_URL = 'url'
character(len=*), public, parameter :: IM_STANZA_ATTR_V4_FINGERPRINT = 'v4-fingerprint'
character(len=*), public, parameter :: IM_STANZA_ATTR_VAR = 'var'
character(len=*), public, parameter :: IM_STANZA_ATTR_VER = 'ver'
character(len=*), public, parameter :: IM_STANZA_ATTR_XMLNS = 'xmlns'
character(len=*), public, parameter :: IM_STANZA_HEADER_AUTHORIZATION = 'Authorization'
character(len=*), public, parameter :: IM_STANZA_HEADER_COOKIE = 'Cookie'
character(len=*), public, parameter :: IM_STANZA_HEADER_EXPIRES = 'Expires'
character(len=*), public, parameter :: IM_STANZA_NAME_ACTOR = 'actor'
character(len=*), public, parameter :: IM_STANZA_NAME_AFTER = 'after'
character(len=*), public, parameter :: IM_STANZA_NAME_BEFORE = 'before'
character(len=*), public, parameter :: IM_STANZA_NAME_BLOCK = 'block'
character(len=*), public, parameter :: IM_STANZA_NAME_BLOCKLIST = 'blocklist'
character(len=*), public, parameter :: IM_STANZA_NAME_BODY = 'body'
character(len=*), public, parameter :: IM_STANZA_NAME_C = 'c'
character(len=*), public, parameter :: IM_STANZA_NAME_COMMAND = 'command'
character(len=*), public, parameter :: IM_STANZA_NAME_CONFERENCE = 'conference'
character(len=*), public, parameter :: IM_STANZA_NAME_CONFIGURE = 'configure'
character(len=*), public, parameter :: IM_STANZA_NAME_CONTENT_TYPE = 'content-type'
character(len=*), public, parameter :: IM_STANZA_NAME_DATA = 'data'
character(len=*), public, parameter :: IM_STANZA_NAME_DELAY = 'delay'
character(len=*), public, parameter :: IM_STANZA_NAME_DESTROY = 'destroy'
character(len=*), public, parameter :: IM_STANZA_NAME_DISABLE = 'disable'
character(len=*), public, parameter :: IM_STANZA_NAME_ENABLE = 'enable'
character(len=*), public, parameter :: IM_STANZA_NAME_ERROR = 'error'
character(len=*), public, parameter :: IM_STANZA_NAME_EVENT = 'event'
character(len=*), public, parameter :: IM_STANZA_NAME_FEATURE = 'feature'
character(len=*), public, parameter :: IM_STANZA_NAME_FIELD = 'field'
character(len=*), public, parameter :: IM_STANZA_NAME_FILENAME = 'filename'
character(len=*), public, parameter :: IM_STANZA_NAME_FIN = 'fin'
character(len=*), public, parameter :: IM_STANZA_NAME_FIRST = 'first'
character(len=*), public, parameter :: IM_STANZA_NAME_GET = 'get'
character(len=*), public, parameter :: IM_STANZA_NAME_GROUP = 'group'
character(len=*), public, parameter :: IM_STANZA_NAME_HEADER = 'header'
character(len=*), public, parameter :: IM_STANZA_NAME_IDENTITY = 'identity'
character(len=*), public, parameter :: IM_STANZA_NAME_INFO = 'info'
character(len=*), public, parameter :: IM_STANZA_NAME_INVITE = 'invite'
character(len=*), public, parameter :: IM_STANZA_NAME_IQ = 'iq'
character(len=*), public, parameter :: IM_STANZA_NAME_ITEM = 'item'
character(len=*), public, parameter :: IM_STANZA_NAME_ITEMS = 'items'
character(len=*), public, parameter :: IM_STANZA_NAME_LAST = 'last'
character(len=*), public, parameter :: IM_STANZA_NAME_MAX = 'max'
character(len=*), public, parameter :: IM_STANZA_NAME_MESSAGE = 'message'
character(len=*), public, parameter :: IM_STANZA_NAME_METADATA = 'metadata'
character(len=*), public, parameter :: IM_STANZA_NAME_MINIMIZE = 'minimize'
character(len=*), public, parameter :: IM_STANZA_NAME_MOOD = 'mood'
character(len=*), public, parameter :: IM_STANZA_NAME_NICK = 'nick'
character(len=*), public, parameter :: IM_STANZA_NAME_OPENPGP = 'openpgp'
character(len=*), public, parameter :: IM_STANZA_NAME_ORIGIN_ID = 'origin-id'
character(len=*), public, parameter :: IM_STANZA_NAME_PASSWORD = 'password'
character(len=*), public, parameter :: IM_STANZA_NAME_PING = 'ping'
character(len=*), public, parameter :: IM_STANZA_NAME_PRESENCE = 'presence'
character(len=*), public, parameter :: IM_STANZA_NAME_PRIORITY = 'priority'
character(len=*), public, parameter :: IM_STANZA_NAME_PROPOSE = 'propose'
character(len=*), public, parameter :: IM_STANZA_NAME_PUBKEY_METADATA = 'pubkey-metadata'
character(len=*), public, parameter :: IM_STANZA_NAME_PUBLIC_KEYS_LIST = 'public-keys-list'
character(len=*), public, parameter :: IM_STANZA_NAME_PUBLISH = 'publish'
character(len=*), public, parameter :: IM_STANZA_NAME_PUBLISH_OPTIONS = 'publish-options'
character(len=*), public, parameter :: IM_STANZA_NAME_PUBSUB = 'pubsub'
character(len=*), public, parameter :: IM_STANZA_NAME_PUPKEY = 'pubkey'
character(len=*), public, parameter :: IM_STANZA_NAME_PUT = 'put'
character(len=*), public, parameter :: IM_STANZA_NAME_QUERY = 'query'
character(len=*), public, parameter :: IM_STANZA_NAME_REASON = 'reason'
character(len=*), public, parameter :: IM_STANZA_NAME_RECEIVED = 'received'
character(len=*), public, parameter :: IM_STANZA_NAME_REPORT = 'report'
character(len=*), public, parameter :: IM_STANZA_NAME_REQUEST = 'request'
character(len=*), public, parameter :: IM_STANZA_NAME_RESULT = 'result'
character(len=*), public, parameter :: IM_STANZA_NAME_SENT = 'sent'
character(len=*), public, parameter :: IM_STANZA_NAME_SHOW = 'show'
character(len=*), public, parameter :: IM_STANZA_NAME_SIZE = 'size'
character(len=*), public, parameter :: IM_STANZA_NAME_SLOT = 'slot'
character(len=*), public, parameter :: IM_STANZA_NAME_STANZA_ID = 'stanza-id'
character(len=*), public, parameter :: IM_STANZA_NAME_STATUS = 'status'
character(len=*), public, parameter :: IM_STANZA_NAME_STORAGE = 'storage'
character(len=*), public, parameter :: IM_STANZA_NAME_SUBJECT = 'subject'
character(len=*), public, parameter :: IM_STANZA_NAME_SUBSCRIBE = 'subscribe'
character(len=*), public, parameter :: IM_STANZA_NAME_TEXT = 'text'
character(len=*), public, parameter :: IM_STANZA_NAME_UNBLOCK = 'unblock'
character(len=*), public, parameter :: IM_STANZA_NAME_URL = 'url'
character(len=*), public, parameter :: IM_STANZA_NAME_USERNAME = 'username'
character(len=*), public, parameter :: IM_STANZA_NAME_VALUE = 'value'
character(len=*), public, parameter :: IM_STANZA_NAME_VCARD = 'vCard'
character(len=*), public, parameter :: IM_STANZA_NAME_X = 'x'
character(len=*), public, parameter :: IM_STANZA_NAME_BAD_REQUEST = 'bad-request'
character(len=*), public, parameter :: IM_STANZA_NAME_CONFLICT = 'conflict'
character(len=*), public, parameter :: IM_STANZA_NAME_FEATURE_NOT_IMPLEMENTED = 'feature-not-implemented'
character(len=*), public, parameter :: IM_STANZA_NAME_FORBIDDEN = 'forbidden'
character(len=*), public, parameter :: IM_STANZA_NAME_GONE = 'gone'
character(len=*), public, parameter :: IM_STANZA_NAME_INTERNAL_SERVER_ERROR = 'internal-server-error'
character(len=*), public, parameter :: IM_STANZA_NAME_ITEM_NOT_FOUND = 'item-not-found'
character(len=*), public, parameter :: IM_STANZA_NAME_JID_MALFORMED = 'jid-malformed'
character(len=*), public, parameter :: IM_STANZA_NAME_NOT_ACCEPTABLE = 'not-acceptable'
character(len=*), public, parameter :: IM_STANZA_NAME_NOT_ALLOWED = 'not-allowed'
character(len=*), public, parameter :: IM_STANZA_NAME_NOT_AUTHORISED = 'not-authorised'
character(len=*), public, parameter :: IM_STANZA_NAME_POLICY_VIOLATION = 'policy-violation'
character(len=*), public, parameter :: IM_STANZA_NAME_RECIPIENT_UNAVAILABLE = 'recipient-unavailable'
character(len=*), public, parameter :: IM_STANZA_NAME_REDIRECT = 'redirect'
character(len=*), public, parameter :: IM_STANZA_NAME_REGISTRATION_REQUIRED = 'registration-required'
character(len=*), public, parameter :: IM_STANZA_NAME_REMOTE_SERVER_NOT_FOUND = 'remote-server-not-found'
character(len=*), public, parameter :: IM_STANZA_NAME_REMOTE_SERVER_TIMEOUT = 'remote-server-timeout'
character(len=*), public, parameter :: IM_STANZA_NAME_RESOURCE_CONSTRAINT = 'resource-constraint'
character(len=*), public, parameter :: IM_STANZA_NAME_SERVICE_UNAVAILABLE = 'service-unavailable'
character(len=*), public, parameter :: IM_STANZA_NAME_SUBSCRIPTION_REQUIRED = 'subscription-required'
character(len=*), public, parameter :: IM_STANZA_NAME_UNDEFINED_CONDITION = 'undefined-condition'
character(len=*), public, parameter :: IM_STANZA_NAME_UNEXPECTED_REQUEST = 'unexpected-request'
character(len=*), public, parameter :: IM_STANZA_NS_AUTH = XMPP_NS_AUTH
character(len=*), public, parameter :: IM_STANZA_NS_BIND = XMPP_NS_BIND
character(len=*), public, parameter :: IM_STANZA_NS_CLIENT = XMPP_NS_CLIENT
character(len=*), public, parameter :: IM_STANZA_NS_COMPONENT = XMPP_NS_COMPONENT
character(len=*), public, parameter :: IM_STANZA_NS_COMPRESSION = XMPP_NS_COMPRESSION
character(len=*), public, parameter :: IM_STANZA_NS_DATA = 'im:x:data'
character(len=*), public, parameter :: IM_STANZA_NS_DISCO_INFO = XMPP_NS_DISCO_INFO
character(len=*), public, parameter :: IM_STANZA_NS_DISCO_ITEMS = XMPP_NS_DISCO_ITEMS
character(len=*), public, parameter :: IM_STANZA_NS_FEATURE_COMPRESSION = XMPP_NS_FEATURE_COMPRESSION
character(len=*), public, parameter :: IM_STANZA_NS_HTTP_UPLOAD = 'urn:xmpp:http:upload:0'
character(len=*), public, parameter :: IM_STANZA_NS_PING = 'urn:xmpp:ping'
character(len=*), public, parameter :: IM_STANZA_NS_REGISTER = XMPP_NS_REGISTER
character(len=*), public, parameter :: IM_STANZA_NS_ROSTER = XMPP_NS_ROSTER
character(len=*), public, parameter :: IM_STANZA_NS_SASL = XMPP_NS_SASL
character(len=*), public, parameter :: IM_STANZA_NS_SESSION = XMPP_NS_SESSION
character(len=*), public, parameter :: IM_STANZA_NS_SM = XMPP_NS_SM
character(len=*), public, parameter :: IM_STANZA_NS_STANZAS_IETF = XMPP_NS_STANZAS_IETF
character(len=*), public, parameter :: IM_STANZA_NS_STREAMS = XMPP_NS_STREAMS
character(len=*), public, parameter :: IM_STANZA_NS_STREAMS_IETF = XMPP_NS_STREAMS_IETF
character(len=*), public, parameter :: IM_STANZA_NS_TLS = XMPP_NS_TLS
character(len=*), public, parameter :: IM_STANZA_TEXT_AWAY = 'away'
character(len=*), public, parameter :: IM_STANZA_TEXT_CHAT = 'chat'
character(len=*), public, parameter :: IM_STANZA_TEXT_DND = 'dnd'
character(len=*), public, parameter :: IM_STANZA_TEXT_ONLINE = 'online'
character(len=*), public, parameter :: IM_STANZA_TEXT_XA = 'xa'
character(len=*), public, parameter :: IM_STANZA_TYPE_CANCEL = 'cancel'
character(len=*), public, parameter :: IM_STANZA_TYPE_CHAT = 'chat'
character(len=*), public, parameter :: IM_STANZA_TYPE_ERROR = 'error'
character(len=*), public, parameter :: IM_STANZA_TYPE_GET = 'get'
character(len=*), public, parameter :: IM_STANZA_TYPE_MODIFY = 'modify'
character(len=*), public, parameter :: IM_STANZA_TYPE_NORMAL = 'normal'
character(len=*), public, parameter :: IM_STANZA_TYPE_RESULT = 'result'
character(len=*), public, parameter :: IM_STANZA_TYPE_SET = 'set'
character(len=*), public, parameter :: IM_STANZA_TYPE_SUBMIT = 'submit'
character(len=*), public, parameter :: IM_STANZA_TYPE_UNAVAILABLE = 'unavailable'

Derived Types

type, public ::  im_type

IM/XMPP context type.

Components

Type Visibility Attributes Name Initial
type(c_ptr), public :: ctx = c_null_ptr

libstrophe context.

type(c_ptr), public :: connection = c_null_ptr

libstrophe connection.

type(c_ptr), public :: sm_state = c_null_ptr

libstrophe stream management state.

character(len=IM_HOST_LEN), public :: host = ' '

XMPP server host.

integer, public :: port = IM_PORT

XMPP server port.

character(len=IM_JID_LEN), public :: jid = ' '

XMPP id of account.

character(len=IM_JID_FULL_LEN), public :: jid_full = ' '

XMPP id with resource.

character(len=IM_PASSWORD_LEN), public :: password = ' '

XMPP password of account.

type, public ::  im_upload_type

IM HTTP upload context type

Components

Type Visibility Attributes Name Initial
character(len=FILE_PATH_LEN), public :: file_path = ' '
character(len=FILE_PATH_LEN), public :: file_name = ' '
integer(kind=i8), public :: file_size = 0_i8
character(len=IM_URL_LEN), public :: url_get = ' '
character(len=IM_URL_LEN), public :: url_put = ' '
character(len=MIME_LEN), public :: content_type = ' '
character(len=32), public :: auth = ' '
character(len=1024), public :: cookie = ' '
character(len=32), public :: expires = ' '
integer, public :: error = E_NONE
character(len=512), public :: error_message = ' '

Functions

public function dm_im_connect(im, host, port, jid, password, callback, user_data, resource, keep_alive, tls_required, tls_trusted) result(rc)

Connects to XMPP server.

Read more…

Arguments

Type IntentOptional Attributes Name
type(im_type), intent(inout) :: im

IM context type.

character(len=*), intent(in) :: host

XMPP server (IP address or FQDN).

integer, intent(in) :: port

XMPP server port.

character(len=*), intent(in) :: jid

IM ID (JID).

character(len=*), intent(in) :: password

JID account password.

procedure(dm_im_connection_callback) :: callback

IM connection handler.

type(c_ptr), intent(in), optional :: user_data

C pointer to user data.

character(len=*), intent(in), optional :: resource

Optional resource (<jid>@<domain>/<resource>).

logical, intent(in), optional :: keep_alive

Enable TCP Keep Alive.

logical, intent(in), optional :: tls_required

TLS is mandatory.

logical, intent(in), optional :: tls_trusted

Trust TLS certificate.

Return Value integer

public function dm_im_create(im, log_level) result(rc)

Creates IM context. Logging to standard error is disabled by default or if log_level is IM_LL_NONE. Make sure that argument im is not created already.

Read more…

Arguments

Type IntentOptional Attributes Name
type(im_type), intent(out) :: im

IM context type.

integer, intent(in), optional :: log_level

Log level of libstrophe (IM_LL_*).

Return Value integer

public function dm_im_create_iq_error(im, id, type, condition) result(iq_stanza)

Returns C pointer to new error iq stanza.

Arguments

Type IntentOptional Attributes Name
type(im_type), intent(inout) :: im

IM context type.

character(len=*), intent(in) :: id

Stanza id.

character(len=*), intent(in) :: type

Stanza type.

character(len=*), intent(in), optional :: condition

Condition stanza name.

Return Value type(c_ptr)

public function dm_im_create_iq_http_upload(im, id, file_name, file_size, content_type) result(iq_stanza)

Returns C pointer to new http upload iq stanza.

Arguments

Type IntentOptional Attributes Name
type(im_type), intent(inout) :: im

IM context type.

character(len=*), intent(in) :: id

Stanza id.

character(len=*), intent(in) :: file_name

File name.

integer(kind=i8), intent(in) :: file_size

File size in bytes.

character(len=*), intent(in) :: content_type

MIME type.

Return Value type(c_ptr)

public function dm_im_create_iq_ping(im, id, to) result(iq_stanza)

Returns C pointer to new ping iq stanza.

Arguments

Type IntentOptional Attributes Name
type(im_type), intent(inout) :: im

IM context type.

character(len=*), intent(in) :: id

Stanza id.

character(len=*), intent(in), optional :: to

Target.

Return Value type(c_ptr)

public function dm_im_create_iq_result(im, id) result(iq_stanza)

Returns C pointer to new result iq stanza.

Arguments

Type IntentOptional Attributes Name
type(im_type), intent(inout) :: im

IM context type.

character(len=*), intent(in) :: id

Stanza id.

Return Value type(c_ptr)

public function dm_im_is_connected(im) result(is)

Returns .true. if connection is open.

Arguments

Type IntentOptional Attributes Name
type(im_type), intent(inout) :: im

IM context type.

Return Value logical


Subroutines

public subroutine dm_im_destroy(im)

Destroys XMPP context and an closes the connection if still open.

Arguments

Type IntentOptional Attributes Name
type(im_type), intent(inout) :: im

IM context type.

public subroutine dm_im_disconnect(im)

Disconnects from server and releases connection.

Arguments

Type IntentOptional Attributes Name
type(im_type), intent(inout) :: im

IM context type.

public subroutine dm_im_init()

Initialises XMPP backend (libstrophe).

Arguments

None

Saves current XMPP stream management state to Jabber context.

Arguments

Type IntentOptional Attributes Name
type(im_type), intent(inout) :: im

IM context type.

public subroutine dm_im_run(im)

Starts XMPP event loop.

Arguments

Type IntentOptional Attributes Name
type(im_type), intent(inout) :: im

IM context type.

public subroutine dm_im_send_presence(im, show, status)

Creates and sends presence to XMPP server.

Arguments

Type IntentOptional Attributes Name
type(im_type), intent(inout) :: im

IM context type.

character(len=*), intent(in), optional :: show

Availability (away, dnd, online, …).

character(len=*), intent(in), optional :: status

Human-readable status description text.

public subroutine dm_im_send_stanza(im, stanza, release)

Sends stanza to server and releases it by default.

Arguments

Type IntentOptional Attributes Name
type(im_type), intent(inout) :: im

IM context type.

type(c_ptr), intent(in) :: stanza

Stanza to send.

logical, intent(in), optional :: release

Release stanza afterwards.

public subroutine dm_im_shutdown()

Shuts down XMPP backend (libstrophe).

Arguments

None

public subroutine dm_im_stop(im)

Stops event loop (libstrophe).

Arguments

Type IntentOptional Attributes Name
type(im_type), intent(inout) :: im

IM context type.