cmds.h
Go to the documentation of this file.
1 
7 /* Copyright (C) 2003 Timothy Ringenbach <omarvo@hotmail.com>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
22  *
23  */
24 #ifndef _PURPLE_CMDS_H_
25 #define _PURPLE_CMDS_H_
26 
27 #include "conversation.h"
28 
29 /**************************************************************************/
31 /**************************************************************************/
35 typedef enum _PurpleCmdStatus {
36  PURPLE_CMD_STATUS_OK,
37  PURPLE_CMD_STATUS_FAILED,
38  PURPLE_CMD_STATUS_NOT_FOUND,
39  PURPLE_CMD_STATUS_WRONG_ARGS,
40  PURPLE_CMD_STATUS_WRONG_PRPL,
41  PURPLE_CMD_STATUS_WRONG_TYPE
43 
51 typedef enum _PurpleCmdRet {
55 } PurpleCmdRet;
56 
57 #define PURPLE_CMD_FUNC(func) ((PurpleCmdFunc)func)
58 
63 typedef PurpleCmdRet (*PurpleCmdFunc)(PurpleConversation *, const gchar *cmd,
64  gchar **args, gchar **error, void *data);
69 typedef guint PurpleCmdId;
70 
71 typedef enum _PurpleCmdPriority {
72  PURPLE_CMD_P_VERY_LOW = -1000,
73  PURPLE_CMD_P_LOW = 0,
74  PURPLE_CMD_P_DEFAULT = 1000,
75  PURPLE_CMD_P_PRPL = 2000,
76  PURPLE_CMD_P_PLUGIN = 3000,
77  PURPLE_CMD_P_ALIAS = 4000,
78  PURPLE_CMD_P_HIGH = 5000,
79  PURPLE_CMD_P_VERY_HIGH = 6000
80 } PurpleCmdPriority;
81 
88 typedef enum _PurpleCmdFlag {
98 
99 
102 #ifdef __cplusplus
103 extern "C" {
104 #endif
105 
106 /**************************************************************************/
108 /**************************************************************************/
161 PurpleCmdId purple_cmd_register(const gchar *cmd, const gchar *args, PurpleCmdPriority p, PurpleCmdFlag f,
162  const gchar *prpl_id, PurpleCmdFunc func, const gchar *helpstr, void *data);
163 
174 
193 PurpleCmdStatus purple_cmd_do_command(PurpleConversation *conv, const gchar *cmdline,
194  const gchar *markup, gchar **errormsg);
195 
209 GList *purple_cmd_list(PurpleConversation *conv);
210 
223 GList *purple_cmd_help(PurpleConversation *conv, const gchar *cmd);
224 
230 gpointer purple_cmds_get_handle(void);
231 
236 void purple_cmds_init(void);
237 
242 void purple_cmds_uninit(void);
243 
246 #ifdef __cplusplus
247 }
248 #endif
249 
250 #endif /* _PURPLE_CMDS_H_ */
void purple_cmds_init(void)
Initialize the commands subsystem.
The command failed, but stop looking.
Definition: cmds.h:53
enum _PurpleCmdRet PurpleCmdRet
Commands registered with the core return one of these values when run.
PurpleCmdStatus purple_cmd_do_command(PurpleConversation *conv, const gchar *cmdline, const gchar *markup, gchar **errormsg)
Do a command.
PurpleCmdId purple_cmd_register(const gchar *cmd, const gchar *args, PurpleCmdPriority p, PurpleCmdFlag f, const gchar *prpl_id, PurpleCmdFunc func, const gchar *helpstr, void *data)
Register a new command with the core.
guint PurpleCmdId
A unique integer representing a command registered with purple_cmd_register(), which can subsequently...
Definition: cmds.h:69
Command is usable only for a particular prpl.
Definition: cmds.h:94
Conversation API.
_PurpleCmdRet
Commands registered with the core return one of these values when run.
Definition: cmds.h:51
Command is usable in IMs.
Definition: cmds.h:90
_PurpleCmdStatus
The possible results of running a command with purple_cmd_do_command().
Definition: cmds.h:35
void purple_cmd_unregister(PurpleCmdId id)
Unregister a command with the core.
GList * purple_cmd_help(PurpleConversation *conv, const gchar *cmd)
Get the help string for a command.
Command is usable in multi-user chats.
Definition: cmds.h:92
enum _PurpleCmdStatus PurpleCmdStatus
The possible results of running a command with purple_cmd_do_command().
Everything&#39;s okay; Don&#39;t look for another command to call.
Definition: cmds.h:52
enum _PurpleCmdFlag PurpleCmdFlag
Flags used to set various properties of commands.
Incorrect arguments to this command should be accepted anyway.
Definition: cmds.h:96
GList * purple_cmd_list(PurpleConversation *conv)
List registered commands.
gpointer purple_cmds_get_handle(void)
Get the handle for the commands API.
void purple_cmds_uninit(void)
Uninitialize the commands subsystem.
_PurpleCmdFlag
Flags used to set various properties of commands.
Definition: cmds.h:88
Continue, looking for other commands with the same name to call.
Definition: cmds.h:54
A core representation of a conversation between two or more people.
Definition: conversation.h:335
PurpleCmdRet(* PurpleCmdFunc)(PurpleConversation *, const gchar *cmd, gchar **args, gchar **error, void *data)
A function implementing a command, as passed to purple_cmd_register().
Definition: cmds.h:63