libpurple/cmds.h

Fri, 10 Mar 2017 20:36:55 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Fri, 10 Mar 2017 20:36:55 -0600
changeset 38240
0552f69f1996
parent 37903
caf372ae8882
parent 38082
63975292a852
child 38545
3e287c9fe72e
permissions
-rw-r--r--

Merge 2.12.0 into default

20147
66f05a854eee applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents: 19859
diff changeset
1 /* Copyright (C) 2003 Timothy Ringenbach <omarvo@hotmail.com>
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
2 *
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
3 * This program is free software; you can redistribute it and/or modify
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
4 * 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
5 * the Free Software Foundation; either version 2 of the License, or
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
6 * (at your option) any later version.
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 distributed in the hope that it will be useful,
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
11 * GNU General Public License for more details.
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 * You should have received a copy of the GNU General Public License
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
14 * 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
15 * 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
16 *
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
17 */
35487
494f09f7f331 Move section blocks inside inclusion guards -- otherwise g-ir-scanner yells
Ankit Vani <a@nevitus.org>
parents: 35486
diff changeset
18
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
19 #ifndef _PURPLE_CMDS_H_
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
20 #define _PURPLE_CMDS_H_
35433
8dcae6cd6628 Add section blocks for account.h to connection.h
Ankit Vani <a@nevitus.org>
parents: 35419
diff changeset
21 /**
8dcae6cd6628 Add section blocks for account.h to connection.h
Ankit Vani <a@nevitus.org>
parents: 35419
diff changeset
22 * SECTION:cmds
8dcae6cd6628 Add section blocks for account.h to connection.h
Ankit Vani <a@nevitus.org>
parents: 35419
diff changeset
23 * @section_id: libpurple-cmds
35436
a69d2e5604c5 Swap @title and @short_description roles
Ankit Vani <a@nevitus.org>
parents: 35433
diff changeset
24 * @short_description: <filename>cmds.h</filename>
a69d2e5604c5 Swap @title and @short_description roles
Ankit Vani <a@nevitus.org>
parents: 35433
diff changeset
25 * @title: Commands API
35433
8dcae6cd6628 Add section blocks for account.h to connection.h
Ankit Vani <a@nevitus.org>
parents: 35419
diff changeset
26 * @see_also: <link linkend="chapter-signals-cmd">Command signals</link>
8dcae6cd6628 Add section blocks for account.h to connection.h
Ankit Vani <a@nevitus.org>
parents: 35419
diff changeset
27 */
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
28
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
29 #include "conversation.h"
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
30
10231
047177cee39f [gaim-migrate @ 11366]
Andrew Hart <arhart@users.sourceforge.net>
parents: 10052
diff changeset
31 /**************************************************************************/
35472
474e26199560 Removed @name
Ankit Vani <a@nevitus.org>
parents: 35471
diff changeset
32 /* Structures */
10231
047177cee39f [gaim-migrate @ 11366]
Andrew Hart <arhart@users.sourceforge.net>
parents: 10052
diff changeset
33 /**************************************************************************/
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
34
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
35 /**
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
36 * PurpleCmdStatus:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
37 *
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
38 * 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
39 */
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
40 typedef enum {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
41 PURPLE_CMD_STATUS_OK,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
42 PURPLE_CMD_STATUS_FAILED,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
43 PURPLE_CMD_STATUS_NOT_FOUND,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
44 PURPLE_CMD_STATUS_WRONG_ARGS,
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
45 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
46 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
47 } PurpleCmdStatus;
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
48
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
49 /**
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
50 * PurpleCmdRet:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
51 * @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
52 * to call.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
53 * @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
54 * @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
55 * name to call.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
56 *
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
57 * 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
58 * 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
59 * 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
60 * 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
61 * #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
62 * 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
63 */
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
64 typedef enum {
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
65 PURPLE_CMD_RET_OK,
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
66 PURPLE_CMD_RET_FAILED,
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
67 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
68 } PurpleCmdRet;
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
69
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
70 #define PURPLE_CMD_FUNC(func) ((PurpleCmdFunc)func)
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9343
diff changeset
71
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
72 /**
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
73 * 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
74 *
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
75 * 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
76 */
35473
b5427137c6d0 Remove @todo
Ankit Vani <a@nevitus.org>
parents: 35472
diff changeset
77 /* TODO document the arguments to these functions. */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
78 typedef PurpleCmdRet (*PurpleCmdFunc)(PurpleConversation *, const gchar *cmd,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9343
diff changeset
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
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
87 typedef guint PurpleCmdId;
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
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
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
90 PURPLE_CMD_P_VERY_LOW = -1000,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
91 PURPLE_CMD_P_LOW = 0,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
92 PURPLE_CMD_P_DEFAULT = 1000,
37040
91119588bc3a Merge gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37035 35397
diff changeset
93 PURPLE_CMD_P_PROTOCOL = 2000,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
94 PURPLE_CMD_P_PLUGIN = 3000,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
95 PURPLE_CMD_P_ALIAS = 4000,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
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
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
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.
37040
91119588bc3a Merge gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37035 35397
diff changeset
104 * @PURPLE_CMD_FLAG_PROTOCOL_ONLY: Command is usable only for a particular
91119588bc3a Merge gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37035 35397
diff changeset
105 * protocol.
35397
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 *
35471
a23769351b31 Remove @see
Ankit Vani <a@nevitus.org>
parents: 35468
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
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
116 PURPLE_CMD_FLAG_IM = 0x01,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
117 PURPLE_CMD_FLAG_CHAT = 0x02,
37040
91119588bc3a Merge gtkdoc-conversion
Ankit Vani <a@nevitus.org>
parents: 37035 35397
diff changeset
118 PURPLE_CMD_FLAG_PROTOCOL_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
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
121
37685
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
122 /**
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
123 * Command UI operations; UIs should implement this if they want to handle
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
124 * commands themselves, rather than relying on the core.
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
125 *
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
126 * @see @ref ui-ops
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
127 */
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
128 typedef struct
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
129 {
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
130 /** If implemented, the UI is responsible for handling commands. */
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
131 /* @see purple_cmd_register for the argument values. */
37686
403b13cb3a47 PurpleCommandsUiOps: minor naming/docs fixes
dx <dx@dxzone.com.ar>
parents: 37685
diff changeset
132 void (*register_command)(const gchar *name, PurpleCmdPriority priority,
403b13cb3a47 PurpleCommandsUiOps: minor naming/docs fixes
dx <dx@dxzone.com.ar>
parents: 37685
diff changeset
133 PurpleCmdFlag flags, const gchar *prpl_id,
37903
caf372ae8882 Fix up the commands execute stuff
Gary Kramlich <grim@reaperworld.com>
parents: 37901
diff changeset
134 const gchar *help, PurpleCmdId id);
37685
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
135
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
136 /** Should be implemented if register_command is implemented.
37686
403b13cb3a47 PurpleCommandsUiOps: minor naming/docs fixes
dx <dx@dxzone.com.ar>
parents: 37685
diff changeset
137 * name and prpl_id will have the same value that were used
37685
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
138 * for the register_command call.
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
139 */
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
140 void (*unregister_command)(const gchar *name, const gchar *prpl_id);
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
141
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
142 void (*_purple_reserved1)(void);
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
143 void (*_purple_reserved2)(void);
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
144 void (*_purple_reserved3)(void);
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
145 void (*_purple_reserved4)(void);
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
146 } PurpleCommandsUiOps;
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
147
32787
7072f190d6ad Use G_BEGIN/END_DECLS in public libpurple files. This was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
148 G_BEGIN_DECLS
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
149
10231
047177cee39f [gaim-migrate @ 11366]
Andrew Hart <arhart@users.sourceforge.net>
parents: 10052
diff changeset
150 /**************************************************************************/
35472
474e26199560 Removed @name
Ankit Vani <a@nevitus.org>
parents: 35471
diff changeset
151 /* Commands API */
10231
047177cee39f [gaim-migrate @ 11366]
Andrew Hart <arhart@users.sourceforge.net>
parents: 10052
diff changeset
152 /**************************************************************************/
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
153
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
154 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
155 * purple_cmd_register:
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
156 * @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
157 * or other white space.
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
158 * @args: A string of characters describing to libpurple how to parse this
35682
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
159 * command's arguments. If what the user types doesn't match this
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
160 * pattern, libpurple will keep looking for another command, unless
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
161 * the flag #PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS is passed in @f.
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
162 * This string should contain no whitespace, and use a single
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
163 * character for each argument. The recognized characters are:
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
164 * <itemizedlist>
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
165 * <listitem><literal>'w'</literal>: Matches a single word.</listitem>
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
166 * <listitem><literal>'W'</literal>: Matches a single word, with
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
167 * formatting.</listitem>
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
168 * <listitem><literal>'s'</literal>: Matches the rest of the
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
169 * arguments after this point,
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
170 * as a single string.</listitem>
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
171 * <listitem><literal>'S'</literal>: Same as <literal>'s'</literal>
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
172 * but with formatting.</listitem>
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
173 * </itemizedlist>
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
174 * If args is the empty string, then the command accepts no
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
175 * arguments. The args passed to the callback @func will be a %NULL
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
176 * terminated array of %NULL terminated strings, and will always
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
177 * match the number of arguments asked for, unless
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
178 * #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
179 * @p: This is the priority. Higher priority commands will be run first,
35682
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
180 * and usually the first command will stop any others from being
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
181 * called.
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
182 * @f: Flags specifying various options about this command, combined with
35682
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
183 * <literal>|</literal> (bitwise OR). You need to at least pass one of
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
184 * #PURPLE_CMD_FLAG_IM or #PURPLE_CMD_FLAG_CHAT (you may pass both) in
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
185 * 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
186 * @protocol_id: If the #PURPLE_CMD_FLAG_PROTOCOL_ONLY flag is set, this is the id
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
187 * of the protocol to which the command applies (such as
35419
d0aecd9a8104 Get rid of <tt>
Ankit Vani <a@nevitus.org>
parents: 35397
diff changeset
188 * <literal>"prpl-msn"</literal>). If the flag is not set, this
d0aecd9a8104 Get rid of <tt>
Ankit Vani <a@nevitus.org>
parents: 35397
diff changeset
189 * parameter is ignored; pass %NULL (or a humourous string of
d0aecd9a8104 Get rid of <tt>
Ankit Vani <a@nevitus.org>
parents: 35397
diff changeset
190 * your choice!).
35682
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
191 * @func: (scope call): This is the function to call when someone enters this
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
192 * command.
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
193 * @helpstr: a whitespace sensitive, UTF-8, HTML string describing how to
35682
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
194 * use the command. The preferred format of this string is the
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
195 * command's name, followed by a space and any arguments it
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
196 * accepts (if it takes any arguments, otherwise no space),
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
197 * followed by a colon, two spaces, and a description of the
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
198 * command in sentence form. Do not include a slash before the
65c1912ee2c8 Add (scope) annotation to callback parameters (account.h to proxy.h)
Ankit Vani <a@nevitus.org>
parents: 35538
diff changeset
199 * command name.
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
200 * @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
201 *
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
202 * Register a new command with the core.
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
203 *
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
204 * The command will only happen if commands are enabled,
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
205 * 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
206 *
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
207 * 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
208 * #purple_cmd_unregister, or 0 on failure.
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
209 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
210 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
211 const gchar *protocol_id, PurpleCmdFunc func, const gchar *helpstr, void *data);
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 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
214 * purple_cmd_unregister:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
215 * @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
216 *
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
217 * Unregister a command with the core.
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
218 *
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
219 * 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
220 * 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
221 * unloads itself.
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
222 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
223 void purple_cmd_unregister(PurpleCmdId id);
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
224
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
225 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
226 * purple_cmd_do_command:
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
227 * @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
228 * @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
229 * 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
230 * 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
231 * 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
232 * @markup: This is the same as cmd, but is the formatted version. It should be in
9175
50bd82a24830 [gaim-migrate @ 9970]
Tim Ringenbach <marv@pidgin.im>
parents: 9143
diff changeset
233 * HTML, with < > and &, at least, escaped to html entities, and should
50bd82a24830 [gaim-migrate @ 9970]
Tim Ringenbach <marv@pidgin.im>
parents: 9143
diff changeset
234 * 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
235 * @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
236 * 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
237 *
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
238 * Do a command.
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
239 *
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
240 * 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
241 * if aliases are ever implemented.
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
242 *
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
243 * Returns: A #PurpleCmdStatus indicating if the command succeeded or failed.
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
244 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
245 PurpleCmdStatus purple_cmd_do_command(PurpleConversation *conv, const gchar *cmdline,
9175
50bd82a24830 [gaim-migrate @ 9970]
Tim Ringenbach <marv@pidgin.im>
parents: 9143
diff changeset
246 const gchar *markup, gchar **errormsg);
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
247
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
248 /**
37685
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
249 * Execute a specific command.
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
250 *
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
251 * The UI calls this to execute a command, after parsing the
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
252 * command name.
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
253 *
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
254 * @param c The command to execute.
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
255 * @param conv The conversation the command was typed in.
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
256 * @param cmdline The command the user typed (only the arguments).
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
257 * The caller should remove the prefix and the command name.
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
258 * It should not contain any formatting, and should be
37686
403b13cb3a47 PurpleCommandsUiOps: minor naming/docs fixes
dx <dx@dxzone.com.ar>
parents: 37685
diff changeset
259 * in plain text (no HTML entities).
403b13cb3a47 PurpleCommandsUiOps: minor naming/docs fixes
dx <dx@dxzone.com.ar>
parents: 37685
diff changeset
260 * @return TRUE if the command handled the @a cmdline, FALSE otherwise.
37685
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
261 */
37903
caf372ae8882 Fix up the commands execute stuff
Gary Kramlich <grim@reaperworld.com>
parents: 37901
diff changeset
262 gboolean purple_cmd_execute(PurpleCmdId id, PurpleConversation *conv,
37685
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
263 const gchar *cmdline);
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
264
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
265 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
266 * purple_cmd_list:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
267 * @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
268 *
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
269 * List registered commands.
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
270 *
35419
d0aecd9a8104 Get rid of <tt>
Ankit Vani <a@nevitus.org>
parents: 35397
diff changeset
271 * Returns a #GList (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
272 * 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
273 * %NULL. Don't keep this list around past the main loop, or anything else that
35419
d0aecd9a8104 Get rid of <tt>
Ankit Vani <a@nevitus.org>
parents: 35397
diff changeset
274 * might unregister a command, as the <type>const char *</type>'s used get freed
20370
f24b280e0c29 Let's document more of cmds.h!
Will Thompson <resiak@pidgin.im>
parents: 20147
diff changeset
275 * then.
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
276 *
35419
d0aecd9a8104 Get rid of <tt>
Ankit Vani <a@nevitus.org>
parents: 35397
diff changeset
277 * Returns: A #GList of <type>const char *</type>, which must be freed with
d0aecd9a8104 Get rid of <tt>
Ankit Vani <a@nevitus.org>
parents: 35397
diff changeset
278 * g_list_free().
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
279 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
280 GList *purple_cmd_list(PurpleConversation *conv);
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
281
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
282 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
283 * purple_cmd_help:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
284 * @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
285 * @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
286 * commands if %NULL.
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
287 *
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
288 * Get the help string for a command.
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
289 *
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
290 * 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
291 * one node for each matching command.
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
292 *
35419
d0aecd9a8104 Get rid of <tt>
Ankit Vani <a@nevitus.org>
parents: 35397
diff changeset
293 * Returns: A #GList of <type>const char *</type>s, which is the help string
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
294 * for that command.
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
295 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
296 GList *purple_cmd_help(PurpleConversation *conv, const gchar *cmd);
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
297
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
298 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
299 * purple_cmds_get_handle:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
300 *
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
301 * Get the handle for the commands API
35538
d95fa87c8429 Add missing blank line before 'Returns:'
Ankit Vani <a@nevitus.org>
parents: 35487
diff changeset
302 *
35393
00f876b129bc Initial replacements for gtk-doc style comments
Ankit Vani <a@nevitus.org>
parents: 32787
diff changeset
303 * 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
304 */
82dab41b4163 cmd-added and cmd-removed signals to emit when commands are registered/unregistered.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23510
diff changeset
305 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
306
82dab41b4163 cmd-added and cmd-removed signals to emit when commands are registered/unregistered.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23510
diff changeset
307 /**
37685
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
308 * Sets the UI operations structure to be used when registering and
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
309 * unregistering commands. The UI operations need only be set if the
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
310 * UI wants to handle the commands itself; otherwise, leave it as NULL.
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
311 *
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
312 * @param ops The UI operations structure.
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
313 */
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
314 void purple_cmds_set_ui_ops(PurpleCommandsUiOps *ops);
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
315
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
316 /**
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
317 * Returns the UI operations structure to be used when registering and
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
318 * unregistering commands.
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
319 *
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
320 * @return The UI operations structure.
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
321 */
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
322 PurpleCommandsUiOps *purple_cmds_get_ui_ops(void);
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
323
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
324 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
325 * purple_cmds_init:
37685
ef161f30f8bc Add PurpleCommandsUiOps API from instantbird
Florian Quèze <florian@instantbird.org>
parents: 25105
diff changeset
326 *
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
327 * 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
328 */
82dab41b4163 cmd-added and cmd-removed signals to emit when commands are registered/unregistered.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23510
diff changeset
329 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
330
82dab41b4163 cmd-added and cmd-removed signals to emit when commands are registered/unregistered.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23510
diff changeset
331 /**
35397
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
332 * purple_cmds_uninit:
31fa3a1aeff5 Move changes from soc.2013.gobjectification.gtkdoc to this branch
Ankit Vani <a@nevitus.org>
parents: 35393
diff changeset
333 *
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
334 * 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
335 */
82dab41b4163 cmd-added and cmd-removed signals to emit when commands are registered/unregistered.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23510
diff changeset
336 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
337
32787
7072f190d6ad Use G_BEGIN/END_DECLS in public libpurple files. This was
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32438
diff changeset
338 G_END_DECLS
9130
2e67295dd047 [gaim-migrate @ 9908]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
339
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
340 #endif /* _PURPLE_CMDS_H_ */

mercurial