libpurple/cmds.h

Sat, 06 Oct 2007 22:46:57 +0000

author
Richard Laager <rlaager@pidgin.im>
date
Sat, 06 Oct 2007 22:46:57 +0000
branch
next.minor
changeset 20806
a91d032c0e9d
parent 20370
f24b280e0c29
child 22051
61dc80506e49
permissions
-rw-r--r--

Remove some TODOs on deprecated code.

9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
1 /**
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
2 * @file cmds.h Commands API
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
3 * @ingroup core
20330
650a7af9c238 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@pidgin.im>
parents: 19859
diff changeset
4 */
650a7af9c238 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@pidgin.im>
parents: 19859
diff changeset
5
650a7af9c238 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@pidgin.im>
parents: 19859
diff changeset
6 /* Copyright (C) 2003 Timothy Ringenbach <omarvo@hotmail.com>
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
7 *
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
11 * (at your option) any later version.
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
12 *
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
16 * GNU General Public License for more details.
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
17 *
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 15884
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
21 *
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
22 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
23 #ifndef _PURPLE_CMDS_H_
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
24 #define _PURPLE_CMDS_H_
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
25
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
26 #include "conversation.h"
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
27
10231
047177cee39f [gaim-migrate @ 11366]
Andrew Hart <arhart@users.sourceforge.net>
parents: 10052
diff changeset
28 /**************************************************************************/
047177cee39f [gaim-migrate @ 11366]
Andrew Hart <arhart@users.sourceforge.net>
parents: 10052
diff changeset
29 /** @name Structures */
047177cee39f [gaim-migrate @ 11366]
Andrew Hart <arhart@users.sourceforge.net>
parents: 10052
diff changeset
30 /**************************************************************************/
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
31 /*@{*/
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
32
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
33 typedef enum _PurpleCmdPriority PurpleCmdPriority;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
34 typedef enum _PurpleCmdFlag PurpleCmdFlag;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
35 typedef enum _PurpleCmdStatus PurpleCmdStatus;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
36 typedef enum _PurpleCmdRet PurpleCmdRet;
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
37
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
38 enum _PurpleCmdStatus {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
39 PURPLE_CMD_STATUS_OK,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
40 PURPLE_CMD_STATUS_FAILED,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
41 PURPLE_CMD_STATUS_NOT_FOUND,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
42 PURPLE_CMD_STATUS_WRONG_ARGS,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
43 PURPLE_CMD_STATUS_WRONG_PRPL,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
44 PURPLE_CMD_STATUS_WRONG_TYPE,
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
45 };
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
46
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
47 enum _PurpleCmdRet {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
48 PURPLE_CMD_RET_OK, /**< Everything's okay. Don't look for another command to call. */
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
49 PURPLE_CMD_RET_FAILED, /**< The command failed, but stop looking.*/
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
50 PURPLE_CMD_RET_CONTINUE, /**< Continue, looking for other commands with the same name to call. */
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
51 };
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
52
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
53 #define PURPLE_CMD_FUNC(func) ((PurpleCmdFunc)func)
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9343
diff changeset
54
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
55 typedef PurpleCmdRet (*PurpleCmdFunc)(PurpleConversation *, const gchar *cmd,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9343
diff changeset
56 gchar **args, gchar **error, void *data);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
57 typedef guint PurpleCmdId;
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
58
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
59 enum _PurpleCmdPriority {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
60 PURPLE_CMD_P_VERY_LOW = -1000,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
61 PURPLE_CMD_P_LOW = 0,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
62 PURPLE_CMD_P_DEFAULT = 1000,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
63 PURPLE_CMD_P_PRPL = 2000,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
64 PURPLE_CMD_P_PLUGIN = 3000,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
65 PURPLE_CMD_P_ALIAS = 4000,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
66 PURPLE_CMD_P_HIGH = 5000,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
67 PURPLE_CMD_P_VERY_HIGH = 6000,
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
68 };
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
69
20370
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
70 /** Flags used to set various properties of commands. Every command should
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
71 * have at least one of #PURPLE_CMD_FLAG_IM and #PURPLE_CMD_FLAG_CHAT set in
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
72 * order to be even slighly useful.
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
73 *
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
74 * @see purple_cmd_register
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
75 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
76 enum _PurpleCmdFlag {
20370
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
77 /** Command is usable in IMs. */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
78 PURPLE_CMD_FLAG_IM = 0x01,
20370
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
79 /** Command is usable in multi-user chats. */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
80 PURPLE_CMD_FLAG_CHAT = 0x02,
20370
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
81 /** Command is usable only for a particular prpl. */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
82 PURPLE_CMD_FLAG_PRPL_ONLY = 0x04,
20370
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
83 /** Incorrect arguments to this command should be accepted anyway. */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
84 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS = 0x08,
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
85 };
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
86
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
87
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
88 /*@}*/
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
89
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
90 #ifdef __cplusplus
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
91 extern "C" {
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
92 #endif
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
93
10231
047177cee39f [gaim-migrate @ 11366]
Andrew Hart <arhart@users.sourceforge.net>
parents: 10052
diff changeset
94 /**************************************************************************/
047177cee39f [gaim-migrate @ 11366]
Andrew Hart <arhart@users.sourceforge.net>
parents: 10052
diff changeset
95 /** @name Commands API */
047177cee39f [gaim-migrate @ 11366]
Andrew Hart <arhart@users.sourceforge.net>
parents: 10052
diff changeset
96 /**************************************************************************/
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
97 /*@{*/
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
98
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
99 /**
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
100 * Register a new command with the core.
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
101 *
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
102 * The command will only happen if commands are enabled,
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
103 * which is a UI pref. UIs don't have to support commands at all.
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
104 *
20370
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
105 * @param cmd The command. This should be a UTF-8 (or ASCII) string, with no spaces
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
106 * or other white space.
20370
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
107 * @param args A string of characters describing to libpurple how to parse this
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
108 * command's arguments. If what the user types doesn't match this
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
109 * pattern, libpurple will keep looking for another command, unless
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
110 * the flag #PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS is passed in @a f.
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
111 * This string should contain no whitespace, and use a single
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
112 * character for each argument. The recognized characters are:
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
113 * <ul>
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
114 * <li><tt>'w'</tt>: Matches a single word.</li>
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
115 * <li><tt>'W'</tt>: Matches a single word, with formatting.</li>
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
116 * <li><tt>'s'</tt>: Matches the rest of the arguments after this
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
117 * point, as a single string.</li>
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
118 * <li><tt>'S'</tt>: Same as <tt>'s'</tt> but with formatting.</li>
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
119 * </ul>
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
120 * If args is the empty string, then the command accepts no arguments.
20370
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
121 * The args passed to the callback @a func will be a @c NULL
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
122 * terminated array of @c NULL terminated strings, and will always
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
123 * match the number of arguments asked for, unless
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
124 * #PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS is passed.
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
125 * @param p This is the priority. Higher priority commands will be run first,
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
126 * and usually the first command will stop any others from being
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
127 * called.
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
128 * @param f Flags specifying various options about this command, combined with
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
129 * <tt>|</tt> (bitwise OR). You need to at least pass one of
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
130 * #PURPLE_CMD_FLAG_IM or #PURPLE_CMD_FLAG_CHAT (you may pass both) in
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
131 * order for the command to ever actually be called.
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
132 * @param prpl_id If the #PURPLE_CMD_FLAG_PRPL_ONLY flag is set, this is the id
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
133 * of the prpl to which the command applies (such as
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
134 * <tt>"prpl-msn"</tt>). If the flag is not set, this parameter
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
135 * is ignored; pass @c NULL (or a humourous string of your
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
136 * choice!).
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
137 * @param func This is the function to call when someone enters this command.
20370
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
138 * @param helpstr a whitespace sensitive, UTF-8, HTML string describing how to
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
139 * use the command. The preferred format of this string is the
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
140 * command's name, followed by a space and any arguments it
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
141 * accepts (if it takes any arguments, otherwise no space),
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
142 * followed by a colon, two spaces, and a description of the
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
143 * command in sentence form. Do not include a slash before the
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
144 * command name.
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
145 * @param data User defined data to pass to the #PurpleCmdFunc @a f.
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
146 * @return A #PurpleCmdId, which is only used for calling
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
147 * #purple_cmd_unregister, or @a 0 on failure.
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
148 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
149 PurpleCmdId purple_cmd_register(const gchar *cmd, const gchar *args, PurpleCmdPriority p, PurpleCmdFlag f,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
150 const gchar *prpl_id, PurpleCmdFunc func, const gchar *helpstr, void *data);
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
151
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
152 /**
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
153 * Unregister a command with the core.
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
154 *
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
155 * All registered commands must be unregistered, if they're registered by a plugin
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
156 * or something else that might go away. Normally this is called when the plugin
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
157 * unloads itself.
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
158 *
20370
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
159 * @param id The #PurpleCmdId to unregister, as returned by #purple_cmd_register.
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
160 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
161 void purple_cmd_unregister(PurpleCmdId id);
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
162
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
163 /**
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
164 * Do a command.
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
165 *
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
166 * Normally the UI calls this to perform a command. This might also be useful
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
167 * if aliases are ever implemented.
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
168 *
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
169 * @param conv The conversation the command was typed in.
9175
50bd82a24830 [gaim-migrate @ 9970]
Tim Ringenbach <marv@pidgin.im>
parents: 9143
diff changeset
170 * @param cmdline The command the user typed (including all arguments) as a single string.
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
171 * The caller doesn't have to do any parsing, except removing the command
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9343
diff changeset
172 * prefix, which the core has no knowledge of. cmd should not contain any
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9343
diff changeset
173 * formatting, and should be in plain text (no html entities).
9175
50bd82a24830 [gaim-migrate @ 9970]
Tim Ringenbach <marv@pidgin.im>
parents: 9143
diff changeset
174 * @param markup This is the same as cmd, but is the formatted version. It should be in
50bd82a24830 [gaim-migrate @ 9970]
Tim Ringenbach <marv@pidgin.im>
parents: 9143
diff changeset
175 * HTML, with < > and &, at least, escaped to html entities, and should
50bd82a24830 [gaim-migrate @ 9970]
Tim Ringenbach <marv@pidgin.im>
parents: 9143
diff changeset
176 * include both the default formatting and any extra manual formatting.
10788
79d6a09303e7 [gaim-migrate @ 12429]
Richard Laager <rlaager@pidgin.im>
parents: 10231
diff changeset
177 * @param errormsg If the command failed errormsg is filled in with the appropriate error
79d6a09303e7 [gaim-migrate @ 12429]
Richard Laager <rlaager@pidgin.im>
parents: 10231
diff changeset
178 * message. It must be freed by the caller with g_free().
20370
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
179 * @return A #PurpleCmdStatus indicated if the command succeeded or failed.
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
180 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
181 PurpleCmdStatus purple_cmd_do_command(PurpleConversation *conv, const gchar *cmdline,
9175
50bd82a24830 [gaim-migrate @ 9970]
Tim Ringenbach <marv@pidgin.im>
parents: 9143
diff changeset
182 const gchar *markup, gchar **errormsg);
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
183
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
184 /**
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
185 * List registered commands.
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
186 *
20370
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
187 * Returns a <tt>GList</tt> (which must be freed by the caller) of all commands
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
188 * that are valid in the context of @a conv, or all commands, if @a conv is @c
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
189 * NULL. Don't keep this list around past the main loop, or anything else that
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
190 * might unregister a command, as the <tt>const char *</tt>'s used get freed
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
191 * then.
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
192 *
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
193 * @param conv The conversation, or @c NULL.
20370
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
194 * @return A @c GList of <tt>const char *</tt>, which must be freed with
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
195 * <tt>g_list_free()</tt>.
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
196 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
197 GList *purple_cmd_list(PurpleConversation *conv);
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
198
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
199 /**
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
200 * Get the help string for a command.
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
201 *
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
202 * Returns the help strings for a given command in the form of a GList,
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
203 * one node for each matching command.
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
204 *
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
205 * @param conv The conversation, or @c NULL for no context.
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
206 * @param cmd The command. No wildcards accepted, but returns help for all
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
207 * commands if @c NULL.
20370
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20330
diff changeset
208 * @return A <tt>GList</tt> of <tt>const char *</tt>s, which is the help string
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
209 * for that command.
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
210 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
211 GList *purple_cmd_help(PurpleConversation *conv, const gchar *cmd);
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
212
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
213 /*@}*/
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
214
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
215 #ifdef __cplusplus
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
216 }
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
217 #endif
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
218
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
219 #endif /* _PURPLE_CMDS_H_ */

mercurial