Fri, 31 Jan 2014 18:23:41 +0530
Merged gtkdoc-conversion branch
| 9130 | 1 | /** |
| 2 | * @file cmds.h Commands API | |
| 3 | * @ingroup core | |
|
23555
82dab41b4163
cmd-added and cmd-removed signals to emit when commands are registered/unregistered.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23510
diff
changeset
|
4 | * @see @ref cmd-signals |
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
5 | */ |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
6 | |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
7 | /* Copyright (C) 2003 Timothy Ringenbach <omarvo@hotmail.com> |
| 9130 | 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 | |
|
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
|
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 9130 | 22 | * |
| 23 | */ | |
| 15884 | 24 | #ifndef _PURPLE_CMDS_H_ |
| 25 | #define _PURPLE_CMDS_H_ | |
| 9130 | 26 | |
| 27 | #include "conversation.h" | |
| 28 | ||
|
10231
047177cee39f
[gaim-migrate @ 11366]
Andrew Hart <arhart@users.sourceforge.net>
parents:
10052
diff
changeset
|
29 | /**************************************************************************/ |
|
047177cee39f
[gaim-migrate @ 11366]
Andrew Hart <arhart@users.sourceforge.net>
parents:
10052
diff
changeset
|
30 | /** @name Structures */ |
|
047177cee39f
[gaim-migrate @ 11366]
Andrew Hart <arhart@users.sourceforge.net>
parents:
10052
diff
changeset
|
31 | /**************************************************************************/ |
| 9130 | 32 | /*@{*/ |
| 33 | ||
|
23510
d4f5493b1c26
Document a few types in cmds, partly to make doxygen links to those types work.
Will Thompson <resiak@pidgin.im>
parents:
23420
diff
changeset
|
34 | /** The possible results of running a command with purple_cmd_do_command(). */ |
|
32206
a2c62b07ae5a
Please correct me if I'm wrong, but I don't think we gain anything
Mark Doliner <markdoliner@pidgin.im>
parents:
25105
diff
changeset
|
35 | typedef enum { |
| 15884 | 36 | PURPLE_CMD_STATUS_OK, |
| 37 | PURPLE_CMD_STATUS_FAILED, | |
| 38 | PURPLE_CMD_STATUS_NOT_FOUND, | |
| 39 | PURPLE_CMD_STATUS_WRONG_ARGS, | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
40 | PURPLE_CMD_STATUS_WRONG_PROTOCOL, |
|
25105
fe13c190ca13
Remove the commas at the end of enumerator lists. This resolves warnings
Florian Quèze <florian@instantbird.org>
parents:
23555
diff
changeset
|
41 | PURPLE_CMD_STATUS_WRONG_TYPE |
|
22051
61dc80506e49
C++ doesn't really allow forward declarations of enums, and we
Mark Doliner <markdoliner@pidgin.im>
parents:
20370
diff
changeset
|
42 | } PurpleCmdStatus; |
| 9130 | 43 | |
|
23510
d4f5493b1c26
Document a few types in cmds, partly to make doxygen links to those types work.
Will Thompson <resiak@pidgin.im>
parents:
23420
diff
changeset
|
44 | /** Commands registered with the core return one of these values when run. |
|
d4f5493b1c26
Document a few types in cmds, partly to make doxygen links to those types work.
Will Thompson <resiak@pidgin.im>
parents:
23420
diff
changeset
|
45 | * Normally, a command will want to return one of the first two; in some |
|
d4f5493b1c26
Document a few types in cmds, partly to make doxygen links to those types work.
Will Thompson <resiak@pidgin.im>
parents:
23420
diff
changeset
|
46 | * unusual cases, you might want to have several functions called for a |
|
d4f5493b1c26
Document a few types in cmds, partly to make doxygen links to those types work.
Will Thompson <resiak@pidgin.im>
parents:
23420
diff
changeset
|
47 | * particular command; in this case, they should return |
|
d4f5493b1c26
Document a few types in cmds, partly to make doxygen links to those types work.
Will Thompson <resiak@pidgin.im>
parents:
23420
diff
changeset
|
48 | * #PURPLE_CMD_RET_CONTINUE to cause the core to fall through to other |
|
d4f5493b1c26
Document a few types in cmds, partly to make doxygen links to those types work.
Will Thompson <resiak@pidgin.im>
parents:
23420
diff
changeset
|
49 | * commands with the same name. |
|
d4f5493b1c26
Document a few types in cmds, partly to make doxygen links to those types work.
Will Thompson <resiak@pidgin.im>
parents:
23420
diff
changeset
|
50 | */ |
|
32206
a2c62b07ae5a
Please correct me if I'm wrong, but I don't think we gain anything
Mark Doliner <markdoliner@pidgin.im>
parents:
25105
diff
changeset
|
51 | typedef enum { |
|
23510
d4f5493b1c26
Document a few types in cmds, partly to make doxygen links to those types work.
Will Thompson <resiak@pidgin.im>
parents:
23420
diff
changeset
|
52 | PURPLE_CMD_RET_OK, /**< Everything's okay; Don't look for another command to call. */ |
| 15884 | 53 | PURPLE_CMD_RET_FAILED, /**< The command failed, but stop looking.*/ |
|
25105
fe13c190ca13
Remove the commas at the end of enumerator lists. This resolves warnings
Florian Quèze <florian@instantbird.org>
parents:
23555
diff
changeset
|
54 | PURPLE_CMD_RET_CONTINUE /**< Continue, looking for other commands with the same name to call. */ |
|
22051
61dc80506e49
C++ doesn't really allow forward declarations of enums, and we
Mark Doliner <markdoliner@pidgin.im>
parents:
20370
diff
changeset
|
55 | } PurpleCmdRet; |
| 9130 | 56 | |
| 15884 | 57 | #define PURPLE_CMD_FUNC(func) ((PurpleCmdFunc)func) |
| 9597 | 58 | |
|
23510
d4f5493b1c26
Document a few types in cmds, partly to make doxygen links to those types work.
Will Thompson <resiak@pidgin.im>
parents:
23420
diff
changeset
|
59 | /** A function implementing a command, as passed to purple_cmd_register(). |
|
d4f5493b1c26
Document a few types in cmds, partly to make doxygen links to those types work.
Will Thompson <resiak@pidgin.im>
parents:
23420
diff
changeset
|
60 | * |
|
d4f5493b1c26
Document a few types in cmds, partly to make doxygen links to those types work.
Will Thompson <resiak@pidgin.im>
parents:
23420
diff
changeset
|
61 | * @todo document the arguments to these functions. |
|
d4f5493b1c26
Document a few types in cmds, partly to make doxygen links to those types work.
Will Thompson <resiak@pidgin.im>
parents:
23420
diff
changeset
|
62 | * */ |
| 15884 | 63 | typedef PurpleCmdRet (*PurpleCmdFunc)(PurpleConversation *, const gchar *cmd, |
| 9597 | 64 | gchar **args, gchar **error, void *data); |
|
23510
d4f5493b1c26
Document a few types in cmds, partly to make doxygen links to those types work.
Will Thompson <resiak@pidgin.im>
parents:
23420
diff
changeset
|
65 | /** A unique integer representing a command registered with |
|
d4f5493b1c26
Document a few types in cmds, partly to make doxygen links to those types work.
Will Thompson <resiak@pidgin.im>
parents:
23420
diff
changeset
|
66 | * purple_cmd_register(), which can subsequently be passed to |
|
d4f5493b1c26
Document a few types in cmds, partly to make doxygen links to those types work.
Will Thompson <resiak@pidgin.im>
parents:
23420
diff
changeset
|
67 | * purple_cmd_unregister() to unregister that command. |
|
d4f5493b1c26
Document a few types in cmds, partly to make doxygen links to those types work.
Will Thompson <resiak@pidgin.im>
parents:
23420
diff
changeset
|
68 | */ |
| 15884 | 69 | typedef guint PurpleCmdId; |
| 9130 | 70 | |
|
32206
a2c62b07ae5a
Please correct me if I'm wrong, but I don't think we gain anything
Mark Doliner <markdoliner@pidgin.im>
parents:
25105
diff
changeset
|
71 | typedef enum { |
| 15884 | 72 | PURPLE_CMD_P_VERY_LOW = -1000, |
| 73 | PURPLE_CMD_P_LOW = 0, | |
| 74 | PURPLE_CMD_P_DEFAULT = 1000, | |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
75 | PURPLE_CMD_P_PROTOCOL = 2000, |
| 15884 | 76 | PURPLE_CMD_P_PLUGIN = 3000, |
| 77 | PURPLE_CMD_P_ALIAS = 4000, | |
| 78 | PURPLE_CMD_P_HIGH = 5000, | |
|
25105
fe13c190ca13
Remove the commas at the end of enumerator lists. This resolves warnings
Florian Quèze <florian@instantbird.org>
parents:
23555
diff
changeset
|
79 | PURPLE_CMD_P_VERY_HIGH = 6000 |
|
22051
61dc80506e49
C++ doesn't really allow forward declarations of enums, and we
Mark Doliner <markdoliner@pidgin.im>
parents:
20370
diff
changeset
|
80 | } PurpleCmdPriority; |
| 9130 | 81 | |
|
20370
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
82 | /** 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:
20147
diff
changeset
|
83 | * 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:
20147
diff
changeset
|
84 | * order to be even slighly useful. |
|
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
85 | * |
|
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
86 | * @see purple_cmd_register |
|
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
87 | */ |
|
32206
a2c62b07ae5a
Please correct me if I'm wrong, but I don't think we gain anything
Mark Doliner <markdoliner@pidgin.im>
parents:
25105
diff
changeset
|
88 | typedef enum { |
|
20370
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
89 | /** Command is usable in IMs. */ |
| 15884 | 90 | PURPLE_CMD_FLAG_IM = 0x01, |
|
20370
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
91 | /** Command is usable in multi-user chats. */ |
| 15884 | 92 | PURPLE_CMD_FLAG_CHAT = 0x02, |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36545
diff
changeset
|
93 | /** Command is usable only for a particular protocol. */ |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
94 | PURPLE_CMD_FLAG_PROTOCOL_ONLY = 0x04, |
|
20370
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
95 | /** Incorrect arguments to this command should be accepted anyway. */ |
|
25105
fe13c190ca13
Remove the commas at the end of enumerator lists. This resolves warnings
Florian Quèze <florian@instantbird.org>
parents:
23555
diff
changeset
|
96 | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS = 0x08 |
|
22051
61dc80506e49
C++ doesn't really allow forward declarations of enums, and we
Mark Doliner <markdoliner@pidgin.im>
parents:
20370
diff
changeset
|
97 | } PurpleCmdFlag; |
| 9130 | 98 | |
| 99 | ||
| 100 | /*@}*/ | |
| 101 | ||
|
32787
7072f190d6ad
Use G_BEGIN/END_DECLS in public libpurple files. This was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32438
diff
changeset
|
102 | G_BEGIN_DECLS |
| 9130 | 103 | |
|
10231
047177cee39f
[gaim-migrate @ 11366]
Andrew Hart <arhart@users.sourceforge.net>
parents:
10052
diff
changeset
|
104 | /**************************************************************************/ |
|
047177cee39f
[gaim-migrate @ 11366]
Andrew Hart <arhart@users.sourceforge.net>
parents:
10052
diff
changeset
|
105 | /** @name Commands API */ |
|
047177cee39f
[gaim-migrate @ 11366]
Andrew Hart <arhart@users.sourceforge.net>
parents:
10052
diff
changeset
|
106 | /**************************************************************************/ |
| 9130 | 107 | /*@{*/ |
| 108 | ||
| 109 | /** | |
| 110 | * Register a new command with the core. | |
| 111 | * | |
| 112 | * The command will only happen if commands are enabled, | |
| 113 | * which is a UI pref. UIs don't have to support commands at all. | |
| 114 | * | |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
115 | * @cmd: The command. This should be a UTF-8 (or ASCII) string, with no spaces |
| 9130 | 116 | * or other white space. |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
117 | * @args: A string of characters describing to libpurple how to parse this |
|
20370
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
118 | * 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:
20147
diff
changeset
|
119 | * pattern, libpurple will keep looking for another command, unless |
|
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
120 | * 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:
20147
diff
changeset
|
121 | * This string should contain no whitespace, and use a single |
|
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
122 | * character for each argument. The recognized characters are: |
|
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
123 | * <ul> |
|
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
124 | * <li><tt>'w'</tt>: Matches a single word.</li> |
|
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
125 | * <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:
20147
diff
changeset
|
126 | * <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:
20147
diff
changeset
|
127 | * point, as a single string.</li> |
|
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
128 | * <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:
20147
diff
changeset
|
129 | * </ul> |
| 9130 | 130 | * If args is the empty string, then the command accepts no arguments. |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
131 | * The args passed to the callback @a func will be a %NULL |
|
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
132 | * terminated array of %NULL terminated strings, and will always |
|
20370
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
133 | * match the number of arguments asked for, unless |
|
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
134 | * #PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS is passed. |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
135 | * @p: This is the priority. Higher priority commands will be run first, |
|
20370
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
136 | * 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:
20147
diff
changeset
|
137 | * called. |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
138 | * @f: Flags specifying various options about this command, combined with |
|
20370
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
139 | * <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:
20147
diff
changeset
|
140 | * #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:
20147
diff
changeset
|
141 | * order for the command to ever actually be called. |
|
37034
9d6765962b22
Initial replacements for this branch
Ankit Vani <a@nevitus.org>
parents:
37023
diff
changeset
|
142 | * @protocol_id: If the #PURPLE_CMD_FLAG_PROTOCOL_ONLY flag is set, this is the id |
|
36637
9b0109ae118d
Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents:
36545
diff
changeset
|
143 | * of the protocol to which the command applies (such as |
|
20370
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
144 | * <tt>"prpl-msn"</tt>). If the flag is not set, this parameter |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
145 | * is ignored; pass %NULL (or a humourous string of your |
|
20370
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
146 | * choice!). |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
147 | * @func: This is the function to call when someone enters this command. |
|
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
148 | * @helpstr: a whitespace sensitive, UTF-8, HTML string describing how to |
|
20370
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
149 | * 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:
20147
diff
changeset
|
150 | * 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:
20147
diff
changeset
|
151 | * accepts (if it takes any arguments, otherwise no space), |
|
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
152 | * 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:
20147
diff
changeset
|
153 | * 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:
20147
diff
changeset
|
154 | * command name. |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
155 | * @data: User defined data to pass to the #PurpleCmdFunc @a f. |
|
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
156 | * Returns: A #PurpleCmdId, which is only used for calling |
|
20370
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
157 | * #purple_cmd_unregister, or @a 0 on failure. |
| 9130 | 158 | */ |
| 15884 | 159 | PurpleCmdId purple_cmd_register(const gchar *cmd, const gchar *args, PurpleCmdPriority p, PurpleCmdFlag f, |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
160 | const gchar *protocol_id, PurpleCmdFunc func, const gchar *helpstr, void *data); |
| 9130 | 161 | |
| 162 | /** | |
| 163 | * Unregister a command with the core. | |
| 164 | * | |
| 165 | * All registered commands must be unregistered, if they're registered by a plugin | |
| 166 | * or something else that might go away. Normally this is called when the plugin | |
| 167 | * unloads itself. | |
| 168 | * | |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
169 | * @id: The #PurpleCmdId to unregister, as returned by #purple_cmd_register. |
| 9130 | 170 | */ |
| 15884 | 171 | void purple_cmd_unregister(PurpleCmdId id); |
| 9130 | 172 | |
| 173 | /** | |
| 174 | * Do a command. | |
| 175 | * | |
| 176 | * Normally the UI calls this to perform a command. This might also be useful | |
| 177 | * if aliases are ever implemented. | |
| 178 | * | |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
179 | * @conv: The conversation the command was typed in. |
|
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
180 | * @cmdline: The command the user typed (including all arguments) as a single string. |
| 9130 | 181 | * The caller doesn't have to do any parsing, except removing the command |
| 9597 | 182 | * prefix, which the core has no knowledge of. cmd should not contain any |
| 183 | * formatting, and should be in plain text (no html entities). | |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
184 | * @markup: This is the same as cmd, but is the formatted version. It should be in |
| 9175 | 185 | * HTML, with < > and &, at least, escaped to html entities, and should |
| 186 | * include both the default formatting and any extra manual formatting. | |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
187 | * @errormsg: If the command failed errormsg is filled in with the appropriate error |
|
10788
79d6a09303e7
[gaim-migrate @ 12429]
Richard Laager <rlaager@pidgin.im>
parents:
10231
diff
changeset
|
188 | * message. It must be freed by the caller with g_free(). |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
189 | * Returns: A #PurpleCmdStatus indicating if the command succeeded or failed. |
| 9130 | 190 | */ |
| 15884 | 191 | PurpleCmdStatus purple_cmd_do_command(PurpleConversation *conv, const gchar *cmdline, |
| 9175 | 192 | const gchar *markup, gchar **errormsg); |
| 9130 | 193 | |
| 194 | /** | |
| 195 | * List registered commands. | |
| 196 | * | |
|
20370
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
197 | * 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:
20147
diff
changeset
|
198 | * 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:
20147
diff
changeset
|
199 | * 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:
20147
diff
changeset
|
200 | * 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:
20147
diff
changeset
|
201 | * then. |
| 9130 | 202 | * |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
203 | * @conv: The conversation, or %NULL. |
|
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
204 | * Returns: A @c GList of <tt>const char *</tt>, which must be freed with |
|
20370
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
205 | * <tt>g_list_free()</tt>. |
| 9130 | 206 | */ |
| 15884 | 207 | GList *purple_cmd_list(PurpleConversation *conv); |
| 9130 | 208 | |
| 209 | /** | |
| 210 | * Get the help string for a command. | |
| 211 | * | |
| 212 | * Returns the help strings for a given command in the form of a GList, | |
| 213 | * one node for each matching command. | |
| 214 | * | |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
215 | * @conv: The conversation, or %NULL for no context. |
|
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
216 | * @cmd: The command. No wildcards accepted, but returns help for all |
|
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
217 | * commands if %NULL. |
|
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
218 | * Returns: A <tt>GList</tt> of <tt>const char *</tt>s, which is the help string |
| 9130 | 219 | * for that command. |
| 220 | */ | |
| 15884 | 221 | GList *purple_cmd_help(PurpleConversation *conv, const gchar *cmd); |
| 9130 | 222 | |
|
23555
82dab41b4163
cmd-added and cmd-removed signals to emit when commands are registered/unregistered.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23510
diff
changeset
|
223 | /** |
|
82dab41b4163
cmd-added and cmd-removed signals to emit when commands are registered/unregistered.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23510
diff
changeset
|
224 | * Get the handle for the commands API |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
225 | * Returns: The handle |
|
23555
82dab41b4163
cmd-added and cmd-removed signals to emit when commands are registered/unregistered.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23510
diff
changeset
|
226 | */ |
|
82dab41b4163
cmd-added and cmd-removed signals to emit when commands are registered/unregistered.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23510
diff
changeset
|
227 | gpointer purple_cmds_get_handle(void); |
|
82dab41b4163
cmd-added and cmd-removed signals to emit when commands are registered/unregistered.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23510
diff
changeset
|
228 | |
|
82dab41b4163
cmd-added and cmd-removed signals to emit when commands are registered/unregistered.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23510
diff
changeset
|
229 | /** |
|
82dab41b4163
cmd-added and cmd-removed signals to emit when commands are registered/unregistered.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23510
diff
changeset
|
230 | * Initialize the commands subsystem. |
|
82dab41b4163
cmd-added and cmd-removed signals to emit when commands are registered/unregistered.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23510
diff
changeset
|
231 | */ |
|
82dab41b4163
cmd-added and cmd-removed signals to emit when commands are registered/unregistered.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23510
diff
changeset
|
232 | void purple_cmds_init(void); |
|
82dab41b4163
cmd-added and cmd-removed signals to emit when commands are registered/unregistered.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23510
diff
changeset
|
233 | |
|
82dab41b4163
cmd-added and cmd-removed signals to emit when commands are registered/unregistered.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23510
diff
changeset
|
234 | /** |
|
82dab41b4163
cmd-added and cmd-removed signals to emit when commands are registered/unregistered.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23510
diff
changeset
|
235 | * Uninitialize the commands subsystem. |
|
82dab41b4163
cmd-added and cmd-removed signals to emit when commands are registered/unregistered.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23510
diff
changeset
|
236 | */ |
|
82dab41b4163
cmd-added and cmd-removed signals to emit when commands are registered/unregistered.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23510
diff
changeset
|
237 | void purple_cmds_uninit(void); |
|
82dab41b4163
cmd-added and cmd-removed signals to emit when commands are registered/unregistered.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23510
diff
changeset
|
238 | |
| 9130 | 239 | /*@}*/ |
| 240 | ||
|
32787
7072f190d6ad
Use G_BEGIN/END_DECLS in public libpurple files. This was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32438
diff
changeset
|
241 | G_END_DECLS |
| 9130 | 242 | |
| 15884 | 243 | #endif /* _PURPLE_CMDS_H_ */ |