View Source Bonfire.Common.AntiSpam.Provider behaviour (Bonfire v0.9.10-classic-beta.169)

Provider Behaviour for anti-spam detection.

Supported backends

Credit to https://joinmobilizon.org for the original code.

Summary

Callbacks

Check a comment (or microblog) details

Check an user/account's details

Check an object details (such as a blog post)

Check profile info

Make sure the provider is ready

Types

@type result() :: spam_result() | {:error, any()}
@type spam_result() :: :ham | :spam | :discard

Callbacks

Link to this callback

check_comment(comment_body, is_reply?, context)

View Source
@callback check_comment(
  comment_body :: String.t(),
  is_reply? :: boolean(),
  context :: any()
) :: result()

Check a comment (or microblog) details

Link to this callback

check_current_user(context)

View Source
@callback check_current_user(context :: any()) :: result()

Check an user/account's details

Link to this callback

check_object(body, context)

View Source
@callback check_object(
  body :: String.t(),
  context :: any()
) :: result()

Check an object details (such as a blog post)

Link to this callback

check_profile(summary, context)

View Source
@callback check_profile(
  summary :: String.t(),
  context :: any()
) :: result()

Check profile info

@callback ready?() :: boolean()

Make sure the provider is ready

@callback report_ham(user :: any(), text :: String.t() | nil) ::
  :ok | {:error, atom()} | {:error, HTTPoison.Response.t()}
@callback report_spam(user :: any(), text :: String.t() | nil) ::
  :ok | {:error, atom()} | {:error, HTTPoison.Response.t()}