Fri, 31 Jan 2014 20:02:40 +0530
Move changes from soc.2013.gobjectification.gtkdoc to this 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 | ||
|
35397
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
34 | /** |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
35 | * PurpleCmdStatus: |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
36 | * |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
37 | * The possible results of running a command with purple_cmd_do_command(). |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
38 | */ |
|
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
|
39 | typedef enum { |
| 15884 | 40 | PURPLE_CMD_STATUS_OK, |
| 41 | PURPLE_CMD_STATUS_FAILED, | |
| 42 | PURPLE_CMD_STATUS_NOT_FOUND, | |
| 43 | PURPLE_CMD_STATUS_WRONG_ARGS, | |
| 44 | PURPLE_CMD_STATUS_WRONG_PRPL, | |
|
25105
fe13c190ca13
Remove the commas at the end of enumerator lists. This resolves warnings
Florian Quèze <florian@instantbird.org>
parents:
23555
diff
changeset
|
45 | 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
|
46 | } PurpleCmdStatus; |
| 9130 | 47 | |
|
35397
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
48 | /** |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
49 | * PurpleCmdRet: |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
50 | * @PURPLE_CMD_RET_OK: Everything's okay; Don't look for another command |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
51 | * to call. |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
52 | * @PURPLE_CMD_RET_FAILED: The command failed, but stop looking. |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
53 | * @PURPLE_CMD_RET_CONTINUE: Continue, looking for other commands with the same |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
54 | * name to call. |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
55 | * |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
56 | * Commands registered with the core return one of these values when run. |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
57 | * Normally, a command will want to return one of the first two; in some |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
58 | * unusual cases, you might want to have several functions called for a |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
59 | * particular command; in this case, they should return |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
60 | * #PURPLE_CMD_RET_CONTINUE to cause the core to fall through to other |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
61 | * commands with the same name. |
|
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
|
62 | */ |
|
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
|
63 | typedef enum { |
|
35397
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
64 | PURPLE_CMD_RET_OK, |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
65 | PURPLE_CMD_RET_FAILED, |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
66 | PURPLE_CMD_RET_CONTINUE |
|
22051
61dc80506e49
C++ doesn't really allow forward declarations of enums, and we
Mark Doliner <markdoliner@pidgin.im>
parents:
20370
diff
changeset
|
67 | } PurpleCmdRet; |
| 9130 | 68 | |
| 15884 | 69 | #define PURPLE_CMD_FUNC(func) ((PurpleCmdFunc)func) |
| 9597 | 70 | |
|
35397
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
71 | /** |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
72 | * PurpleCmdFunc: |
|
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
|
73 | * |
|
35397
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
74 | * A function implementing a command, as passed to purple_cmd_register(). |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
75 | * |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
76 | * @todo document the arguments to these functions. |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
77 | */ |
| 15884 | 78 | typedef PurpleCmdRet (*PurpleCmdFunc)(PurpleConversation *, const gchar *cmd, |
| 9597 | 79 | gchar **args, gchar **error, void *data); |
|
35397
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
80 | /** |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
81 | * PurpleCmdId: |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
82 | * |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
83 | * A unique integer representing a command registered with |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
84 | * purple_cmd_register(), which can subsequently be passed to |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
85 | * purple_cmd_unregister() to unregister that command. |
|
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
|
86 | */ |
| 15884 | 87 | typedef guint PurpleCmdId; |
| 9130 | 88 | |
|
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
|
89 | typedef enum { |
| 15884 | 90 | PURPLE_CMD_P_VERY_LOW = -1000, |
| 91 | PURPLE_CMD_P_LOW = 0, | |
| 92 | PURPLE_CMD_P_DEFAULT = 1000, | |
| 93 | PURPLE_CMD_P_PRPL = 2000, | |
| 94 | PURPLE_CMD_P_PLUGIN = 3000, | |
| 95 | PURPLE_CMD_P_ALIAS = 4000, | |
| 96 | 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
|
97 | 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
|
98 | } PurpleCmdPriority; |
| 9130 | 99 | |
|
35397
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
100 | /** |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
101 | * PurpleCmdFlag: |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
102 | * @PURPLE_CMD_FLAG_IM: Command is usable in IMs. |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
103 | * @PURPLE_CMD_FLAG_CHAT: Command is usable in multi-user chats. |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
104 | * @PURPLE_CMD_FLAG_PRPL_ONLY: Command is usable only for a particular |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
105 | * protocol. |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
106 | * @PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS: Incorrect arguments to this command |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
107 | * should be accepted anyway. |
|
20370
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
108 | * |
|
35397
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
109 | * Flags used to set various properties of commands. Every command should |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
110 | * have at least one of #PURPLE_CMD_FLAG_IM and #PURPLE_CMD_FLAG_CHAT set in |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
111 | * order to be even slighly useful. |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
112 | * |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
113 | * @see purple_cmd_register |
|
20370
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
114 | */ |
|
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
|
115 | typedef enum { |
| 15884 | 116 | PURPLE_CMD_FLAG_IM = 0x01, |
| 117 | PURPLE_CMD_FLAG_CHAT = 0x02, | |
| 118 | PURPLE_CMD_FLAG_PRPL_ONLY = 0x04, | |
|
25105
fe13c190ca13
Remove the commas at the end of enumerator lists. This resolves warnings
Florian Quèze <florian@instantbird.org>
parents:
23555
diff
changeset
|
119 | 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
|
120 | } PurpleCmdFlag; |
| 9130 | 121 | |
| 122 | ||
| 123 | /*@}*/ | |
| 124 | ||
|
32787
7072f190d6ad
Use G_BEGIN/END_DECLS in public libpurple files. This was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32438
diff
changeset
|
125 | G_BEGIN_DECLS |
| 9130 | 126 | |
|
10231
047177cee39f
[gaim-migrate @ 11366]
Andrew Hart <arhart@users.sourceforge.net>
parents:
10052
diff
changeset
|
127 | /**************************************************************************/ |
|
047177cee39f
[gaim-migrate @ 11366]
Andrew Hart <arhart@users.sourceforge.net>
parents:
10052
diff
changeset
|
128 | /** @name Commands API */ |
|
047177cee39f
[gaim-migrate @ 11366]
Andrew Hart <arhart@users.sourceforge.net>
parents:
10052
diff
changeset
|
129 | /**************************************************************************/ |
| 9130 | 130 | /*@{*/ |
| 131 | ||
| 132 | /** | |
|
35397
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
133 | * purple_cmd_register: |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
134 | * @cmd: The command. This should be a UTF-8 (or ASCII) string, with no spaces |
| 9130 | 135 | * or other white space. |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
136 | * @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
|
137 | * 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
|
138 | * pattern, libpurple will keep looking for another command, unless |
|
35397
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
139 | * the flag #PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS is passed in @f. |
|
20370
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
140 | * 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
|
141 | * 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
|
142 | * <ul> |
|
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
143 | * <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
|
144 | * <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
|
145 | * <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
|
146 | * point, as a single string.</li> |
|
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
147 | * <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
|
148 | * </ul> |
| 9130 | 149 | * If args is the empty string, then the command accepts no arguments. |
|
35397
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
150 | * The args passed to the callback @func will be a %NULL |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
151 | * 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
|
152 | * 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
|
153 | * #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
|
154 | * @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
|
155 | * 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
|
156 | * called. |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
157 | * @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
|
158 | * <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
|
159 | * #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
|
160 | * order for the command to ever actually be called. |
|
35397
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
161 | * @protocol_id: If the #PURPLE_CMD_FLAG_PRPL_ONLY flag is set, this is the id |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
162 | * 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
|
163 | * <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
|
164 | * 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
|
165 | * choice!). |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
166 | * @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
|
167 | * @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
|
168 | * 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
|
169 | * 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
|
170 | * 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
|
171 | * 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
|
172 | * 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
|
173 | * command name. |
|
35397
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
174 | * @data: User defined data to pass to the #PurpleCmdFunc @f. |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
175 | * |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
176 | * Register a new command with the core. |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
177 | * |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
178 | * The command will only happen if commands are enabled, |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
179 | * which is a UI pref. UIs don't have to support commands at all. |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
180 | * |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
181 | * Returns: A #PurpleCmdId, which is only used for calling |
|
35397
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
182 | * #purple_cmd_unregister, or 0 on failure. |
| 9130 | 183 | */ |
| 15884 | 184 | PurpleCmdId purple_cmd_register(const gchar *cmd, const gchar *args, PurpleCmdPriority p, PurpleCmdFlag f, |
|
35397
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
185 | const gchar *protocol_id, PurpleCmdFunc func, const gchar *helpstr, void *data); |
| 9130 | 186 | |
| 187 | /** | |
|
35397
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
188 | * purple_cmd_unregister: |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
189 | * @id: The #PurpleCmdId to unregister, as returned by #purple_cmd_register. |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
190 | * |
| 9130 | 191 | * Unregister a command with the core. |
| 192 | * | |
| 193 | * All registered commands must be unregistered, if they're registered by a plugin | |
| 194 | * or something else that might go away. Normally this is called when the plugin | |
| 195 | * unloads itself. | |
| 196 | */ | |
| 15884 | 197 | void purple_cmd_unregister(PurpleCmdId id); |
| 9130 | 198 | |
| 199 | /** | |
|
35397
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
200 | * purple_cmd_do_command: |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
201 | * @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
|
202 | * @cmdline: The command the user typed (including all arguments) as a single string. |
| 9130 | 203 | * The caller doesn't have to do any parsing, except removing the command |
| 9597 | 204 | * prefix, which the core has no knowledge of. cmd should not contain any |
| 205 | * 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
|
206 | * @markup: This is the same as cmd, but is the formatted version. It should be in |
| 9175 | 207 | * HTML, with < > and &, at least, escaped to html entities, and should |
| 208 | * 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
|
209 | * @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
|
210 | * message. It must be freed by the caller with g_free(). |
|
35397
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
211 | * |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
212 | * Do a command. |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
213 | * |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
214 | * Normally the UI calls this to perform a command. This might also be useful |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
215 | * if aliases are ever implemented. |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
216 | * |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
217 | * Returns: A #PurpleCmdStatus indicating if the command succeeded or failed. |
| 9130 | 218 | */ |
| 15884 | 219 | PurpleCmdStatus purple_cmd_do_command(PurpleConversation *conv, const gchar *cmdline, |
| 9175 | 220 | const gchar *markup, gchar **errormsg); |
| 9130 | 221 | |
| 222 | /** | |
|
35397
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
223 | * purple_cmd_list: |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
224 | * @conv: The conversation, or %NULL. |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
225 | * |
| 9130 | 226 | * List registered commands. |
| 227 | * | |
|
20370
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
228 | * Returns a <tt>GList</tt> (which must be freed by the caller) of all commands |
|
35397
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
229 | * that are valid in the context of @conv, or all commands, if @conv is |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
230 | * %NULL. Don't keep this list around past the main loop, or anything else that |
|
20370
f24b280e0c29
Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
231 | * 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
|
232 | * then. |
| 9130 | 233 | * |
|
35397
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
234 | * Returns: A #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
|
235 | * <tt>g_list_free()</tt>. |
| 9130 | 236 | */ |
| 15884 | 237 | GList *purple_cmd_list(PurpleConversation *conv); |
| 9130 | 238 | |
| 239 | /** | |
|
35397
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
240 | * purple_cmd_help: |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
241 | * @conv: The conversation, or %NULL for no context. |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
242 | * @cmd: The command. No wildcards accepted, but returns help for all |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
243 | * commands if %NULL. |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
244 | * |
| 9130 | 245 | * Get the help string for a command. |
| 246 | * | |
| 247 | * Returns the help strings for a given command in the form of a GList, | |
| 248 | * one node for each matching command. | |
| 249 | * | |
|
35393
00f876b129bc
Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents:
32787
diff
changeset
|
250 | * Returns: A <tt>GList</tt> of <tt>const char *</tt>s, which is the help string |
| 9130 | 251 | * for that command. |
| 252 | */ | |
| 15884 | 253 | GList *purple_cmd_help(PurpleConversation *conv, const gchar *cmd); |
| 9130 | 254 | |
|
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
|
255 | /** |
|
35397
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
256 | * purple_cmds_get_handle: |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
257 | * |
|
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
|
258 | * 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
|
259 | * 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
|
260 | */ |
|
82dab41b4163
cmd-added and cmd-removed signals to emit when commands are registered/unregistered.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23510
diff
changeset
|
261 | 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
|
262 | |
|
82dab41b4163
cmd-added and cmd-removed signals to emit when commands are registered/unregistered.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23510
diff
changeset
|
263 | /** |
|
35397
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
264 | * purple_cmds_init: |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
265 | * |
|
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
|
266 | * 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
|
267 | */ |
|
82dab41b4163
cmd-added and cmd-removed signals to emit when commands are registered/unregistered.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23510
diff
changeset
|
268 | 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
|
269 | |
|
82dab41b4163
cmd-added and cmd-removed signals to emit when commands are registered/unregistered.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23510
diff
changeset
|
270 | /** |
|
35397
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
271 | * purple_cmds_uninit: |
|
31fa3a1aeff5
Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents:
35393
diff
changeset
|
272 | * |
|
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
|
273 | * 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
|
274 | */ |
|
82dab41b4163
cmd-added and cmd-removed signals to emit when commands are registered/unregistered.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23510
diff
changeset
|
275 | 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
|
276 | |
| 9130 | 277 | /*@}*/ |
| 278 | ||
|
32787
7072f190d6ad
Use G_BEGIN/END_DECLS in public libpurple files. This was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32438
diff
changeset
|
279 | G_END_DECLS |
| 9130 | 280 | |
| 15884 | 281 | #endif /* _PURPLE_CMDS_H_ */ |