View Source Bonfire.Common.AntiSpam.Provider behaviour (Bonfire v0.9.11-social-beta.6)

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

result()

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

spam_result()

@type spam_result() :: :ham | :spam | :discard

Callbacks

check_comment(comment_body, is_reply?, context)

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

Check a comment (or microblog) details

check_current_user(context)

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

Check an user/account's details

check_object(body, context)

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

Check an object details (such as a blog post)

check_profile(summary, context)

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

Check profile info

ready?()

@callback ready?() :: boolean()

Make sure the provider is ready

report_ham(user, text)

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

report_spam(user, text)

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