comparison src/cmds.h @ 9597:d6f398e80b32

[gaim-migrate @ 10440] denyri added a void *data argument to most of the command related functions. This makes it easier for language binding and such. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Mon, 26 Jul 2004 03:27:03 +0000
parents 5f6ba17ef9f5
children db62420a53a2
comparison
equal deleted inserted replaced
9596:7b3212aa698c 9597:d6f398e80b32
48 GAIM_CMD_RET_OK, /**< Everything's okay. Don't look for another command to call. */ 48 GAIM_CMD_RET_OK, /**< Everything's okay. Don't look for another command to call. */
49 GAIM_CMD_RET_FAILED, /**< The command failed, but stop looking.*/ 49 GAIM_CMD_RET_FAILED, /**< The command failed, but stop looking.*/
50 GAIM_CMD_RET_CONTINUE, /**< Continue, looking for other commands with the same name to call. */ 50 GAIM_CMD_RET_CONTINUE, /**< Continue, looking for other commands with the same name to call. */
51 }; 51 };
52 52
53 typedef GaimCmdRet (*GaimCmdFunc)(GaimConversation *, const gchar *cmd, gchar **args, gchar **error); 53 #define GAIM_CMD_FUNC(func) ((GaimCmdFunc)func)
54
55 typedef GaimCmdRet (*GaimCmdFunc)(GaimConversation *, const gchar *cmd,
56 gchar **args, gchar **error, void *data);
54 typedef guint GaimCmdId; 57 typedef guint GaimCmdId;
55 58
56 enum _GaimCmdPriority { 59 enum _GaimCmdPriority {
57 GAIM_CMD_P_VERY_LOW = -1000, 60 GAIM_CMD_P_VERY_LOW = -1000,
58 GAIM_CMD_P_LOW = 0, 61 GAIM_CMD_P_LOW = 0,
118 * before the command name. 121 * before the command name.
119 * @return A GaimCmdId. This is only used for calling gaim_cmd_unregister. 122 * @return A GaimCmdId. This is only used for calling gaim_cmd_unregister.
120 * Returns @c NULL on failure. 123 * Returns @c NULL on failure.
121 */ 124 */
122 GaimCmdId gaim_cmd_register(const gchar *cmd, const gchar *args, GaimCmdPriority p, GaimCmdFlag f, 125 GaimCmdId gaim_cmd_register(const gchar *cmd, const gchar *args, GaimCmdPriority p, GaimCmdFlag f,
123 const gchar *prpl_id, GaimCmdFunc func, const gchar *helpstr); 126 const gchar *prpl_id, GaimCmdFunc func, const gchar *helpstr, void *data);
124 127
125 /** 128 /**
126 * Unregister a command with the core. 129 * Unregister a command with the core.
127 * 130 *
128 * All registered commands must be unregistered, if they're registered by a plugin 131 * All registered commands must be unregistered, if they're registered by a plugin
140 * if aliases are ever implemented. 143 * if aliases are ever implemented.
141 * 144 *
142 * @param conv The conversation the command was typed in. 145 * @param conv The conversation the command was typed in.
143 * @param cmdline The command the user typed (including all arguments) as a single string. 146 * @param cmdline The command the user typed (including all arguments) as a single string.
144 * The caller doesn't have to do any parsing, except removing the command 147 * The caller doesn't have to do any parsing, except removing the command
145 * prefix, which the core has no knowledge of. cmd should not contain the 148 * prefix, which the core has no knowledge of. cmd should not contain any
146 * any formatting, and should be in plain text (no html entities). 149 * formatting, and should be in plain text (no html entities).
147 * @param markup This is the same as cmd, but is the formatted version. It should be in 150 * @param markup This is the same as cmd, but is the formatted version. It should be in
148 * HTML, with < > and &, at least, escaped to html entities, and should 151 * HTML, with < > and &, at least, escaped to html entities, and should
149 * include both the default formatting and any extra manual formatting. 152 * include both the default formatting and any extra manual formatting.
150 * @param errormsg If the command failed and errormsg is not NULL, it is filled in with 153 * @param errormsg If the command failed and errormsg is not NULL, it is filled in with
151 * the appropriate error message. It should be freed by the caller with 154 * the appropriate error message. It should be freed by the caller with