You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
vulpes/vulpes_mod_api.h

88 lines
2.8 KiB

/*
* vim: expandtab:ts=2:sts=2:sw=2
*
* Copyright (C) 2021 Stefan Kropp
*
* This file is part of vulpes.
*
* vulpes is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* vulpes is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with vulpes. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VULPES_MOD_API_H__
#define VULPES_MOD_API_H__
#include "src/vulpes.h"
/*! \file vulpes_mod_api.h
*
* \authors
* Stefan Kropp
*
* \copyright
* Copyright (C) 2021 Stefan Kropp
*/
/*!
* \page vulpes_mod_api vulpes mod API
* \tableofcontents
*
* \section moduleapi API
* API for vulpes modules.
*
*/
typedef int (*mod_callback_t)(xmpp_conn_t *const conn,
xmpp_stanza_t *const stanza,
void *const userdata);
// List of vulpes_xmpp_adr_t
GList *mod_api_get_admin_list(const vulpes_ctx_t *const vulpes_ctx);
vulpes_err_code_t mod_api_request_roster(const vulpes_ctx_t *const vulpes_ctx,
mod_callback_t callback);
void mod_api_backend_create(const char *const tablename,
const char *const tabledef);
void mod_api_backend_insert(const char *const table, const char *const c[],
const char *const v[], int size);
gboolean is_admin(const vulpes_ctx_t *const vulpes_ctx,
const vulpes_xmpp_adr_t *const xmpp_adr);
vulpes_xmpp_adr_t *
mod_api_get_operator_muc(const vulpes_ctx_t *const vulpes_ctx);
vulpes_err_code_t mod_api_send_chat_message(vulpes_ctx_t *vulpes_ctx,
const vulpes_xmpp_adr_t *const to,
const char *const message);
vulpes_err_code_t
mod_api_send_groupchat_message(vulpes_ctx_t *vulpes_ctx,
const vulpes_xmpp_adr_t *const to,
const char *const message);
vulpes_err_code_t mod_api_send(xmpp_stanza_t *stanza, mod_callback_t callback,
void *userdata);
void mod_api_handler_add(vulpes_ctx_t *vulpes_ctx, mod_callback_t,
const char *ns, const char *name, const char *type,
void *userdata);
xmpp_conn_t *const vulpes_get_connection(const vulpes_ctx_t *const vulpes_ctx);
char* const mod_api_settings_get_value(const char * mod, const char* key);
#endif // VULPES_MOD_API_H__