about summary refs log tree commit diff stats
path: root/src/resource.h
blob: 79a3bf9f043fa8777b48b416006413b5e5447158 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
 * resource.h
 *
 * Copyright (C) 2012 - 2016 James Booth <boothj5@gmail.com>
 *
 * This file is part of Profanity.
 *
 * Profanity 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.
 *
 * Profanity 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 Profanity.  If not, see <http://www.gnu.org/licenses/>.
 *
 * In addition, as a special exception, the copyright holders give permission to
 * link the code of portions of this program with the OpenSSL library under
 * certain conditions as described in each individual source file, and
 * distribute linked combinations including the two.
 *
 * You must obey the GNU General Public License in all respects for all of the
 * code used other than OpenSSL. If you modify file(s) with this exception, you
 * may extend this exception to your version of the file(s), but you are not
 * obligated to do so. If you do not wish to do so, delete this exception
 * statement from your version. If you delete this exception statement from all
 * source files in the program, then also delete it here.
 *
 */

#ifndef RESOURCE_H
#define RESOURCE_H

#include "common.h"

typedef struct resource_t {
    char *name;
    resource_presence_t presence;
    char *status;
    int priority;
} Resource;

Resource* resource_new(const char *const name, resource_presence_t presence, const char *const status,
    const int priority);
void resource_destroy(Resource *resource);
int resource_compare_availability(Resource *first, Resource *second);

#endif
* * base - the plugin's base name (eg. the directory it needs to be installed in) * author - Author of the plugin * email - Email address to contact the author * date - Last modified date of the plugin in YYYY-MM-DD format * name - Name of the plugin * desc - Short description of the plugin (Text only) * url - Website with more information on the plugin (eg. syntax description) */ public function getInfo(); /** * The type of the plugin inferred from the class name * * @return string plugin type */ public function getPluginType(); /** * The name of the plugin inferred from the class name * * @return string plugin name */ public function getPluginName(); /** * The component part of the plugin inferred from the class name * * @return string component name */ public function getPluginComponent(); /** * Access plugin language strings * * to try to minimise unnecessary loading of the strings when the plugin doesn't require them * e.g. when info plugin is querying plugins for information about themselves. * * @param string $id id of the string to be retrieved * @return string in appropriate language or english if not available */ public function getLang($id); /** * retrieve a language dependent file and pass to xhtml renderer for display * plugin equivalent of p_locale_xhtml() * * @param string $id id of language dependent wiki page * @return string parsed contents of the wiki page in xhtml format */ public function locale_xhtml($id); /** * Prepends appropriate path for a language dependent filename * plugin equivalent of localFN() * * @param string $id id of localization file * @param string $ext The file extension (usually txt) * @return string wiki text */ public function localFN($id, $ext = 'txt'); /** * Reads all the plugins language dependent strings into $this->lang * this function is automatically called by getLang() * * @todo this could be made protected and be moved to the trait only */ public function setupLocale(); /** * use this function to access plugin configuration variables * * @param string $setting the setting to access * @param mixed $notset what to return if the setting is not available * @return mixed */ public function getConf($setting, $notset = false); /** * merges the plugin's default settings with any local settings * this function is automatically called through getConf() * * @todo this could be made protected and be moved to the trait only */ public function loadConfig(); /** * Loads a given helper plugin (if enabled) * * @author Esther Brunner <wikidesign@gmail.com> * * @param string $name name of plugin to load * @param bool $msg if a message should be displayed in case the plugin is not available * @return DokuWiki_PluginInterface|null helper plugin object */ public function loadHelper($name, $msg = true); /** * email * standardised function to generate an email link according to obfuscation settings * * @param string $email * @param string $name * @param string $class * @param string $more * @return string html */ public function email($email, $name = '', $class = '', $more = ''); /** * external_link * standardised function to generate an external link according to conf settings * * @param string $link * @param string $title * @param string $class * @param string $target * @param string $more * @return string */ public function external_link($link, $title = '', $class = '', $target = '', $more = ''); /** * output text string through the parser, allows dokuwiki markup to be used * very ineffecient for small pieces of data - try not to use * * @param string $text wiki markup to parse * @param string $format output format * @return null|string */ public function render_text($text, $format = 'xhtml'); /** * Allow the plugin to prevent DokuWiki from reusing an instance * * @return bool false if the plugin has to be instantiated */ public function isSingleton(); }