File: mod_invites.hrl

package info (click to toggle)
ejabberd 26.02-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 15,396 kB
  • sloc: erlang: 122,646; sh: 4,258; sql: 3,633; perl: 869; makefile: 559; javascript: 216; python: 48
file content (18 lines) | stat: -rw-r--r-- 1,232 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
-define(INVITE_TOKEN_EXPIRE_SECONDS_DEFAULT, 5*86400).
-define(INVITE_TOKEN_LENGTH_DEFAULT, 24).

-define(NS_INVITE_INVITE, <<"urn:xmpp:invite#invite">>).
-define(NS_INVITE_CREATE_ACCOUNT, <<"urn:xmpp:invite#create-account">>).

-record(invite_token, {token :: binary(),
                       inviter :: {binary(), binary()},
                       %% A non-empty value if `invitee` indicates the invite has been used.
                       invitee = <<>> :: binary(),
                       created_at = calendar:now_to_datetime(erlang:timestamp()) :: calendar:datetime(),
                       expires = calendar:gregorian_seconds_to_datetime(calendar:datetime_to_gregorian_seconds(calendar:now_to_datetime(erlang:timestamp())) + ?INVITE_TOKEN_EXPIRE_SECONDS_DEFAULT) :: calendar:datetime(),
                       type = roster_only :: roster_only | account_only | account_subscription,
                       %% If type is 'roster_only' then we indicate a token has been used to create
                       %% an account (if allowed) by setting `account_name` to the name of the user
                       %% (which should match `invitee`).
                       account_name = <<>> :: binary()
                      }).