Skip to content

Commit

Permalink
Updated error code. Reformatted.
Browse files Browse the repository at this point in the history
  • Loading branch information
interkosmos committed Oct 15, 2024
1 parent 2862156 commit bb2fd42
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions app/dmbot.f90
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ recursive subroutine connection_callback(connection, event, error, stream_error,
type(xmpp_stream_error_t), intent(in) :: stream_error !! xmpp_stream_error_t *
type(c_ptr), intent(in), value :: user_data !! void *

type(bot_type), pointer :: bot
type(im_type), pointer :: im
type(bot_type), pointer :: bot
type(im_type), pointer :: im

if (.not. c_associated(user_data)) return
call c_f_pointer(user_data, bot)
Expand Down Expand Up @@ -567,8 +567,8 @@ end function bot_dispatch
logical function bot_is_authorized(group, jid) result(is)
!! Returns `.true.` if JID is in group. If the group is empty, all JIDs
!! are authorised!
character(len=IM_JID_LEN), intent(inout) :: group(:) !! Group of authorised JIDs.
character(len=*), intent(in) :: jid !! JIDs to validate.
character(len=IM_JID_FULL_LEN), intent(inout) :: group(:) !! Group of authorised JIDs.
character(len=*), intent(in) :: jid !! JIDs to validate.

integer :: i, j, n

Expand Down
18 changes: 9 additions & 9 deletions src/dm_im.f90
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,14 @@ module dm_im

type, public :: im_type
!! IM/XMPP context type.
type(c_ptr) :: ctx = c_null_ptr !! libstrophe context.
type(c_ptr) :: connection = c_null_ptr !! libstrophe connection.
type(c_ptr) :: sm_state = c_null_ptr !! libstrophe stream management state.
character(len=IM_HOST_LEN) :: host = ' ' !! XMPP server host.
integer :: port = IM_PORT !! XMPP server port.
character(len=IM_JID_LEN) :: jid = ' ' !! XMPP id of account.
character(len=IM_JID_FULL_LEN) :: jid_full = ' ' !! XMPP id with resource.
character(len=IM_PASSWORD_LEN) :: password = ' ' !! XMPP password of account.
type(c_ptr) :: ctx = c_null_ptr !! libstrophe context.
type(c_ptr) :: connection = c_null_ptr !! libstrophe connection.
type(c_ptr) :: sm_state = c_null_ptr !! libstrophe stream management state.
character(len=IM_HOST_LEN) :: host = ' ' !! XMPP server host.
integer :: port = IM_PORT !! XMPP server port.
character(len=IM_JID_LEN) :: jid = ' ' !! XMPP id of account.
character(len=IM_JID_FULL_LEN) :: jid_full = ' ' !! XMPP id with resource.
character(len=IM_PASSWORD_LEN) :: password = ' ' !! XMPP password of account.
end type im_type

type, public :: im_upload_type
Expand Down Expand Up @@ -336,7 +336,7 @@ module dm_im
! PUBLIC FUNCTIONS.
! ******************************************************************
integer function dm_im_connect(im, host, port, jid, password, callback, user_data, &
resource, keep_alive, tls_required, tls_trusted) result(rc)
resource, keep_alive, tls_required, tls_trusted) result(rc)
!! Connects to XMPP server.
!!
!! The function returns the following error codes:
Expand Down
14 changes: 7 additions & 7 deletions src/dm_lua.f90
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ integer function lua_field_array_string(lua, name, values, unescape) result(rc)
!!
!! * `E_ALLOC` if array allocation failed.
!! * `E_EMPTY` if the field of given name is null.
!! * `E_LIMIT` if a string length is greater than the array length.
!! * `E_BOUNDS` if a string length is greater than the array length.
!! * `E_TYPE` if not a table or not a string element.
!!
!! On error, `values` will be allocated but empty.
Expand Down Expand Up @@ -861,8 +861,8 @@ integer function lua_field_string(lua, name, value, unescape) result(rc)
!! The function returns the following error codes:
!!
!! * `E_EMPTY` if the field of given name is null.
!! * `E_LIMIT` if the actual string length is greater than the length of
!! the passed value argument.
!! * `E_BOUNDS` if the actual string length is greater than the length
!! of the passed value argument.
!! * `E_TYPE` if the field is not of type string.
!!
!! On error, `value` will not be overwritten.
Expand Down Expand Up @@ -892,7 +892,7 @@ integer function lua_field_string(lua, name, value, unescape) result(rc)
value = str
end if

rc = E_LIMIT
rc = E_BOUNDS
if (len(str) > len(value)) exit lua_block

rc = E_NONE
Expand Down Expand Up @@ -1052,8 +1052,8 @@ integer function lua_get_string(lua, i, value, unescape) result(rc)
!!
!! * `E_EMPTY` if the table element of given name is null.
!! * `E_INVALID` if the element on top of the stack is not a table.
!! * `E_LIMIT` if the actual string length is greater than the length of
!! the passed value argument.
!! * `E_BOUNDS` if the actual string length is greater than the length
!! of the passed value argument.
!! * `E_TYPE` if the table element is not of type string.
!!
!! On error, `value` will not be overwritten.
Expand Down Expand Up @@ -1086,7 +1086,7 @@ integer function lua_get_string(lua, i, value, unescape) result(rc)
value = str
end if

rc = E_LIMIT
rc = E_BOUNDS
if (len(str) > len(value)) exit lua_block

rc = E_NONE
Expand Down

0 comments on commit bb2fd42

Please sign in to comment.