pidgin 2.14.14dev
Loading...
Searching...
No Matches
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/**************************************************************************/
34typedef struct _PurpleCmd PurpleCmd;
35
37typedef enum _PurpleCmdStatus {
38 PURPLE_CMD_STATUS_OK,
39 PURPLE_CMD_STATUS_FAILED,
40 PURPLE_CMD_STATUS_NOT_FOUND,
41 PURPLE_CMD_STATUS_WRONG_ARGS,
42 PURPLE_CMD_STATUS_WRONG_PRPL,
43 PURPLE_CMD_STATUS_WRONG_TYPE
45
58
59#define PURPLE_CMD_FUNC(func) ((PurpleCmdFunc)func)
60
65typedef PurpleCmdRet (*PurpleCmdFunc)(PurpleConversation *, const gchar *cmd,
66 gchar **args, gchar **error, void *data);
71typedef guint PurpleCmdId;
72
73typedef enum _PurpleCmdPriority {
74 PURPLE_CMD_P_VERY_LOW = -1000,
75 PURPLE_CMD_P_LOW = 0,
76 PURPLE_CMD_P_DEFAULT = 1000,
77 PURPLE_CMD_P_PRPL = 2000,
78 PURPLE_CMD_P_PLUGIN = 3000,
79 PURPLE_CMD_P_ALIAS = 4000,
80 PURPLE_CMD_P_HIGH = 5000,
81 PURPLE_CMD_P_VERY_HIGH = 6000
82} PurpleCmdPriority;
83
100
107typedef struct
108{
110 /* @see purple_cmd_register for the argument values. */
111 void (*register_command)(const gchar *name, PurpleCmdPriority priority,
112 PurpleCmdFlag flags, const gchar *prpl_id,
113 const gchar *help, PurpleCmd *cmd);
114
119 void (*unregister_command)(const gchar *name, const gchar *prpl_id);
120
121 void (*_purple_reserved1)(void);
122 void (*_purple_reserved2)(void);
123 void (*_purple_reserved3)(void);
124 void (*_purple_reserved4)(void);
126
129#ifdef __cplusplus
130extern "C" {
131#endif
132
133/**************************************************************************/
135/**************************************************************************/
188PurpleCmdId purple_cmd_register(const gchar *cmd, const gchar *args, PurpleCmdPriority p, PurpleCmdFlag f,
189 const gchar *prpl_id, PurpleCmdFunc func, const gchar *helpstr, void *data);
190
201
221 const gchar *markup, gchar **errormsg);
222
237gboolean purple_cmd_execute(PurpleCmd *c, PurpleConversation *conv,
238 const gchar *cmdline);
239
254
267GList *purple_cmd_help(PurpleConversation *conv, const gchar *cmd);
268
275
284
292
298
304
307#ifdef __cplusplus
308}
309#endif
310
311#endif /* _PURPLE_CMDS_H_ */
_PurpleCmdRet
Commands registered with the core return one of these values when run.
Definition cmds.h:53
@ PURPLE_CMD_RET_CONTINUE
Continue, looking for other commands with the same name to call.
Definition cmds.h:56
@ PURPLE_CMD_RET_FAILED
The command failed, but stop looking.
Definition cmds.h:55
@ PURPLE_CMD_RET_OK
Everything's okay; Don't look for another command to call.
Definition cmds.h:54
gboolean purple_cmd_execute(PurpleCmd *c, PurpleConversation *conv, const gchar *cmdline)
Execute a specific command.
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.
enum _PurpleCmdFlag PurpleCmdFlag
Flags used to set various properties of commands.
GList * purple_cmd_list(PurpleConversation *conv)
List registered commands.
GList * purple_cmd_help(PurpleConversation *conv, const gchar *cmd)
Get the help string for a command.
void purple_cmds_set_ui_ops(PurpleCommandsUiOps *ops)
Sets the UI operations structure to be used when registering and unregistering commands.
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:65
_PurpleCmdFlag
Flags used to set various properties of commands.
Definition cmds.h:90
@ PURPLE_CMD_FLAG_PRPL_ONLY
Command is usable only for a particular prpl.
Definition cmds.h:96
@ PURPLE_CMD_FLAG_IM
Command is usable in IMs.
Definition cmds.h:92
@ PURPLE_CMD_FLAG_CHAT
Command is usable in multi-user chats.
Definition cmds.h:94
@ PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS
Incorrect arguments to this command should be accepted anyway.
Definition cmds.h:98
gpointer purple_cmds_get_handle(void)
Get the handle for the commands API.
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:71
_PurpleCmdStatus
The possible results of running a command with purple_cmd_do_command().
Definition cmds.h:37
enum _PurpleCmdStatus PurpleCmdStatus
The possible results of running a command with purple_cmd_do_command().
void purple_cmds_uninit(void)
Uninitialize the commands subsystem.
void purple_cmds_init(void)
Initialize the commands subsystem.
PurpleCommandsUiOps * purple_cmds_get_ui_ops(void)
Returns the UI operations structure to be used when registering and unregistering commands.
void purple_cmd_unregister(PurpleCmdId id)
Unregister a command with the core.
Conversation API.
Command UI operations; UIs should implement this if they want to handle commands themselves,...
Definition cmds.h:108
A core representation of a conversation between two or more people.